Method and device for checking development codes
Through the integrated inspection tool, the branch code submitted by users is standardized for inspection and auditing, which solves the problems of inefficient and inconsistent code styles of traditional code review, realizes the efficiency and consistency of code inspection, and improves code quality and development efficiency.
Patent Information
- Application Number
- CN202411464214.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-02-28
AI Technical Summary
Traditional code review methods are inefficient and error-prone, and the coding habits and styles of different developers are inconsistent, resulting in inconsistent code styles and increasing the difficulty of code reading and maintenance.
By detecting the development information of user engineering projects, obtaining integrated inspection tools that match the version information, configuring the tools according to the requirements of the engineering specifications, and conducting code specification checks on the branch code submitted by the user, sending specification reminders, and reviewing them before the code is submitted.
It improves the efficiency and accuracy of code inspection, ensures the consistency and standardization of code, reduces code errors and maintenance difficulties, and improves project development efficiency and code quality.
Smart Images

Figure CN119536800A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method and device for checking development codes. Background Art
[0002] In the field of software development, code quality and teamwork have always been important factors affecting project success. Traditional code review methods mainly rely on manual work, that is, experienced developers check the code line by line to ensure that the code conforms to established specifications and styles. However, as the scale of software projects continues to expand and the amount of code increases dramatically, this manual review method has gradually exposed problems such as inefficiency and error-proneness.
[0003] In addition, different developers often have different coding habits and styles, which leads to inconsistency in code style and increases the difficulty of code reading and maintenance. In order to solve this problem, some scattered tools have been developed to check the specifications and style of the code. However, these tools can usually only check specific aspects, lack uniformity and completeness, and require developers to configure and use them by themselves, adding additional burden. Therefore, it is particularly important to propose a technical solution that can improve the efficiency and accuracy of development code inspection. Summary of the invention
[0004] The present invention provides a method and device for checking development codes, which can help improve the efficiency and accuracy of checking development codes.
[0005] In order to solve the above technical problem, the first aspect of the present invention discloses a method for checking development code, the method comprising:
[0006] Detecting development information of a project corresponding to a user, wherein the development information includes project information and version information, and the version information includes integrated development environment version information and static code analysis tool version information;
[0007] Determine engineering specification requirement information corresponding to the engineering project according to the engineering project information;
[0008] Acquire an integrated inspection tool that matches the version information, configure the integrated inspection tool according to the engineering specification requirement information, and import the configured integrated inspection tool into the engineering project;
[0009] Performing a code standard check on the branch code submitted by the user in the engineering project based on the configured integrated check tool, determining error information corresponding to the branch code, and sending a standard reminder to the user according to the error information;
[0010] When detecting the branch code submission operation triggered by the user, determining whether the branch code corresponding to the error information has been corrected, and when the branch code has not been corrected, interrupting the branch code submission operation, and sending a standard reminder to the user according to the new error information;
[0011] When the branch code is revised, code submission confirmation information corresponding to the branch code submission operation is generated, and the branch code submission operation is reviewed for submission specifications based on the code submission confirmation information, and the branch code corresponding to the branch code submission operation that has passed the review is merged into the main branch code.
[0012] As an optional implementation, in the first aspect of the present invention, the code specification check is performed on the branch code submitted by the user in the engineering project based on the configured integrated check tool to determine the error information corresponding to the branch code, including:
[0013] Determine, according to the engineering specification requirement information corresponding to the engineering project, a code specification checking rule corresponding to the engineering project, wherein the code specification checking rule includes at least one of a code format rule, a naming rule, and an annotation rule;
[0014] The branch code is compared with the code specification checking rule based on the configured integrated checking tool to determine error information corresponding to the branch code, where the error information includes code error location information.
[0015] As an optional implementation, in the first aspect of the present invention, the error information further includes code warning information and / or code error information;
[0016] The sending a standard reminder to the user according to the error information includes:
[0017] Determine, according to the error information, an error information description and a preset solution example for the error information;
[0018] Generate solution suggestion information for the error message according to the error message description and the solution example;
[0019] Generate standard check reminder information corresponding to the branch code according to the error information and the solution suggestion information, and send a standard reminder to the user based on the standard check reminder information.
[0020] As an optional implementation manner, in the first aspect of the present invention, the code submission confirmation information includes identity confirmation information and code specification confirmation information;
[0021] The step of performing a submission specification review on the branch code submission operation based on the code submission confirmation information, and merging the branch code corresponding to the branch code submission operation that has passed the review into the main branch code includes:
[0022] Determine a code review process corresponding to the user, send the code submission confirmation information to the code review process, and determine through the code review process whether the user authority of the user satisfies the code submission authority corresponding to the branch code according to the identity confirmation information;
[0023] When the user's user rights satisfy the code submission rights corresponding to the branch code, the code review process is used to determine whether the code specification confirmation information satisfies the code submission specification conditions corresponding to the branch code. When the code specification confirmation information satisfies the code submission specification conditions corresponding to the branch code, the branch code corresponding to the branch code submission operation is merged into the main branch code.
[0024] As an optional embodiment, in the first aspect of the present invention, the method further comprises:
[0025] When a version operation on the branch code triggered by the user is detected, the branch code is pushed to the version reviewer corresponding to the user through a preset review mechanism process, and the version operation includes at least one of a version publishing operation, a version creation operation, a version merging operation, and a version deletion operation;
[0026] When the code review pass information sent by the version reviewer is received, the version operation is triggered to be executed, and the version operation information of the version operation and the code review pass information are recorded.
[0027] As an optional embodiment, in the first aspect of the present invention, the method further comprises:
[0028] Acquire development specification information corresponding to the user based on preset inspection conditions, the development specification information including error information, code submission information, and version operation information corresponding to the user, and the inspection conditions including time conditions;
[0029] Analyzing the development specification analysis data corresponding to the user according to the development specification information, the development specification analysis data including the code specification check pass rate, the code error resolution rate, the code submission pass rate, and the version operation pass rate;
[0030] The data is analyzed according to the development specification corresponding to the user, and a development inspection report and a development specification score for the user are generated.
[0031] As an optional implementation manner, in the first aspect of the present invention, after detecting the development information of the engineering project corresponding to the user, the method further includes:
[0032] Determine whether the local integrated development environment version information of the user is consistent with the integrated development environment version information of the project, and when the local integrated development environment version information is inconsistent with the integrated development environment version information of the project, send a version difference reminder to the user; and / or,
[0033] Detect whether the user has installed a local static code analysis tool. When the user has not installed the local static code analysis tool, send a static code analysis tool installation reminder to the user according to the static code analysis tool version information of the engineering project.
[0034] A second aspect of the present invention discloses a device for checking development code, the device comprising:
[0035] A detection module is used to detect the development information of the engineering project corresponding to the user, wherein the development information includes engineering project information and version information, and the version information includes integrated development environment version information and static code analysis tool version information;
[0036] A determination module, used to determine the engineering specification requirement information corresponding to the engineering project according to the engineering project information;
[0037] An acquisition module, used for acquiring an integrated inspection tool matching the version information, performing tool specification configuration on the integrated inspection tool according to the engineering specification requirement information, and importing the configured integrated inspection tool into the engineering project;
[0038] A checking module, configured to perform a code standard check on the branch code submitted by the user in the engineering project based on the configured integrated checking tool, determine the error information corresponding to the branch code, and send a standard reminder to the user according to the error information;
[0039] A judgment module, configured to, when detecting a branch code submission operation triggered by the user, judge whether the branch code corresponding to the error information has been corrected, and when the branch code has not been corrected, interrupt the branch code submission operation, and send a standard reminder to the user according to the new error information;
[0040] A generation module is used to generate code submission confirmation information corresponding to the branch code submission operation when the branch code is revised, and to perform a submission specification review on the branch code submission operation based on the code submission confirmation information, and to merge the branch code corresponding to the branch code submission operation that has passed the review into the main branch code.
[0041] As an optional implementation, in the second aspect of the present invention, the inspection module performs a code specification inspection on the branch code submitted by the user in the engineering project based on the configured integrated inspection tool, and the method of determining the error information corresponding to the branch code specifically includes:
[0042] Determine, according to the engineering specification requirement information corresponding to the engineering project, a code specification checking rule corresponding to the engineering project, wherein the code specification checking rule includes at least one of a code format rule, a naming rule, and an annotation rule;
[0043] The branch code is compared with the code specification checking rule based on the configured integrated checking tool to determine error information corresponding to the branch code, where the error information includes code error location information.
[0044] As an optional implementation, in the second aspect of the present invention, the error information further includes code warning information and / or code error information;
[0045] The manner in which the checking module sends a standard reminder to the user according to the error information specifically includes:
[0046] Determine, according to the error information, an error information description and a preset solution example for the error information;
[0047] Generate solution suggestion information for the error message according to the error message description and the solution example;
[0048] Generate standard check reminder information corresponding to the branch code according to the error information and the solution suggestion information, and send a standard reminder to the user based on the standard check reminder information.
[0049] As an optional implementation, in the second aspect of the present invention, the code submission confirmation information includes identity confirmation information and code specification confirmation information;
[0050] The generation module performs submission specification review on the branch code submission operation based on the code submission confirmation information, and merges the branch code corresponding to the reviewed branch code submission operation into the main branch code in a manner that specifically includes:
[0051] Determine a code review process corresponding to the user, send the code submission confirmation information to the code review process, and determine through the code review process whether the user authority of the user satisfies the code submission authority corresponding to the branch code according to the identity confirmation information;
[0052] When the user's user rights satisfy the code submission rights corresponding to the branch code, the code review process is used to determine whether the code specification confirmation information satisfies the code submission specification conditions corresponding to the branch code. When the code specification confirmation information satisfies the code submission specification conditions corresponding to the branch code, the branch code corresponding to the branch code submission operation is merged into the main branch code.
[0053] As an optional implementation, in the second aspect of the present invention, the device further includes:
[0054] A push module is used to push the branch code to the version reviewer corresponding to the user through a preset review mechanism process when a version operation on the branch code triggered by the user is detected, and the version operation includes at least one of a version release operation, a version creation operation, a version merge operation and a version deletion operation; when the code review pass information sent by the version reviewer is received, the version operation is triggered to execute, and the version operation information and the code review pass information of the version operation are recorded.
[0055] As an optional implementation, in the second aspect of the present invention, the acquisition module is further used to acquire development specification information corresponding to the user based on a preset inspection condition, the development specification information includes error information, code submission information and version operation information corresponding to the user, and the inspection condition includes a time condition;
[0056] The device also includes:
[0057] An analysis module, used to analyze the development specification analysis data corresponding to the user according to the development specification information, wherein the development specification analysis data includes a code specification check pass rate, a code error resolution rate, a code submission pass rate, and a version operation pass rate;
[0058] The generation module is further used to analyze data according to the development specification corresponding to the user, and generate a development inspection report and a development specification score for the user.
[0059] As an optional implementation, in the second aspect of the present invention, the judgment module is further used to judge whether the local integrated development environment version information of the user is consistent with the integrated development environment version information of the engineering project after the detection module detects the development information of the engineering project corresponding to the user, and when the local integrated development environment version information is inconsistent with the integrated development environment version information of the engineering project, send a version difference reminder to the user; and / or,
[0060] The detection module is also used to detect whether the user has installed a local static code analysis tool. When the user has not installed the local static code analysis tool, a static code analysis tool installation reminder is sent to the user based on the static code analysis tool version information of the engineering project.
[0061] A third aspect of the present invention discloses another device for checking development code, the device comprising:
[0062] A memory storing executable program code;
[0063] a processor coupled to the memory;
[0064] The processor calls the executable program code stored in the memory to execute the method for checking development code disclosed in the first aspect of the present invention.
[0065] A fourth aspect of the present invention discloses a computer storage medium, wherein the computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the method for checking development codes disclosed in the first aspect of the present invention.
[0066] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0067] In an embodiment of the present invention, an integrated inspection tool is configured based on the development information of the engineering project, and the configured integrated inspection tool is imported into the engineering project. Based on the configured integrated inspection tool, a code standard inspection is performed on the branch code submitted by the user in the engineering project, the error information corresponding to the branch code is determined, and a standard reminder is sent to the user according to the error information. When a branch code submission operation triggered by the user is detected, the branch code submitted by the user is reviewed and then merged into the main branch code. It can be seen that the implementation of the present invention can improve the efficiency and accuracy of development code inspection, improve the consistency and standardization of the code during the project development process, thereby improving the readability of the code, facilitating code maintenance, improving project development efficiency, reducing errors in submitted code, improving code quality and stability, and thereby improving the quality control and management efficiency of the overall development process. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0069] Figure 1 It is a flowchart of a method for checking development codes disclosed in an embodiment of the present invention;
[0070] Figure 2 It is a flowchart of another method for checking development code disclosed in an embodiment of the present invention;
[0071] Figure 3 It is a structural schematic diagram of a device for checking development code disclosed in an embodiment of the present invention;
[0072] Figure 4 It is a structural schematic diagram of another device for checking development code disclosed in an embodiment of the present invention;
[0073] Figure 5 It is a structural schematic diagram of another device for checking development code disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0074] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0075] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or end including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or ends.
[0076] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0077] The present invention discloses a method and device for checking development codes, which can improve the efficiency and accuracy of checking development codes, improve the consistency and standardization of codes in the project development process, thereby improving the readability of codes, facilitating code maintenance, improving project development efficiency, reducing errors in submitted codes, improving code quality and stability, and thereby improving the quality control and management efficiency of the overall development process. The following are detailed descriptions.
[0078] Embodiment 1
[0079] See also Figure 1 , Figure 1 1 is a flow chart of a method for checking development code disclosed in an embodiment of the present invention. Figure 1 The method for checking development code described above can be applied to a device for checking development code, wherein the device for checking development code can include a private library for checking the code, and can also include an intelligent server or an intelligent platform, the private library can include a rule configuration file and a hook file, and the intelligent server includes a local server or a cloud server, which is not limited in the embodiment of the present invention. Figure 1 As shown, the method for checking the development code may include the following operations:
[0080] 101. Detect development information of the engineering project corresponding to the user, where the development information includes engineering project information and version information.
[0081] Development information includes project information and version information, wherein the project information may include the development environment information, development rule information, etc. of the project, and the version information may include the integrated development environment version information and the static code analysis tool version information, that is, the user's local IDE version and local lint version, which is not limited in the present invention.
[0082] In the embodiment of the present invention, optionally, after detecting the development information of the engineering project corresponding to the user, the method for checking the development code may further include the following operations:
[0083] Determine whether the user's local integrated development environment version information is consistent with the project's integrated development environment version information, and send a version difference reminder to the user when the local integrated development environment version information is inconsistent with the project's integrated development environment version information; and / or,
[0084] Detect whether the user has installed the local static code analysis tool. If the user has not installed the local static code analysis tool, send a static code analysis tool installation reminder to the user based on the static code analysis tool version information of the project.
[0085] Among them, after detecting the development information of the engineering project corresponding to the user, it can be determined whether the user's local IDE version is consistent with the version required by the engineering project. If not, the user is reminded to use a unified IDE version to guide the development environment to be consistent. In addition, it is detected whether the user has installed the lint tool locally. If not, the lint tool is installed with one click to make the version of each user's local lint tool consistent, which can improve the consistency of the user's development environment and code analysis tools with the engineering project, thereby improving the accuracy and efficiency of integrated detection tools for code detection and improving user development efficiency.
[0086] 102. Based on the project information, determine the engineering specification requirement information corresponding to the project.
[0087] In an embodiment of the present invention, optionally, the code specification requirements, development tool version requirements, development environment version requirements, etc. of different engineering projects may be the same or different. The engineering specification requirement information corresponding to the engineering project is determined based on the engineering project information, that is, the configuration of the private library is determined based on the engineering project information. The engineering specification requirement information may include code specification requirement information.
[0088] 103. Obtain an integrated inspection tool that matches the version information, configure the integrated inspection tool according to the engineering specification requirements, and import the configured integrated inspection tool into the engineering project.
[0089] In the embodiment of the present invention, optionally, the integrated inspection tool may include a private library tool, the integrated inspection tool is consistent with or matches the IDE version and the lint tool version of the engineering project, the integrated inspection tool is configured with tool specifications according to the engineering specification requirement information, that is, the corresponding rule file and git hook hook file are configured according to the engineering specification requirement information, and importing the configured integrated inspection tool into the engineering project may include:
[0090] Copy the corresponding rule file and git hook file to the .git / hook directory of the project (if the same file exists locally, overwrite it directly); copy the rule configuration file to the same directory as .git (if the same file exists, overwrite it directly); give the chmod command to the commit-msg and pre-commit file permissions; modify the project configuration file through the sed command, and trigger the lint test when adding the project compilation. Each swif file in the project will be tested. If there is a warning or error, a warning prompt or a failure prompt will be given; by configuring the git hook hook, when the R&D commits, the pre-commit hook will be triggered first to check whether the modified files have warnings or failures. If there are warnings or failures, the commit submission will be interrupted, and the R&D will be guided to process them one by one before they can pass; by configuring the git hook hook, when the R&D commits, if the inspection passes, it will continue to pass the commit-msg hook to check whether the submitted description meets the requirements. If not, the commit submission will be interrupted, and the R&D will be guided to fill in the description as required before it can pass.
[0091] 104. Perform code standard check on the branch code submitted by the user in the engineering project based on the configured integrated checking tool, determine the error information corresponding to the branch code, and send standard reminders to the user based on the error information.
[0092] In an embodiment of the present invention, optionally, during the process of writing branch code, the user can automatically perform a code standard check on the code by importing an integrated inspection tool configured in the engineering project, that is, a configured private library. The code standard check may include one or more of a code format check, a code naming check, and a code comment check, etc. The user can customize the rule content of the private library, customize the opening or disabling of the private library, and customize the timing and scope of the private library to perform a standard check on the code. Optionally, the rule configuration and version configuration of the private library imported by the user in the same engineering project can be the same, or private libraries with different rule configurations and version configurations can be imported according to different users and the special circumstances of the branch code corresponding to the user. Optionally, the user can modify the content of the private library and synchronize the modified content to the private library warehouse to ensure that the private library content pulled by each user is consistent, and can be introduced into the engineering project through cocoapods. Executing the pod install command will pull the content of the private library and automatically synchronize the configuration of the private library. The present invention does not limit this.
[0093] In an embodiment of the present invention, optionally, the error information corresponding to the branch code may include at least one code warning message and / or code error message, the error information may also include location information corresponding to the code warning message and / or code error message, the location information may include the corresponding file, the corresponding row and the corresponding column, the error information may further include the error triggering rule corresponding to the code warning message and / or code error message, the detailed description corresponding to the rule and the preset instance for solving the problem corresponding to the rule, such as one or more of variable definition rules, variable naming rules, function definition rules, etc. After determining the error information corresponding to the code, the user can be reminded of the code standard according to the error information to assist the user in modifying the code error, which is not limited by the present invention.
[0094] 105. When a branch code submission operation triggered by a user is detected, determine whether the branch code corresponding to the error information has been corrected. When the branch code has not been corrected, interrupt the branch code submission operation and send a standard reminder to the user according to the new error information.
[0095] In an embodiment of the present invention, optionally, a branch code submission operation triggered by a user may include a submission operation of submitting the code from the branch code corresponding to the user from a personal branch to the main branch. Optionally, a git hook in a private library may be configured. When a branch code submission operation for a branch code triggered by a user is detected, a check is triggered to check whether there is code warning information and / or code error information in the file submitted by the user, that is, a judgment is triggered as to whether the branch code corresponding to the error information is corrected. When the error information is not corrected, the code submission operation is interrupted, and a standard reminder is sent to the user based on the new error information. The present invention is not limited thereto.
[0096] 106. When the branch code is revised, code submission confirmation information corresponding to the branch code submission operation is generated, and the branch code submission operation is reviewed for submission specifications based on the code submission confirmation information, and the branch code corresponding to the branch code submission operation that has passed the review is merged into the main branch code.
[0097] In an embodiment of the present invention, optionally, when the error message is corrected, the commit-msg hook can continue to be used to check whether the description of the code submitted by the user meets the requirements. If not, the code submission operation is interrupted and the user is reminded to modify it. If it meets the requirements, code submission confirmation information corresponding to the code submission operation is generated, and the submission operation is subject to submission specification review based on the code submission confirmation information. The code submission confirmation information may include the identity confirmation information of the user who submitted the code and the code specification confirmation information of the submitted code. Optionally, the submission operation can be subject to submission specification review based on the system, or the code submission confirmation information can be sent to the reviewer or the leader in charge corresponding to the user, who will review it and submit the code corresponding to the submission operation that has passed the review to the main branch. For example, by automatically triggering the submission and merge monitoring notification mechanism, the changes of personal branches are reported to the team leader in real time in DingTalk, and the team leader will review and confirm it, so as to ensure that the user's code submission operation complies with the regulations and that the team leader can understand and manage branch activities in a timely manner.
[0098] It can be seen that implementation Figure 1 The described method for checking development code can detect the development information of the engineering project corresponding to the user, determine the engineering specification requirement information corresponding to the engineering project based on the engineering project information, obtain an integrated checking tool that matches the version information, perform tool specification configuration on the integrated checking tool based on the engineering specification requirement information, and import the configured integrated checking tool into the engineering project, which can ensure that users in the same engineering project use the same version of tools and environment, and configure the specification requirements that match the project, thereby improving the consistency and standardization of code styles and specifications in the same project, performing code specification checks on branch codes submitted by users in the engineering project based on the configured integrated checking tool, determining the error information corresponding to the branch code, and sending specification reminders to users based on the error information, which can improve the generation process during project development. The consistency and standardization of the code can improve the readability of the code, facilitate code maintenance, and improve project development efficiency. When a branch code submission operation triggered by a user is detected, it is determined whether the branch code corresponding to the error information has been corrected. When the branch code has not been corrected, the branch code submission operation is interrupted, and a standard reminder is sent to the user based on the new error information. When the branch code is corrected, the code submission confirmation information corresponding to the branch code submission operation is generated, and the branch code submission operation is reviewed based on the code submission confirmation information. The branch code corresponding to the branch code submission operation that has passed the review is merged into the main branch code, which can further reduce errors in submitted code, improve the efficiency and accuracy of development code inspection, improve code quality and stability, and thus improve the quality control and management efficiency of the overall development process.
[0099] In an optional embodiment, the code submission confirmation information includes identity confirmation information and code specification confirmation information;
[0100] Based on the code submission confirmation information, the branch code submission operation is reviewed and approved, and the branch code corresponding to the branch code submission operation is merged into the main branch code, including:
[0101] Determine the code review process corresponding to the user, send the code submission confirmation information to the code review process, and use the code review process to determine whether the user's user permissions meet the code submission permissions corresponding to the branch code based on the identity confirmation information;
[0102] When the user's user permissions meet the code submission permissions corresponding to the branch code, the code review process is used to determine whether the code specification confirmation information meets the code submission specification conditions corresponding to the branch code. When the code specification confirmation information meets the code submission specification conditions corresponding to the branch code, the branch code corresponding to the branch code submission operation is merged into the main branch code.
[0103] In this optional embodiment, optionally, the code submission confirmation information may include the identity confirmation information of the user who submitted the code and the code specification confirmation information of the submitted code. The code review process corresponding to the user may include the user triggering a branch code submission operation for the code and when the error information is corrected, the next review process for the branch code submission operation may specifically include a submission specification review of the branch code submission operation based on the system, or sending the code submission confirmation information to the reviewer or the person in charge corresponding to the user, and the person in charge will review it. First, the code review process is used to determine whether the user authority of the user meets the code submission authority corresponding to the branch code based on the identity confirmation information. When the user authority meets the code submission authority corresponding to the branch code, the code review process is used to determine whether the code specification confirmation information meets the code submission specification conditions corresponding to the branch code, that is, the system or the person in charge will review the code specification or content again. When the code specification confirmation information meets the code submission specification conditions corresponding to the branch code, the branch code corresponding to the submission operation is submitted from the personal branch to the main branch. This is not limited in this embodiment.
[0104] It can be seen that implementing this optional embodiment can determine the code review process corresponding to the user, send the code submission confirmation information to the code review process, and judge through the code review process whether the user's user rights meet the code submission rights corresponding to the branch code according to the identity confirmation information. When the user submits the code to the main branch, the user's rights can be verified, which reduces the situation where the code is maliciously submitted by others and improves code security. When the user's user rights meet the code submission rights corresponding to the branch code, the code review process is used to judge whether the code specification confirmation information meets the code submission specification conditions corresponding to the branch code. When the code specification confirmation information meets the code submission specification conditions corresponding to the branch code, the branch code corresponding to the submission operation is submitted from the personal branch to the main branch, which can further reduce errors in submitted code, improve code quality and stability, and thereby improve the quality control and management efficiency of the overall development process.
[0105] In another optional embodiment, the method for checking the development code may further include the following operations:
[0106] When a version operation on a branch code triggered by a user is detected, the branch code is pushed to the version reviewer corresponding to the user through a preset review mechanism process. The version operation includes at least one of a version release operation, a version creation operation, a version merge operation, and a version deletion operation;
[0107] When the code review pass information sent by the version reviewer is received, the version operation is triggered and the version operation information and code review pass information of the version operation are recorded.
[0108] In this optional embodiment, optionally, a strict management mechanism can be implemented on the Release operation through a private library to prohibit individuals from directly performing version operations on the code. When it is detected that a user performs a version operation on the code, the code is pushed to the version reviewer corresponding to the user through the review mechanism process. That is, when a version operation (Release operation) is detected, the code can be pushed to the version reviewer corresponding to the user through the PR process. The version reviewer may include one or more of a team leader, a project leader, a project supervisor, etc. The version operation includes at least one of a version release operation, a version creation operation, a version merge operation, and a version deletion operation, etc., which is not limited in this embodiment.
[0109] In this optional embodiment, optionally, when the version reviewer receives the code of the user's Release, the code can be reviewed, and a code review pass information is sent after the review is passed. When the code review pass information sent by the version reviewer is received, the version operation is triggered, and the version operation information and the code review pass information of the version operation are recorded. The version reviewer can send the code review pass information by clicking the OK button and performing identity authentication. The identity authentication method can include one or more combinations of password verification, face recognition verification, fingerprint verification, etc., which are not limited in this embodiment.
[0110] It can be seen that the implementation of this optional embodiment can push the branch code to the version reviewer corresponding to the user through the preset review mechanism process when a version operation on the branch code triggered by the user is detected. The version operation includes at least one of the version release operation, version creation operation, version merge operation and version deletion operation. When the code review pass information sent by the version reviewer is received, the version operation is triggered to be executed, and the version operation information and code review pass information of the version operation are recorded. This can prohibit individual users from directly performing version operations on the project, thereby improving the quality and stability of the project version release, and thereby improving the quality control and management efficiency of the overall development process.
[0111] In yet another optional embodiment, the method for checking the development code may further include the following operations:
[0112] Based on the preset inspection conditions, the development specification information corresponding to the user is obtained. The development specification information includes the error information, code submission information and version operation information corresponding to the user. The inspection conditions include time conditions.
[0113] Analyze the development specification analysis data corresponding to the user based on the development specification information. The development specification analysis data includes the code specification check pass rate, code error resolution rate, code submission pass rate, and version operation pass rate.
[0114] Analyze data based on the user's corresponding development specifications and generate a development inspection report and development specification score for the user.
[0115] In this optional embodiment, optionally, the preset inspection conditions may include time conditions, and may also include code submission amount conditions, user-triggered viewing conditions, etc., that is, the development specification information corresponding to the user may be obtained at every preset time interval or when the user's code submission amount reaches a certain threshold or the user triggers a view, and the development specification information includes the user's corresponding error information, code submission information, and version operation information. According to the development specification information, the development specification analysis data corresponding to the user is analyzed, and the development specification analysis data may include the code specification inspection pass rate, the code error resolution rate, the code submission pass rate, and the version operation pass rate, and may also include the number of code errors, the number of code submission failures, the code error type, and the proportion and number corresponding to each code error type, etc. According to the development specification analysis data corresponding to the user, a development inspection report and a development specification score for the user are generated, and the development inspection report may be sent to the user or the user's corresponding in-charge leader. The development specification score can be used to reflect the user's project development standardization level, which is not limited in this embodiment.
[0116] It can be seen that implementing this optional embodiment can obtain development specification information corresponding to the user based on preset inspection conditions. The development specification information includes error information, code submission information and version operation information corresponding to the user. The inspection conditions include time conditions. According to the development specification information, the development specification analysis data corresponding to the user is analyzed. The development specification analysis data includes the code specification inspection pass rate, code error resolution rate, code submission pass rate and version operation pass rate. According to the development specification analysis data corresponding to the user, a development inspection report and development specification score are generated for the user. The inspection report can be generated regularly or under fixed conditions for team members to view and refer to, so as to evaluate the development standardization level of team members, thereby helping team members to improve development standardization and development efficiency, and improve the quality control and management efficiency of the overall development process.
[0117] Embodiment 2
[0118] See also Figure 2 , Figure 2 1 is a flow chart of a method for checking development code disclosed in an embodiment of the present invention. Figure 2 The method for checking development code described above can be applied to a device for checking development code, wherein the device for checking development code can include a private library for checking the code, and can also include an intelligent server or an intelligent platform, the private library can include a rule configuration file and a hook file, and the intelligent server includes a local server or a cloud server, which is not limited in the embodiment of the present invention. Figure 2 As shown, the method for checking the development code may include the following operations:
[0119] 201. Detect development information of a project corresponding to a user, where the development information includes project information and version information.
[0120] 202. Determine the engineering specification requirement information corresponding to the engineering project based on the engineering project information.
[0121] 203. Obtain an integrated inspection tool that matches the version information, configure the integrated inspection tool according to the engineering specification requirements, and import the configured integrated inspection tool into the engineering project.
[0122] 204. Determine the code specification checking rules corresponding to the engineering project based on the engineering specification requirement information corresponding to the engineering project.
[0123] In an embodiment of the present invention, optionally, the code specification checking rules corresponding to the engineering project may include at least one of code format rules, naming rules and comment rules, which is not limited by the present invention.
[0124] 205. Based on the configured integrated inspection tool, the branch code is compared with the code standard inspection rules to determine the error information corresponding to the branch code, and a standard reminder is sent to the user according to the error information.
[0125] In the embodiment of the present invention, optionally, the code is compared with the branch code specification inspection rules based on the configured integrated inspection tool to determine the error information corresponding to the code. The implementation code is as follows:
[0126]
[0127]
[0128] The error information may include code error location information.
[0129] 206. When a branch code submission operation triggered by a user is detected, it is determined whether the branch code corresponding to the error information has been corrected. When the branch code has not been corrected, the branch code submission operation is interrupted, and a standard reminder is sent to the user according to the new error information.
[0130] 207. When the branch code is revised, code submission confirmation information corresponding to the branch code submission operation is generated, and the branch code submission operation is reviewed for submission specifications based on the code submission confirmation information, and the branch code corresponding to the branch code submission operation that has passed the review is merged into the main branch code.
[0131] In the embodiment of the present invention, for other descriptions of step 201 to step 203, step 206 and step 207, please refer to the detailed description of step 101 to step 103, step 105 and step 106 in embodiment 1, and the embodiment of the present invention will not be repeated here.
[0132] It can be seen that the implementation Figure 2 The described method for checking development code can detect the development information of the engineering project corresponding to the user, determine the engineering specification requirement information corresponding to the engineering project based on the engineering project information, obtain the integrated inspection tool that matches the version information, perform tool specification configuration on the integrated inspection tool based on the engineering specification requirement information, and import the configured integrated inspection tool into the engineering project, which can ensure that users in the same engineering project use the same version of tools and environment, and configure the specification requirements that match the project, thereby improving the consistency and standardization of code style and specifications in the same project, determining the code specification inspection rules corresponding to the engineering project based on the engineering specification requirement information corresponding to the engineering project, comparing the branch code with the code specification inspection rules based on the configured integrated inspection tool, determining the error information corresponding to the branch code, and sending specification reminders to the user based on the error information, which can perform specification inspection on the code based on the integrated inspection tool during the project development process. , and output error information to help users correct code errors. It can improve the accuracy of determining code errors, improve the consistency and standardization of codes during project development, and thus improve code readability, facilitate code maintenance, and improve project development efficiency. When a branch code submission operation triggered by a user is detected, it determines whether the branch code corresponding to the error information has been corrected. When the branch code has not been corrected, the branch code submission operation is interrupted, and a standard reminder is sent to the user based on the new error information. When the branch code is corrected, code submission confirmation information corresponding to the branch code submission operation is generated, and the branch code submission operation is reviewed based on the code submission confirmation information. The branch code corresponding to the approved branch code submission operation is merged into the main branch code, which can further reduce errors in submitted code, improve the efficiency and accuracy of development code inspection, improve code quality and stability, and thus improve the quality control and management efficiency of the overall development process.
[0133] In another optional embodiment, the error information further includes code warning information and / or code error information;
[0134] Send standard reminders to users based on error messages, including:
[0135] Determine, based on the error message, an error message description and a preset solution example for the error message;
[0136] Generate solution suggestions for error messages based on error message descriptions and solution examples;
[0137] Generate specification check reminder information corresponding to the branch code according to the error information and solution suggestion information, and send specification reminders to the user based on the specification check reminder information.
[0138] In this optional embodiment, optionally, the error information may also include code warning information and / or code error information, the error information may also include location information corresponding to the code warning information and / or code error information, the location information may include corresponding files, corresponding rows and corresponding columns, the error information may further include error triggering rules corresponding to the code warning information and / or code error information, and the error information description and preset solution examples for the error information are determined according to the error information. Specifically, the error information description and preset solution examples for the error information may be determined according to the error triggering rules corresponding to the code warning information and / or code error information, such as one or more of variable definition rules, variable naming rules, function definition rules, etc., which are not limited in this embodiment.
[0139] In this optional embodiment, optionally, solution suggestion information for the error message can be generated based on the error message description and solution example. The solution suggestion information may include a modification plan for the error message, or a web link related to the error message. Standard check reminder information corresponding to the code can be generated based on the error message and the solution suggestion information, and code standard reminders can be given to the user based on the standard check reminder information to assist the user in modifying the code error. This is not limited to this embodiment.
[0140] It can be seen that the implementation of this optional embodiment can determine the error message description and preset solution example for the error message according to the error message, generate solution suggestion information for the error message according to the error message description and the solution example, generate standard check reminder information corresponding to the code according to the error message and the solution suggestion information, and provide code standard reminders to the user based on the standard check reminder information. It can not only determine the error message, but also provide the user with error message descriptions, solution examples and solution suggestion information to assist the user in correcting code errors, improve the accuracy and efficiency of solving error information, thereby improving the overall project development efficiency, reducing the risk of introducing erroneous code, and thus improving code quality and stability.
[0141] Embodiment 3
[0142] See also Figure 3 , Figure 3 1 is a schematic diagram of a structure of a device for checking development code disclosed in an embodiment of the present invention. Figure 3The described apparatus for checking development code may include a private library for checking the code, and may also include an intelligent server or an intelligent platform. The private library may include a rule configuration file and a hook file. The intelligent server may include a local server or a cloud server, which is not limited in the embodiment of the present invention. Figure 3 As shown, the device for checking the development code may include:
[0143] The detection module 301 is used to detect the development information of the engineering project corresponding to the user, the development information includes engineering project information and version information, and the version information includes integrated development environment version information and static code analysis tool version information;
[0144] A determination module 302 is used to determine the engineering specification requirement information corresponding to the engineering project according to the engineering project information;
[0145] The acquisition module 303 is used to acquire an integrated inspection tool that matches the version information, configure the integrated inspection tool according to the engineering specification requirement information, and import the configured integrated inspection tool into the engineering project;
[0146] The checking module 304 is used to perform a code standard check on the branch code submitted by the user in the engineering project based on the configured integrated checking tool, determine the error information corresponding to the branch code, and send a standard reminder to the user according to the error information;
[0147] The judgment module 305 is used to judge whether the branch code corresponding to the error information has been corrected when a branch code submission operation triggered by the user is detected. If the branch code has not been corrected, the branch code submission operation is interrupted and a standard reminder is sent to the user according to the new error information;
[0148] The generation module 306 is used to generate code submission confirmation information corresponding to the branch code submission operation when the branch code is revised, and to perform submission specification review on the branch code submission operation based on the code submission confirmation information, and merge the branch code corresponding to the branch code submission operation that has passed the review into the main branch code.
[0149] It can be seen that the implementation Figure 3The described device for checking development code can detect the development information of the engineering project corresponding to the user, determine the engineering specification requirement information corresponding to the engineering project based on the engineering project information, obtain the integrated checking tool that matches the version information, perform tool specification configuration on the integrated checking tool based on the engineering specification requirement information, and import the configured integrated checking tool into the engineering project, which can ensure that users in the same engineering project use the same version of tools and environment, and configure the specification requirements that match the project, thereby improving the consistency and standardization of code styles and specifications in the same project, performing code specification checks on branch codes submitted by users in the engineering project based on the configured integrated checking tool, determining the error information corresponding to the branch code, and sending specification reminders to users based on the error information, which can improve the generation efficiency during project development. The consistency and standardization of the code can improve the readability of the code, facilitate code maintenance, and improve project development efficiency. When a branch code submission operation triggered by a user is detected, it is determined whether the branch code corresponding to the error information has been corrected. When the branch code has not been corrected, the branch code submission operation is interrupted, and a standard reminder is sent to the user based on the new error information. When the branch code is corrected, the code submission confirmation information corresponding to the branch code submission operation is generated, and the branch code submission operation is reviewed based on the code submission confirmation information. The branch code corresponding to the branch code submission operation that has passed the review is merged into the main branch code, which can further reduce errors in submitted code, improve the efficiency and accuracy of development code inspection, improve code quality and stability, and thus improve the quality control and management efficiency of the overall development process.
[0150] In an optional embodiment, if Figure 4 As shown, the checking module 304 performs code standard checking on the branch code submitted by the user in the engineering project based on the configured integrated checking tool, and the specific method of determining the error information corresponding to the branch code includes:
[0151] Determine the code specification checking rules corresponding to the engineering project according to the engineering specification requirement information corresponding to the engineering project, wherein the code specification checking rules include at least one of code format rules, naming rules and comment rules;
[0152] Based on the configured integrated inspection tool, the branch code is compared with the code specification inspection rules to determine the error information corresponding to the branch code, and the error information includes the code error location information.
[0153] It can be seen that the implementation Figure 4The described device for checking development code can detect the development information of the engineering project corresponding to the user, determine the engineering specification requirement information corresponding to the engineering project based on the engineering project information, obtain the integrated inspection tool that matches the version information, configure the tool specification of the integrated inspection tool based on the engineering specification requirement information, and import the configured integrated inspection tool into the engineering project, which can ensure that users in the same engineering project use the same version of tools and environments, and configure the specification requirements that match the project, thereby improving the consistency and standardization of code styles and specifications in the same project, determining the code specification inspection rules corresponding to the engineering project based on the engineering specification requirement information corresponding to the engineering project, comparing the branch code with the code specification inspection rules based on the configured integrated inspection tool, determining the error information corresponding to the branch code, and sending a specification reminder to the user based on the error information, which can perform a specification inspection on the code based on the integrated inspection tool during the project development process. , and output error information to help users correct code errors. It can improve the accuracy of determining code errors, improve the consistency and standardization of codes during project development, and thus improve code readability, facilitate code maintenance, and improve project development efficiency. When a branch code submission operation triggered by a user is detected, it determines whether the branch code corresponding to the error information has been corrected. When the branch code has not been corrected, the branch code submission operation is interrupted, and a standard reminder is sent to the user based on the new error information. When the branch code is corrected, code submission confirmation information corresponding to the branch code submission operation is generated, and the branch code submission operation is reviewed based on the code submission confirmation information. The branch code corresponding to the approved branch code submission operation is merged into the main branch code, which can further reduce errors in submitted code, improve the efficiency and accuracy of development code inspection, improve code quality and stability, and thus improve the quality control and management efficiency of the overall development process.
[0154] In another optional embodiment, Figure 4 As shown, the error information also includes code warning information and / or code error information;
[0155] The specific manner in which the checking module 304 sends a standard reminder to the user according to the error information includes:
[0156] Determine, based on the error message, an error message description and a preset solution example for the error message;
[0157] Generate solution suggestions for error messages based on error message descriptions and solution examples;
[0158] Generate specification check reminder information corresponding to the branch code according to the error information and solution suggestion information, and send specification reminders to the user based on the specification check reminder information.
[0159] It can be seen that the implementation Figure 4 The described device for checking development code can determine the error message description and preset solution example for the error message based on the error message, generate solution suggestion information for the error message based on the error message description and the solution example, generate standard check reminder information corresponding to the code based on the error message and the solution suggestion information, and provide code standard reminders to the user based on the standard check reminder information. It can not only determine the error message, but also provide the user with error message description, solution example and solution suggestion information to assist the user in correcting code errors, improve the accuracy and efficiency of solving error information, thereby improving the overall development efficiency of the project, reducing the risk of introducing erroneous code, and thus improving code quality and stability.
[0160] In yet another optional embodiment, Figure 4 As shown, the code submission confirmation information includes identity confirmation information and code specification confirmation information;
[0161] The generation module 306 performs submission specification review on the branch code submission operation based on the code submission confirmation information, and merges the branch code corresponding to the approved branch code submission operation into the main branch code. The specific method includes:
[0162] Determine the code review process corresponding to the user, send the code submission confirmation information to the code review process, and use the code review process to determine whether the user's user permissions meet the code submission permissions corresponding to the branch code based on the identity confirmation information;
[0163] When the user's user permissions meet the code submission permissions corresponding to the branch code, the code review process is used to determine whether the code specification confirmation information meets the code submission specification conditions corresponding to the branch code. When the code specification confirmation information meets the code submission specification conditions corresponding to the branch code, the branch code corresponding to the branch code submission operation is merged into the main branch code.
[0164] It can be seen that the implementation Figure 4The described device for checking development code can determine the code review process corresponding to the user, send the code submission confirmation information to the code review process, and judge whether the user authority of the user satisfies the code submission authority corresponding to the branch code according to the identity confirmation information through the code review process. When the user submits the code to the main branch, the user's authority can be verified, which reduces the situation where the code is maliciously submitted by others and improves the code security. When the user's user authority satisfies the code submission authority corresponding to the branch code, the code review process is used to judge whether the code specification confirmation information satisfies the code submission specification conditions corresponding to the branch code. When the code specification confirmation information satisfies the code submission specification conditions corresponding to the branch code, the branch code corresponding to the submission operation is submitted from the personal branch to the main branch, which can further reduce the errors in submitted code, improve the code quality and stability, and thus improve the quality control and management efficiency of the overall development process.
[0165] In yet another optional embodiment, Figure 4 As shown, the device for checking the development code may also include:
[0166] The push module 307 is used to push the branch code to the version reviewer corresponding to the user through a preset review mechanism process when a version operation on the branch code triggered by the user is detected. The version operation includes at least one of a version release operation, a version creation operation, a version merge operation and a version deletion operation; when the code review pass information sent by the version reviewer is received, the version operation is triggered to execute, and the version operation information and code review pass information of the version operation are recorded.
[0167] It can be seen that the implementation Figure 4 The described device for checking development code can, when a version operation on a branch code triggered by a user is detected, push the branch code to the version reviewer corresponding to the user through a preset review mechanism process. The version operation includes at least one of a version release operation, a version creation operation, a version merge operation, and a version deletion operation. When the code review pass information sent by the version reviewer is received, the version operation is triggered to be executed, and the version operation information and code review pass information of the version operation are recorded. This can prohibit individual users from directly performing version operations on the project, thereby improving the quality and stability of the project version release, and thereby improving the quality control and management efficiency of the overall development process.
[0168] In yet another optional embodiment, Figure 4 As shown, the acquisition module 303 is further used to acquire the development specification information corresponding to the user based on the preset inspection conditions, the development specification information includes the error information, code submission information and version operation information corresponding to the user, and the inspection conditions include time conditions;
[0169] The device for checking the development code may also include:
[0170] The analysis module 308 is used to analyze the development specification analysis data corresponding to the user according to the development specification information, and the development specification analysis data includes the code specification check pass rate, the code error resolution rate, the code submission pass rate and the version operation pass rate;
[0171] The generation module 306 is further used to analyze the data according to the development specification corresponding to the user, and generate a development inspection report and a development specification score for the user.
[0172] It can be seen that the implementation Figure 4 The described device for checking development code can obtain development specification information corresponding to the user based on preset inspection conditions. The development specification information includes error information, code submission information and version operation information corresponding to the user. The inspection conditions include time conditions. According to the development specification information, the development specification analysis data corresponding to the user is analyzed. The development specification analysis data includes the code specification inspection pass rate, code error resolution rate, code submission pass rate and version operation pass rate. According to the development specification analysis data corresponding to the user, a development inspection report and development specification score are generated for the user. The inspection report can be generated regularly or under fixed conditions for team members to view and refer to, so as to evaluate the development standardization level of team members, thereby helping team members to improve development standardization and development efficiency, and improve the quality control and management efficiency of the overall development process.
[0173] In yet another optional embodiment, Figure 4 As shown, the judgment module is further used to judge whether the local integrated development environment version information of the user is consistent with the integrated development environment version information of the project after the detection module detects the development information of the project corresponding to the user, and when the local integrated development environment version information is inconsistent with the integrated development environment version information of the project, send a version difference reminder to the user; and / or,
[0174] The detection module is also used to detect whether the user has installed the local static code analysis tool. When the user has not installed the local static code analysis tool, a static code analysis tool installation reminder is sent to the user based on the static code analysis tool version information of the project.
[0175] It can be seen that the implementation Figure 4 The described device for checking development code can improve the consistency between the user's development environment and code analysis tools and engineering projects, thereby improving the accuracy and efficiency of code detection by integrated detection tools and improving user development efficiency.
[0176] Embodiment 4
[0177] See also Figure 5 , Figure 5FIG. 1 is a schematic diagram of another device for checking development code disclosed in an embodiment of the present invention. Figure 5 As shown, the device for checking the development code may include:
[0178] A memory 401 storing executable program codes;
[0179] a processor 402 coupled to the memory 401;
[0180] The processor 402 calls the executable program code stored in the memory 401 to execute the steps of the method for checking the development code described in the first embodiment of the present invention or the second embodiment of the present invention.
[0181] Embodiment 5
[0182] An embodiment of the present invention discloses a computer storage medium storing computer instructions. When the computer instructions are called, they are used to execute the steps of the method for checking development codes described in the first embodiment or the second embodiment of the present invention.
[0183] Embodiment 6
[0184] An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable a computer to execute the steps of the method for checking development code described in the first or second embodiment.
[0185] The device embodiments described above are only illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, i.e., they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.
[0186] Through the specific description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solution can be essentially or partly contributed to the prior art in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0187] Finally, it should be noted that the method and device for checking development codes disclosed in the embodiments of the present invention are only preferred embodiments of the present invention, and are only used to illustrate the technical solution of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for checking development code, characterized in that: The method comprises: Detecting development information of a project corresponding to a user, wherein the development information includes project information and version information, and the version information includes integrated development environment version information and static code analysis tool version information; Determine engineering specification requirement information corresponding to the engineering project according to the engineering project information; Acquire an integrated inspection tool that matches the version information, configure the integrated inspection tool according to the engineering specification requirement information, and import the configured integrated inspection tool into the engineering project; Performing a code standard check on the branch code submitted by the user in the engineering project based on the configured integrated check tool, determining error information corresponding to the branch code, and sending a standard reminder to the user according to the error information; When detecting the branch code submission operation triggered by the user, determining whether the branch code corresponding to the error information has been corrected, and when the branch code has not been corrected, interrupting the branch code submission operation, and sending a standard reminder to the user according to the new error information; When the branch code is revised, code submission confirmation information corresponding to the branch code submission operation is generated, and the branch code submission operation is reviewed for submission specifications based on the code submission confirmation information, and the branch code corresponding to the branch code submission operation that has passed the review is merged into the main branch code.
2. The method for checking development code according to claim 1, characterized in that: The step of performing a code specification check on the branch code submitted by the user in the engineering project based on the configured integrated checking tool to determine error information corresponding to the branch code includes: Determine, according to the engineering specification requirement information corresponding to the engineering project, a code specification checking rule corresponding to the engineering project, wherein the code specification checking rule includes at least one of a code format rule, a naming rule, and an annotation rule; The branch code is compared with the code specification checking rule based on the configured integrated checking tool to determine error information corresponding to the branch code, where the error information includes code error location information.
3. The method for checking development code according to claim 2, characterized in that: The error information also includes code warning information and / or code error information; The sending a standard reminder to the user according to the error information includes: Determine, according to the error information, an error information description and a preset solution example for the error information; Generate solution suggestion information for the error message according to the error message description and the solution example; Generate standard check reminder information corresponding to the branch code according to the error information and the solution suggestion information, and send a standard reminder to the user based on the standard check reminder information.
4. The method for checking development code according to any one of claims 1 to 3, characterized in that: The code submission confirmation information includes identity confirmation information and code specification confirmation information; The step of performing a submission specification review on the branch code submission operation based on the code submission confirmation information, and merging the branch code corresponding to the branch code submission operation that has passed the review into the main branch code includes: Determine a code review process corresponding to the user, send the code submission confirmation information to the code review process, and determine through the code review process whether the user authority of the user satisfies the code submission authority corresponding to the branch code according to the identity confirmation information; When the user's user rights satisfy the code submission rights corresponding to the branch code, the code review process is used to determine whether the code specification confirmation information satisfies the code submission specification conditions corresponding to the branch code. When the code specification confirmation information satisfies the code submission specification conditions corresponding to the branch code, the branch code corresponding to the branch code submission operation is merged into the main branch code.
5. The method for checking development code according to any one of claims 1 to 3, characterized in that: The method further comprises: When a version operation on the branch code triggered by the user is detected, the branch code is pushed to the version reviewer corresponding to the user through a preset review mechanism process, and the version operation includes at least one of a version publishing operation, a version creation operation, a version merging operation, and a version deletion operation; When the code review pass information sent by the version reviewer is received, the version operation is triggered to be executed, and the version operation information of the version operation and the code review pass information are recorded.
6. The method for checking development code according to any one of claims 1 to 3, characterized in that: The method further comprises: Acquire development specification information corresponding to the user based on preset inspection conditions, the development specification information including error information, code submission information, and version operation information corresponding to the user, and the inspection conditions including time conditions; Analyzing the development specification analysis data corresponding to the user according to the development specification information, the development specification analysis data including the code specification check pass rate, the code error resolution rate, the code submission pass rate, and the version operation pass rate; The data is analyzed according to the development specification corresponding to the user, and a development inspection report and a development specification score for the user are generated.
7. The method for checking development code according to any one of claims 1 to 3, characterized in that: After detecting the development information of the engineering project corresponding to the user, the method further includes: Determine whether the local integrated development environment version information of the user is consistent with the integrated development environment version information of the project, and when the local integrated development environment version information is inconsistent with the integrated development environment version information of the project, send a version difference reminder to the user; and / or, Detect whether the user has installed a local static code analysis tool. When the user has not installed the local static code analysis tool, send a static code analysis tool installation reminder to the user according to the static code analysis tool version information of the engineering project.
8. A device for checking development code, characterized in that: The device comprises: A detection module, used to detect the development information of the engineering project corresponding to the user, wherein the development information includes engineering project information and version information, and the version information includes integrated development environment version information and static code analysis tool version information; A determination module, used to determine the engineering specification requirement information corresponding to the engineering project according to the engineering project information; An acquisition module, used for acquiring an integrated inspection tool matching the version information, configuring the integrated inspection tool according to the engineering specification requirement information, and importing the configured integrated inspection tool into the engineering project; A checking module, configured to perform a code standard check on the branch code submitted by the user in the engineering project based on the configured integrated checking tool, determine the error information corresponding to the branch code, and send a standard reminder to the user according to the error information; A judgment module, configured to, when detecting a branch code submission operation triggered by the user, judge whether the branch code corresponding to the error information has been corrected, and when the branch code has not been corrected, interrupt the branch code submission operation, and send a standard reminder to the user according to the new error information; A generation module is used to generate code submission confirmation information corresponding to the branch code submission operation when the branch code is revised, and to perform a submission specification review on the branch code submission operation based on the code submission confirmation information, and merge the branch code corresponding to the branch code submission operation that has passed the review into the main branch code.
9. A device for checking development code, characterized in that: The device comprises: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the method for checking development code according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the method for checking development code according to any one of claims 1 to 7.