Code quality management system
By setting up critical paths and regression testing mechanisms in the code management system, the problem of inability to effectively supervise code quality in the existing technology is solved, the reliability and efficiency of the system are improved, and the quality and availability of the code base are ensured.
Patent Information
- Application Number
- CN202510536681.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-04-27
AI Technical Summary
The existing code management system is unable to effectively supervise the quality of submitted codes, resulting in reduced code base availability, and high manual review pressure and low degree of automation, which affects system reliability and efficiency.
Design a code quality management system to set critical paths on the server side and conduct an audit process only when the target path submitted by the code is a critical path. The system selects the code corresponding to the latest change number at the preset time point for regression testing, updates the test tag based on the test results, and determines whether the code can be submitted to the server based on the tag comparison results.
It improves the reliability and efficiency of the code management system, reduces subsequent code inspections caused by code quality issues, and ensures the quality and availability of the code base.
Smart Images

Figure CN120045467A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of code management, and particularly to a code quality management system. Background Art
[0002] Generally, a code repository needs to be jointly written and updated by multiple members. Using a code management system can facilitate the maintenance of the code repository. The code management system usually includes a server and several clients. The server can be used to maintain the code repository. Members can submit code to the server through any client, and then the server updates the submitted code to the code repository. The update of the code can include operations such as adding, changing, and deleting the code in the code repository, so as to achieve distributed code management. For example, the Perforce system can be adopted as the code management system.
[0003] However, in the code management scenario, the existing code management systems can usually only be used to standardize the code submission process and cannot effectively supervise the quality of the submitted code. As a result, the submitted code may have quality problems, which in turn reduces the availability of the code repository. A large amount of human resources are required to locate the quality problems, resulting in low reliability and efficiency of the code management system.
[0004] In the prior art, a method has been proposed to add password book management to the code submission process, so that the code can be submitted normally only after being reviewed by specific personnel and obtaining the password information, which can ensure the quality of the code to a certain extent. However, since the code repository may involve a large amount of code that needs to be reviewed, the review pressure on the reviewers is too high, and the automation degree of the manual review method is still low.
[0005] Therefore, how to improve the reliability and efficiency of the code management system has become an urgent problem to be solved. Summary of the Invention
[0006] For the above technical problems, the technical solution adopted by the present invention is as follows: A code quality management system, the system includes: a code repository, a client, a server, a processor, and a memory storing a computer program. Among them, the server includes several critical paths, the code repository contains several codes, and each code has a corresponding change serial number. When the computer program is executed by the processor, the following steps are implemented: S101, select the code corresponding to the latest change serial number from the code repository as the code to be submitted at a preset time point.
[0007] S102, perform regression testing using the code to be submitted to obtain a regression test result.
[0008] S103, if the regression test result does not meet the first preset condition, use the change number corresponding to the code to be submitted as the first number corresponding to the test failure label.
[0009] S104, otherwise, use the change number corresponding to the code to be submitted as the second number corresponding to the test pass label.
[0010] S105, when the client submits the target code to the target path of the server, detect whether there is a critical path that is the same as the target path.
[0011] S106, if there is a critical path that is the same as the target path, compare the first number and the second number to obtain a comparison result.
[0012] S107, if the comparison result meets the second preset condition, submit the code corresponding to the second number to the server.
[0013] Compared with the prior art, the present invention has obvious beneficial effects. By means of the above technical solutions, a code quality management system provided by the present invention can achieve considerable technological progressiveness and practicality, and has wide industrial utilization value. It has at least the following beneficial effects: The present invention provides a code quality management system, which includes: a code repository, a client, a server, a processor, and a memory storing a computer program. Among them, the server includes several critical paths, the code repository contains several codes, and each code has a corresponding change number. When the computer program is executed by the processor, the following steps are implemented: S101, select the code corresponding to the latest change number from the code repository at a preset time point as the code to be submitted; S102, perform a regression test using the code to be submitted to obtain a regression test result; S103, if the regression test result does not meet the first preset condition, use the change number corresponding to the code to be submitted as the first number corresponding to the test failure label; S104, otherwise, use the change number corresponding to the code to be submitted as the second number corresponding to the test pass label; S105, when the client submits the target code to the target path of the server, detect whether there is a critical path that is the same as the target path; S106, if there is a critical path that is the same as the target path, compare the first number and the second number to obtain a comparison result; S107, if the comparison result meets the second preset condition, submit the code corresponding to the second number to the server.
[0014] It can be seen that by setting the critical path, the review process is only carried out when the target path of the code submission is the critical path, and the code corresponding to the latest change number in the code repository is selected as the code to be submitted. The code to be submitted is checked through regression testing, and the first number corresponding to the test failure label or the second number corresponding to the test pass label is updated according to the regression test result. According to the comparison result of the first number and the second number, it is determined whether the code to be submitted can be submitted to the server, which improves the reliability of code management, avoids the subsequent code inspection caused by code quality problems, and improves the efficiency of code management. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0016] Figure 1 It is a schematic flowchart of a computer program executed by a processor in a code quality management system provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0017] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0018] This embodiment provides a code quality management system. Refer to Figure 1 , which is a schematic flowchart of a computer program executed by a processor in a code quality management system provided by an embodiment of the present invention. The system includes: a code repository, a client, a server, a processor, and a memory storing a computer program. Among them, the server includes several critical paths, and the code repository contains several codes, and each code has a corresponding change number. When the computer program is executed by the processor, the following steps are implemented: S101, select the code corresponding to the latest change number from the code repository as the code to be submitted at a preset time point; S102, perform regression testing using the code to be submitted to obtain a regression test result; S103, if the regression test result does not meet the first preset condition, use the change number corresponding to the code to be submitted as the first number corresponding to the test failure label; S104. Otherwise, use the change sequence number corresponding to the code to be submitted as the second sequence number corresponding to the test pass label; S105. When the client submits the target code to the target path of the server, detect whether there is a critical path that is the same as the target path; S106. If there is a critical path that is the same as the target path, compare the first sequence number and the second sequence number to obtain a comparison result; S107. If the comparison result meets the second preset condition, submit the code corresponding to the second sequence number to the server.
[0019] Among them, the code quality management system provided in this embodiment can be based on an existing code management system, and the existing code management system can adopt systems such as the Perforce system. The code quality management system can include several clients. In this embodiment, taking a single client for code submission as an example, users can use any client for code submission according to the actual situation.
[0020] The server can include a code library. The code library can include several code libraries corresponding to different tasks. Each code library can include several code paths. The critical path can be configured by the implementer. The code submission under the critical path is the code submission that needs to be reviewed. The target path can refer to the corresponding path in the server when the client submits code to the server.
[0021] The code repository can be deployed in the client. The code repository contains several codes, and each code has a corresponding change sequence number. The change sequence number can be used to represent the version of the code.
[0022] The preset time point can be determined according to a fixed set interval. That is, the time interval between adjacent preset time points is the fixed set interval. In this embodiment, the fixed set interval can be one day.
[0023] Specifically, the code corresponding to the latest change sequence number can refer to the latest version of the code in the code repository. The regression test result can include test pass and test fail. Then the first preset condition can refer to that the regression test result is test pass.
[0024] The first sequence number corresponding to the test failure label can be used to record the change sequence number of the latest test failure code, and the second sequence number corresponding to the test pass label can be used to record the change sequence number of the latest test pass code. The comparison result can represent the magnitude relationship between the first sequence number and the second sequence number.
[0025] In a specific implementation manner, the regression test result includes a configuration compilation result and a use case simulation result.
[0026] Among them, the regression test result can include the configuration compilation result and the test case simulation result. The configuration compilation result can include two states: passed and failed. Similarly, the test case simulation result can also include two states: passed and failed.
[0027] In a specific embodiment, the first preset condition is that both the configuration compilation result and the test case simulation result are in the passed state.
[0028] Among them, when both the configuration compilation result and the test case simulation result are in the passed state, it indicates that the regression test result meets the first preset condition. Otherwise, that is, when at least one of the configuration compilation result and the test case simulation result is in the failed state, the regression test result does not meet the first preset condition.
[0029] In a specific embodiment, the second preset condition is that the second serial number is greater than or equal to the first serial number.
[0030] Among them, when the second serial number is greater than or equal to the first serial number, it indicates that the code to be submitted is the latest and passes the quality inspection based on regression testing or by the target personnel, and can be submitted to the server.
[0031] In a specific embodiment, when the computer program is executed by a processor, the following steps are also implemented: S108, if the comparison result meets the third preset condition, an alarm message is sent to the target personnel, and the server stops receiving the submitted code; After the server stops receiving the submitted code, the comparison result is continuously detected at a preset frequency until the comparison result meets the second preset condition.
[0032] Among them, when the comparison result meets the third preset condition, it indicates that there are quality problems with the code to be submitted and the target personnel need to handle it accordingly. Therefore, an alarm message is sent to the target personnel, the submission of code to the server is closed, and the comparison result is continuously detected at a preset frequency until the comparison result meets the second preset condition, and then the code can be submitted normally.
[0033] It should be noted that if the regression test of the new code to be submitted has already started before closing the submission of code to the server, the new code to be submitted may be a repaired version of the current code to be submitted. Therefore, the new code to be submitted can be allowed to be submitted normally after passing the quality inspection.
[0034] In a specific embodiment, the third preset condition is that the second serial number is less than the first serial number.
[0035] Among them, when the second serial number is less than the first serial number, it indicates that the code to be submitted is the latest but fails the quality inspection based on regression testing.
[0036] In a specific implementation, after the target person receives the warning information and the target person checks that the code to be submitted passes, the second serial number corresponding to the test pass label is modified to the change serial number corresponding to the code to be submitted, and the server starts to receive the submitted code.
[0037] Among them, the target person's check that the code to be submitted passes may mean that the target person believes that the quality determined by the regression test of the code to be submitted is negligible. At this time, the target person does not need to repair the code to be submitted. Only by modifying the second serial number corresponding to the test pass label and then modifying the comparison result, the current code to be submitted can be normally submitted to the server.
[0038] Enabling the server to receive the submission of the code can enable the server to normally receive the submitted code.
[0039] In a specific implementation, after the target person receives the warning information and the target person repairs the code to be submitted into a repaired code, the change serial number corresponding to the code to be submitted is incremented by one as the change serial number corresponding to the repaired code, and the server starts to receive the submitted code; Take the repaired code as the code to be submitted and execute steps S102 to S107.
[0040] Among them, the target person's repair of the code to be submitted into a repaired code may mean that the target person checks the quality problems of the code to be submitted and repairs the problematic parts to obtain the repaired code. The change serial number corresponding to the current code to be submitted is incremented by one as the change serial number corresponding to the repaired code, and the repaired code is used as the new code to be submitted. That is, the repaired code is used as the code of a new version. The target person can normally submit the repaired code to the code repository to execute the normal regression test process at a preset time point, and then update the comparison result so that the modified code can be normally submitted to the server.
[0041] In an implementation, the target person can directly execute the regression test process for the repaired code through the back door, and then update the comparison result so that the modified code can be normally submitted to the server, thus eliminating the need to wait for the trigger of the regression test process.
[0042] In this embodiment, by setting the critical path, the review process is only performed when the target path of the code submission is the critical path, and the code corresponding to the latest change number selected from the code repository is used as the code to be submitted. The code to be submitted is checked through regression testing, and the first number corresponding to the test failure label or the second number corresponding to the test pass label is updated according to the regression test result. Whether the code to be submitted can be submitted to the server is determined according to the comparison result of the first number and the second number, which improves the reliability of code management, avoids the subsequent code inspection caused by code quality problems, and improves the efficiency of code management.
[0043] Although some specific embodiments of the present invention have been described in detail by way of examples, those skilled in the art should understand that the above examples are only for illustration and not for limiting the scope of the present invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A code quality management system, characterized in that: The system includes: a code warehouse, a client, a server, a processor, and a memory storing a computer program, wherein the server includes a plurality of key paths, the code warehouse includes a plurality of codes, each code has a corresponding change sequence number, and when the computer program is executed by the processor, the following steps are implemented: S101, selecting the code corresponding to the latest change sequence number from the code warehouse at a preset time point as the code to be submitted; S102, performing regression testing using the code to be submitted to obtain regression testing results; S103, if the regression test result does not meet the first preset condition, using the change serial number corresponding to the code to be submitted as the first serial number corresponding to the test failure label; S104, otherwise, using the change serial number corresponding to the code to be submitted as the second serial number corresponding to the test pass label; S105, when the client submits the target code to the target path of the server, detecting whether there is a key path consistent with the target path; S106, if there is a key path that is consistent with the target path, compare the first sequence number with the second sequence number to obtain a comparison result; S107: If the comparison result meets the second preset condition, submit the code corresponding to the second serial number to the server.
2. The code quality management system according to claim 1, characterized in that: The regression test results include configuration compilation results and use case simulation results.
3. The code quality management system according to claim 2, characterized in that: The first preset condition is that both the configuration compilation result and the use case simulation result are in a passed state.
4. The code quality management system according to claim 1, characterized in that: The second preset condition is that the second sequence number is greater than or equal to the first sequence number.
5. The code quality management system according to claim 1, characterized in that: When the computer program is executed by a processor, the following steps are also implemented: S108, if the comparison result meets the third preset condition, a warning message is sent to the target person, and the server stops receiving the submitted code; After the server stops receiving the submitted code, the comparison result is continuously detected at a preset frequency until the comparison result meets the second preset condition.
6. The code quality management system according to claim 5, characterized in that: The third preset condition is that the second sequence number is smaller than the first sequence number.
7. The code quality management system according to claim 5, characterized in that: After the target person receives the warning information and checks that the code to be submitted is passed, the second serial number corresponding to the test pass label is modified to the change serial number corresponding to the code to be submitted, and the server starts to receive the submitted code.
8. The code quality management system according to claim 5, characterized in that: After the target personnel receives the warning information and fixes the code to be submitted into the repair code, the change sequence number corresponding to the code to be submitted is increased by one as the change sequence number corresponding to the repair code, and the server starts to receive the submitted code; The repaired code is used as the code to be submitted, and steps S102 to S107 are executed.
Citation Information
Patent Citations
Code detection method and device
CN104598384A
Code submission method, electronic device, storage medium and program product
CN117971692A
Code submission management system
CN119088446A
Automated evaluation of computer programming
US10303517B1
Automatic code review and code reviewer recommendation
US20140196010A1