CN106227574A - A kind of code inspection method of rule-based extension - Google Patents

A kind of code inspection method of rule-based extension Download PDF

Info

Publication number
CN106227574A
CN106227574A CN201610559099.8A CN201610559099A CN106227574A CN 106227574 A CN106227574 A CN 106227574A CN 201610559099 A CN201610559099 A CN 201610559099A CN 106227574 A CN106227574 A CN 106227574A
Authority
CN
China
Prior art keywords
rule
code inspection
code
trigger
event
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610559099.8A
Other languages
Chinese (zh)
Inventor
刘康
赵祯龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Electronic Information Industry Co Ltd
Original Assignee
Inspur Electronic Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Electronic Information Industry Co Ltd filed Critical Inspur Electronic Information Industry Co Ltd
Priority to CN201610559099.8A priority Critical patent/CN106227574A/en
Publication of CN106227574A publication Critical patent/CN106227574A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis

Abstract

The present invention provides a kind of code inspection method of rule-based extension, relate to the continuous integrating field of software development, the present invention constructs a simple regulation engine, by resolving code inspection rule configuration information, monitor Version flow of event or perform CLI, realize the flexible configuration of code inspection rule such that it is able to meet the complexity during the continuous integrating of software project and changeable code inspection demand;Specifically, this regulation engine is mainly by 1) resolver, 2) reader, 3) processor, 4) trigger composition.The present invention can be applied to the code process flow process during continuous integrating, it is achieved the flexible configuration of code inspection rule, in order to meet the complexity during the continuous integrating of software project and changeable code inspection demand.

Description

A kind of code inspection method of rule-based extension
Technical field
The present invention relates to the continuous integrating field of software development, particularly relate to the code inspection side of a kind of rule-based extension Method.
Background technology
Along with carrying out of agile development and continuous integrating concept and application, software development industry has welcome new change.Quick The core of prompt development mode is exactly iteration and incremental.And continuous integrating is one applies agile development theory the most maturely Practice of software.Continuous integrating refers to the development phase, and project carries out the compiling of persistence automatization, test, to reach control The means of code quality processed.Relevant code inspection and the instrument of continuous integrating and solution emerge in an endless stream.Gerrit collection Version management and code inspection function, are popular code inspection instruments;Jenkins is by its abundant plug-in unit Support, it is possible to realize the lasting structure of multiple demand.The practice of agile development progressively proves that continuous integrating can be in software development During have increased access to the chance of feedback information, effectively reduce the time introducing defect and repairing between defect, thus improve total Body Software Quality.
The thinking of continuous integrating and profile are distinct in practice process progressively already, but each software product Research and development be respectively arranged with again its different feature, meet specific software development need sum rule when, gerrit or jenkins etc. Instrument is the most unable to do what one wishes, and this is the most normal, it is therefore desirable to configuration management personnel can carry out function based on these instruments Cutting or extension, in form or based on too development plug-in unit, or self-developing aid etc., numerous.
Summary of the invention
In order to solve this problem, the present invention proposes a kind of code inspection method of rule-based extension.
The design of the present invention, from project demands, is conceived to the continuous integrating instruments such as gerrit and jenkins, builds rule Then engine tool, is applied to the code process flow process during continuous integrating, it is achieved the flexible configuration of code inspection rule, in order to Meet the complexity during the continuous integrating of software project and changeable code inspection demand.
The technical scheme is that
A kind of code inspection method of rule-based extension, constructs a simple regulation engine, by resolving code inspection rule Configuration information, monitors Version flow of event or performs CLI, it is achieved the flexible configuration of code inspection rule such that it is able to Meet the complexity during the continuous integrating of software project and changeable code inspection demand;Specifically, this regulation engine Mainly by 1) resolver, 2) reader, 3) processor, 4) trigger composition.
The code that catcher obtains can be uploaded information as input by resolver, is joined by the rule resolving YAML form Put file, carry out the coupling of rule, and perform the relevant execution of matched rule, transfer to trigger to process result.
Reader obtains code by monitoring flow of event or execution CLI from the code inspection instrument collecting function of gerrit Delivering a letter breath, these code inspection instruments have version management staging based on refs mechanism, possess flow of event or CLI characteristic is propped up Hold.
Processor, according to the process script configured, flow process, performs corresponding code inspection action.
Trigger can feed back to gerrit code inspection instrument by resolving with result, or it is relevant to trigger jenkins The execution of structure task, or guide to the resolving of next rule.
The present invention can be applied to the code process flow process during continuous integrating, it is achieved joining flexibly of code inspection rule Put, in order to meet the complexity during the continuous integrating of software project and changeable code inspection demand.Further, rule The trigger of engine allows it to apply and forms one " structure chain " or " building tree " such that it is able to the structure that flexible configuration is complicated Flow process.
Accompanying drawing explanation
Link residing for regulation engine in accompanying drawing 1 code inspection flow process;
Accompanying drawing 2 self-review-check configuration example table;
Accompanying drawing 3 file-filter configuration example table.
Detailed description of the invention
Below present disclosure is carried out more detailed elaboration:
From the point of view of code process flow process, regulation engine is in position shown in accompanying drawing 1:
1) first, code is uploaded to the refs/for/ of gerrit by user by git<branch>branch;
2) gerrit is when receiving the code uploaded, and can send out flow of event by event-stream;
3) now jenkins just can be by monitoring flow of event, or regular check gerrit determines whether on new code Pass, naturally it is also possible to the Pipeline mechanism by zuul provides event information for jenkins, thus triggers the structure of jenkins Build task;
4) code is uploaded event information and is first filtered by regulation engine, and whether rule-based configuration determination enters follow-up structure Build process, and trigger which structure task and perform.
Regulation engine of the present invention runs on jenkins, is in logic between gerrit and jenkins, It is functionally similar to the blocker of servlet in JavaEE.This regulation engine mates by gerrit or zuul according to configuration rule Information uploaded by the code sended over, and performs corresponding subsequent operation.
The function resolving configuration rule is completed by resolver.Resolver reads the configuration rule of yaml form, and rule is joined Put middle palpus including at least following configuration item:
1) from: specified rule is applicable to from gerrit, zuul or the trigger event of other CI instruments;
2) load: being used for reading flow of event or obtaining version management information by CLI, (local variable will for local variable assignment Judge or performance element for condition subsequent);
3) condition: configuration condition judges, conditional judgment is used for rule match, and wherein variable is from configuration in load item Data;
4) exec: perform corresponding action according to rule match situation, including performing script, feedback gerrit, starting jenkins Task dispatching.
Input data required for rule execution from zuul event or are passed through the CLI of gerrit according to configuration by reader Data needed for rule digging, required data use as local variable.
Processor performs conditional judgment defined in condition item, and performs corresponding action according to the result of exec.
If the execution action of configuration relates to gerrit feedback examination result or the task of triggering jenkins in exec item, Then it is responsible for execution by trigger.
As a example by " developer can not examine and pass through the code oneself uploaded " this rule, gerrit does not carry itself For this control of authority, then its rule configuration is as shown in Figure 2.
1) event uploaded by the code that this rule can intercept from zuul;
2) reader gets changeid($ ZUUL_CHANGE from zuul flow of event), then provided by gerrit Cli interface order query, gets this upper successor uploaded and examines people;
3) according to conditional judgment, if having multiple examination people, or only one of which examine people but examine people be not upper successor, then return Return true, otherwise return false;
4) if returning true, then trigger the jenkins task of entitled " unit-test ";Otherwise, knot is examined to gerrit feedback Fruit is-2.
Visible, regulation engine serves the effect of " blocker " in this examination flow process, originates for the time of interest Check.
Further, the trigger of regulation engine allows it to apply and is formed one " structure chain " or " building tree ", thus Can the complicated structure flow process of flexible configuration.
As a example by " carrying out different code check according to different contents of uploading " this rule, its rule configuration is such as accompanying drawing Shown in 3.
1) event uploaded by the code that this rule can intercept from zuul;
2) reader gets changeid($ ZUUL_CHANGE from zuul flow of event), then provided by gerrit Cli interface order query, gets this listed files uploaded;
3) the conditional judgment statement i.e. value of listed files;
4) the most whether comprising corresponding file according to listed files inspection, if comprising java file, then triggering checkstyle Check with compiling;If comprising xml document, then trigger unit is deployed to the inspection that Servlet container sees whether correctly to start.

Claims (5)

1. the code inspection method of a rule-based extension, it is characterised in that construct a simple regulation engine, by resolving Code inspection rule configuration information, monitors Version flow of event or performs CLI, it is achieved joining flexibly of code inspection rule Put such that it is able to meet the complexity during the continuous integrating of software project and changeable code inspection demand;Specifically, This regulation engine is mainly by 1) resolver, 2) reader, 3) processor, 4) trigger composition.
Method the most according to claim 1, it is characterised in that the code that catcher obtains can be uploaded information by resolver As input, by resolving the regular configuration file of YAML form, carry out the coupling of rule, and perform the relevant of matched rule and hold OK, trigger is transferred to process result.
Method the most according to claim 1, it is characterised in that reader is from the code inspection instrument collecting function of gerrit Obtaining code upload information by monitoring flow of event or execution CLI, these code inspection instruments have version management based on refs Staging mechanism, possesses flow of event or CLI characteristic support.
Method the most according to claim 1, its feature exists, and in processor according to the process script configured, flow process, performs phase The code inspection action answered.
Method the most according to claim 1, it is characterised in that trigger can feed back to resolving with result Gerrit code inspection instrument, or trigger jenkins and be correlated with the execution of structure task, or guide the resolving to next rule In.
CN201610559099.8A 2016-07-15 2016-07-15 A kind of code inspection method of rule-based extension Pending CN106227574A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610559099.8A CN106227574A (en) 2016-07-15 2016-07-15 A kind of code inspection method of rule-based extension

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610559099.8A CN106227574A (en) 2016-07-15 2016-07-15 A kind of code inspection method of rule-based extension

Publications (1)

Publication Number Publication Date
CN106227574A true CN106227574A (en) 2016-12-14

Family

ID=57520357

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610559099.8A Pending CN106227574A (en) 2016-07-15 2016-07-15 A kind of code inspection method of rule-based extension

Country Status (1)

Country Link
CN (1) CN106227574A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106897226A (en) * 2017-02-28 2017-06-27 郑州云海信息技术有限公司 The method and device of a kind of continuous integrating test
CN110489091A (en) * 2019-08-22 2019-11-22 辽东学院 A kind of software development process method for managing and monitoring and system
CN110968301A (en) * 2019-12-17 2020-04-07 刘庆 Code review creation method based on code version control native client and command
US10754641B2 (en) 2017-05-30 2020-08-25 Red Hat, Inc. Optimizing continuous integration (CI) using code review quality

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103677831A (en) * 2013-12-12 2014-03-26 迈普通信技术股份有限公司 On-line code inspection system and method
CN105404519A (en) * 2015-12-07 2016-03-16 青岛海信电器股份有限公司 Version control method, code testing method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103677831A (en) * 2013-12-12 2014-03-26 迈普通信技术股份有限公司 On-line code inspection system and method
CN105404519A (en) * 2015-12-07 2016-03-16 青岛海信电器股份有限公司 Version control method, code testing method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
雨前龙井: "OpenStack持续集成实践", 《HTTP://IJYUN.GITHUB.IO/2016/05/13/OPENSTACK-CI-CASE.HTML》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106897226A (en) * 2017-02-28 2017-06-27 郑州云海信息技术有限公司 The method and device of a kind of continuous integrating test
US10754641B2 (en) 2017-05-30 2020-08-25 Red Hat, Inc. Optimizing continuous integration (CI) using code review quality
CN110489091A (en) * 2019-08-22 2019-11-22 辽东学院 A kind of software development process method for managing and monitoring and system
CN110968301A (en) * 2019-12-17 2020-04-07 刘庆 Code review creation method based on code version control native client and command

Similar Documents

Publication Publication Date Title
CN106227574A (en) A kind of code inspection method of rule-based extension
US8015549B2 (en) Techniques for monitoring application calls
US20170177332A1 (en) Managing change-set delivery
DE112012006107B4 (en) The sequence program debugging supporting device
CN104991777B (en) Realize that web application automatic test view melts the system and method for hair
US10789049B2 (en) Recipe program code generation method and recipe compiling cloud platform system
CN109491663A (en) Code inspection method and device
CN106294122A (en) The software test platform of a kind of standard and method of testing thereof
CN104572231B (en) Engineering transplantation method between different operation platform and device
EP3467691B1 (en) Method of selecting software files
JP4737624B2 (en) Specific work support system for application failure causes
CN113568825B (en) Program flow debugging method, device, equipment and storage medium
Qusef Test-to-code traceability: Why and how?
KR101648307B1 (en) Log-based testing system and method for unit testing of Embedded software
JP2009230420A (en) Source code quality management device
Ferenc et al. Extracting Facts with Columbus from C++ Code.
Hukkanen Adopting continuous integration-a case study
Sangle et al. On the use of lambda expressions in 760 open source Python projects
US9268675B2 (en) Computerized system and method for auditing software code
Ortu et al. Angry-builds: an empirical study of affect metrics and builds success on github ecosystem
Monpratarnchai et al. Automated testing for Java programs using JPF-based test case generation
Chimiak-Opoka et al. A Feature Model for an IDE4OCL
JP2009205242A (en) Automatic generation device of program for verification, and method and program thereof
Frühstück et al. Debugging answer-set programs with Ouroboros–extending the SeaLion plugin
Deshpande et al. Test Automation and Continuous Integration using Jenkins for Smart Card OS

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20161214