Analysis method and device for code research and development, storage medium and computer equipment
Through automated analysis methods for code research and development, including performance evaluation and report generation when submitting code branches, the problems of low validity and poor timeliness of analysis results in the existing technology are solved, and more efficient and reliable code research and development analysis is achieved, improving R&D efficiency and quality.
Patent Information
- Application Number
- CN202411747845.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, the analysis of code development mainly relies on simple data summary, resulting in less effective information on the analysis results. Since the analysis is usually carried out after a failure or at the end of the quarter, it affects the timeliness of problem discovery, resulting in difficulty in improving R&D efficiency and quality.
Provide an analysis method for code development, including detecting that when the code branch is submitted to the version management platform, obtaining the code branch, determining the number and number of code submissions, extracting the requirement mark, conducting R&D performance evaluation, generating code R&D reports, and pushing it to the project team.
Through multi-dimensional analysis of code development, quantify the workload of R&D personnel, improve the reliability of analysis results, and automatically execute the analysis process when code submission, timely discover R&D problems, improve the efficiency and timeliness of code analysis, thereby improving R&D efficiency and quality.
Smart Images

Figure CN119597620A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data analysis technology, and in particular to an analysis method, device, storage medium and computer equipment for code development. Background Art
[0002] With the significant shortening of software development cycles and the increase in the frequency of version iterations, project code development has become large-scale and involves the collaborative work of multiple members. In this context, it is particularly important to gain insights into multi-dimensional work data such as code quality and code efficiency and seek ways to improve efficiency. At present, the analysis of code development mainly relies on the formulation of development specifications, and then uses data statistics to obtain relevant data results after a failure occurs or at the end of a quarter, and then conducts intervention and intervention operations based on this.
[0003] However, in the process of analyzing code development, since it is just a simple summary of various data, the results of the analysis contain less effective information, and the analysis after the failure occurs or at the end of the quarter will also affect the timeliness of finding problems. As a result, it is difficult to improve the R&D efficiency and quality during the project development process. Summary of the invention
[0004] The purpose of this application is to solve at least one of the above technical defects, especially the technical defects that the existing technology only simply summarizes various types of data, the analysis results have less effective information, and the analysis after the failure occurs or at the end of the quarter will also affect the timeliness of finding problems. As a result, it is difficult to improve the R&D efficiency and quality during the project development process.
[0005] In a first aspect, the present application provides an analysis method for code development, the method comprising:
[0006] When it is detected that a code branch is submitted to a preset version management platform, the code branch is obtained, and the amount of submitted code and the number of submissions corresponding to the code branch are determined;
[0007] Extracting the requirement identifier in the code branch, and determining corresponding requirement information in a preset requirement database according to the requirement identifier;
[0008] Performing R&D performance evaluation on the code branch according to the demand information to obtain code performance data;
[0009] Generate a code development report according to the submitted code amount, the submission times and the code performance data;
[0010] Determine the project team to which the submitter of the code branch belongs, and push the code development report to the corresponding group of the project team.
[0011] In one embodiment, the performing R&D performance evaluation on the code branch according to the demand information to obtain code performance data includes:
[0012] Determining, in the code branch, a target code that supports a requirement corresponding to the requirement information;
[0013] Using a preset code evaluation model to perform quality evaluation on the target code to obtain a quality score of the target code;
[0014] Determine, in the version management platform, the code before and after the modification of the target code submitted this time;
[0015] Calculating a code equivalent of the target code according to the code before modification and the code after modification;
[0016] Code performance data is generated based on the quality score and the code equivalence.
[0017] In one embodiment, the calculating the code equivalent of the target code according to the pre-modification code and the post-modification code includes:
[0018] Respectively parsing the pre-modification code and the post-modification code into syntax tree structures to obtain a first syntax tree corresponding to the pre-modification code and a second syntax tree corresponding to the post-modification code;
[0019] Performing a difference comparison between the first syntax tree and the second syntax tree to determine, in the second syntax tree, target nodes that are different from the first syntax tree in the difference comparison and the node type and edit type of each target node;
[0020] Calculate the change value of each target node according to the node type and edit type of each target node;
[0021] Determine the sum of the change values of each target node as the initial code equivalent of the target code;
[0022] Identify whether there are target nodes with invalid modification operations in each target node. If so, adjust the initial code equivalent according to the target nodes with invalid modification operations in each target node, and determine the adjusted initial code equivalent as the code equivalent of the target code; if not, determine the initial code equivalent as the code equivalent of the target code.
[0023] In one embodiment, before determining the project team to which the submitter of the code branch belongs and pushing the code development report to the corresponding group of the project team, the method further includes:
[0024] Determine the modified code submitted this time according to the code branch;
[0025] Extracting comment information from the modified code and inputting the comment information into the target model to obtain a check result corresponding to the code branch;
[0026] The inspection result is merged into the code development report, and the merged code development report is used as the code development report that is finally pushed to the group corresponding to the project team.
[0027] In one embodiment, determining the amount of submitted code and the number of submissions corresponding to the code branch includes:
[0028] Searching for the editing analysis record corresponding to the code branch in the version management platform;
[0029] Determine the number of code lines modified by the code branch during this submission according to the editing analysis record, and determine the number of code lines modified as the submitted code amount corresponding to the code branch;
[0030] The number of times the code branch is submitted to the version management platform is counted according to the editing analysis record, and the number is determined as the number of submissions corresponding to the code branch.
[0031] In one embodiment, extracting the requirement identifier in the code branch and determining corresponding requirement information in a preset requirement database according to the requirement identifier includes:
[0032] Searching for a requirement identifier in the submission specification of the code branch, and extracting the found requirement identifier;
[0033] A preset demand database is determined, and demand information corresponding to the demand identifier is searched in the demand database.
[0034] In one embodiment, the method further comprises:
[0035] Determine an analysis duration, and determine a current analysis time period based on the analysis duration;
[0036] The code development reports generated within the analysis period are summarized to obtain development statistics within the analysis period.
[0037] In a second aspect, the present application provides an analysis device for code development, the device comprising:
[0038] A code acquisition module is used to acquire the code branch when it is detected that a code branch is submitted to a preset version management platform, and determine the amount of submitted code and the number of submissions corresponding to the code branch;
[0039] A requirement determination module, used to extract the requirement identifier in the code branch, and determine the corresponding requirement information in a preset requirement database according to the requirement identifier;
[0040] An efficiency evaluation module, used to perform R&D efficiency evaluation on the code branch according to the demand information to obtain code efficiency data;
[0041] A report generation module, used to generate a code development report according to the submitted code amount, the submission times and the code performance data;
[0042] The report push module is used to determine the project team to which the submitter of the code branch belongs, and push the code development report to the corresponding group of the project team.
[0043] In a third aspect, the present application provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the analysis method for code development as described in any of the above embodiments.
[0044] In a fourth aspect, the present application provides a computer device, comprising: one or more processors, and a memory;
[0045] The memory stores computer-readable instructions, and when the one or more processors execute the computer-readable instructions, the steps of the analysis method developed for the code as described in any of the above embodiments are performed.
[0046] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0047] The present application provides an analysis method, device, storage medium and computer equipment for code development. The method includes: when it is detected that a code branch is submitted to a preset version management platform, the code branch is obtained and its corresponding submitted code amount and submission number are determined, then the requirement identifier in the code branch is extracted to determine the corresponding requirement information in a preset requirement database according to the requirement identifier, and then the code branch is evaluated for development efficiency according to the requirement information to obtain code efficiency data, so as to generate a code development report in combination with the submission information such as the submitted code amount and submission number, and finally the project team to which the submitter belongs is determined, and the code development report is pushed to the corresponding group of the project team. By determining the submission information such as the amount of code submitted and the number of submissions of the code branch, the R&D efficiency of the code branch can be evaluated based on the demand information. The obtained code efficiency data can measure the code update status and demand support status of the code branch. Finally, the code efficiency data and submission information are combined to generate a code R&D report. This not only can quantify the actual workload of R&D personnel from multiple angles and improve the reliability of the analysis results, but also can automatically execute the above process when a code submission is detected, timely discover problems in the R&D process, improve the efficiency and timeliness of code analysis, and thus improve the R&D efficiency and quality during the project development process. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0049] Figure 1 A flowchart of an analysis method for code development provided in an embodiment of the present application;
[0050] Figure 2 A schematic diagram of a process for evaluating the R&D efficiency of code branches according to demand information provided in an embodiment of the present application;
[0051] Figure 3 A schematic diagram of a flow chart of calculating a code equivalent of a target code according to a pre-modification code and a post-modification code provided in an embodiment of the present application;
[0052] Figure 4 A schematic diagram of the structure of an analysis device for code development provided in an embodiment of the present application;
[0053] Figure 5 An internal structure diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0055] In one embodiment, the present application provides an analysis method for code development, and the following embodiment is described by applying the method to a server. It can be understood that the analysis method for code development can be performed by a single server or a server cluster composed of multiple servers, and the present application does not make specific restrictions on this.
[0056] like Figure 1 As shown, the present application provides an analysis method for code development, the method comprising:
[0057] S101: When it is detected that a code branch is submitted to a preset version management platform, the code branch is obtained, and the amount of submitted code and the number of submissions corresponding to the code branch are determined.
[0058] Among them, the version management platform is a tool platform used to manage the information related to each version in the software development process. It is mainly used to coordinate the work of the software development team to ensure that the version control, release management and configuration management of the software project can be carried out in an orderly and efficient manner. Code branch refers to the code corresponding to the independent code development line derived from a basic code version (such as the main branch). The code submission volume refers to the number of lines of code modification, and the number of submissions refers to the number of times the corresponding code branch is submitted to the version management platform.
[0059] In this step, the server can detect the version management platform. When it is detected that a code branch is submitted to the version management platform, the server obtains the code branch and counts the amount of submitted code and the number of submissions corresponding to the code branch.
[0060] Specifically, the server can obtain the submission data of the code branch from the version management platform, and then count the amount of submitted code and the number of submissions corresponding to the code branch based on the submission data.
[0061] Furthermore, when the server detects the version management platform, it can use a plug-in with corresponding functions to detect it, or it can use WebHook to realize the detection of the version management platform. This application does not make specific restrictions on this.
[0062] In one example, the version management platform may be a git-based management platform, such as github, gitee, and the like.
[0063] S102: extracting the requirement identifier in the code branch, and determining corresponding requirement information in a preset requirement database according to the requirement identifier.
[0064] The requirement identifier is used to identify the requirement information. The requirement database can be used to store the requirement information of the software development project. The requirement information refers to a detailed description of the functions, features and other related expectations that the project should have.
[0065] In this step, when a code branch is obtained, characters at specific positions in the code branch can be extracted based on preset rules to obtain a requirement identifier, and the requirement information corresponding to the requirement identifier can be searched in the requirement database through the requirement identifier.
[0066] For example, assuming that the standard format of the code submission specification is: “%”+“requirement ID”+“ ”+“comment”, the prefix of the code submission specification can be filtered to obtain the requirement ID, and the requirement ID is determined as the requirement identifier.
[0067] S103: Evaluate the R&D efficiency of the code branch according to the demand information to obtain code efficiency data.
[0068] In this step, based on the demand information, the code branch's support for the demand information and the development progress and efficiency of the code supported by the demand information can be evaluated, and the obtained data can be aggregated and combined to determine the code efficiency data. Based on this, the obtained code efficiency data can be used to measure the code update status and demand support status of the code branch.
[0069] S104: Generate a code development report based on the amount of submitted code, the number of submissions, and the code performance data.
[0070] In this step, after determining the amount of submitted code, the number of submissions, and the code performance data, a preset report template can be obtained, and the report template can be filled in based on the amount of submitted code, the number of submissions, and the code performance data to obtain a code development report.
[0071] 105: Determine the project team to which the submitter of the code branch belongs, and push the code development report to the corresponding group of the project team.
[0072] In this step, when the code development report is generated, the project team of the submitter of the code branch can be determined according to the preset personnel allocation table, and then the code development report can be automatically pushed through WebHook. In addition, when pushing the code development report, the corresponding submitter can be notified in a targeted manner through the connection with the enterprise WeChat protocol. In this way, the project team and the corresponding submitter can be notified of the development situation in a timely manner.
[0073] In this embodiment, by connecting the demand database and the version management platform, on the one hand, demand information can be obtained based on the demand database, and then the code efficiency of the code branch can be evaluated. On the other hand, basic information submitted can be determined based on the version management platform, such as the amount of code submissions and the number of submissions. Combining these two aspects of information to generate a code development report, the code development situation can be analyzed from multiple dimensions and pushed to the corresponding R&D team group.
[0074] The present application provides an analysis method, device, storage medium and computer equipment for code development. The method includes: when it is detected that a code branch is submitted to a preset version management platform, the code branch is obtained and its corresponding submitted code amount and submission number are determined, then the requirement identifier in the code branch is extracted to determine the corresponding requirement information in a preset requirement database according to the requirement identifier, and then the code branch is evaluated for development efficiency according to the requirement information to obtain code efficiency data, so as to generate a code development report in combination with the submission information such as the submitted code amount and submission number, and finally the project team to which the submitter belongs is determined, and the code development report is pushed to the corresponding group of the project team. By determining the submission information such as the amount of code submitted and the number of submissions of the code branch, the R&D efficiency of the code branch can be evaluated based on the demand information. The obtained code efficiency data can measure the code update status and demand support status of the code branch. Finally, the code efficiency data and submission information are combined to generate a code R&D report. This not only can quantify the actual workload of R&D personnel from multiple angles and improve the reliability of the analysis results, but also can automatically execute the above process when a code submission is detected, timely discover problems in the R&D process, improve the efficiency and timeliness of code analysis, and thus improve the R&D efficiency and quality during the project development process.
[0075] like Figure 2 As shown, in one embodiment, the code branch is evaluated for R&D efficiency according to the demand information to obtain code efficiency data, including:
[0076] S201: Determine, in a code branch, a target code that supports a requirement corresponding to the requirement information.
[0077] Specifically, the requirements in the requirement information can be understood as a function to be implemented. In this step, the target code supporting the requirements in the requirement information can be extracted by analyzing the code branches, so that the requirement support situation and requirement progress can be analyzed based on the target code.
[0078] S202: Using a preset code evaluation model to perform quality evaluation on the target code to obtain a quality score of the target code.
[0079] Among them, the quality score is used to measure the overall quality of the target code.
[0080] In this step, the pre-trained code evaluation model is used to deeply extract the characteristic information of the target code in multiple dimensions. This includes but is not limited to the structural characteristics of the code, such as the organizational structure of functions and modules, the nesting depth of the code, etc.; the grammatical characteristics of the code, such as the standardization of statements, the compliance with the naming rules of variables, etc.; and the logical characteristics of the code, such as the rationality of the algorithm, the correctness of data processing, etc. Then, the code quality of the target code is evaluated based on these characteristic information to output the quality score of the target code.
[0081] Specifically, the code evaluation model of the present application can be obtained by using a code sample set as a training sample, using the quality score corresponding to the training sample as a sample label, and using a loss function to train a preset pre-trained model. During the training process, the server can input the training samples and their corresponding sample labels into the pre-trained model for forward propagation, and use the loss function in the back propagation of the pre-trained model to adjust the parameters of the pre-trained model until the pre-trained model meets certain iteration conditions. The pre-trained model that has been trained can be used as a code evaluation model.
[0082] Furthermore, the code evaluation model can comprehensively consider the code from multiple dimensions, conduct in-depth analysis based on characteristics such as code complexity, standardization, maintainability and potential risks, allowing developers to fully understand the code quality status and help improve the overall architecture quality and long-term maintainability of the software, thereby reducing subsequent maintenance costs and project risks.
[0083] S203: Determine the code before and after the modification of the target code submitted this time in the version management platform.
[0084] Specifically, after the R&D personnel write or modify the project code locally, they can push the written or modified code branch to the version management platform. The version management platform will record the information submitted this time and determine the written or modified content, so that other R&D personnel can share the latest project code. At this time, the version management platform can determine the code before and after the modification submitted by the R&D personnel.
[0085] S204: Calculate the code equivalent of the target code according to the code before modification and the code after modification.
[0086] Among them, code equivalent is a comprehensive indicator used to quantify code size, complexity and development workload.
[0087] Specifically, code equivalent can reflect the manpower, time and other resources required to complete this part of the code. Because it takes into account the size and complexity of the code, it can be used as a reference to estimate the amount of work required for R&D personnel to complete this part of the code. For example, a module with a high code equivalent means that developers may need to spend more time to understand the code logic, code, test and debug.
[0088] In this step, in order to accurately estimate the workload of each R&D personnel so that tasks can be fairly distributed and contributions can be measured, the code equivalent of the target code can be calculated based on the code before and after modification.
[0089] S205: Generate code performance data based on the quality score and the code equivalent.
[0090] In this embodiment, the quality score can be used to objectively measure the comprehensive performance of the target code in multiple dimensions, and the code equivalent can be used to quantify the workload of the R&D personnel, so as to accurately estimate the contribution of the R&D personnel. This can improve the quality of the code in a timely manner and improve the R&D efficiency. On the other hand, it can also understand the workload of the R&D team, so as to reasonably allocate work and improve the efficiency of project development.
[0091] like Figure 3 As shown, in one embodiment, the code equivalent of the target code is calculated according to the code before modification and the code after modification, including:
[0092] S301: Parse the code before modification and the code after modification into syntax tree structures respectively, and obtain a first syntax tree corresponding to the code before modification and a second syntax tree corresponding to the code after modification.
[0093] In this step, in the process of parsing the pre-modification code and the post-modification code into syntax tree structures respectively, the pre-modification code and the post-modification code can be first parsed into AST structures (Abstract Syntax Tree), and then the AST structure of the pre-modification code is converted into a UAST structure (Unified Abstract Syntax Tree), and the AST structure of the post-modification code is converted into a UAST structure. At this time, a first syntax tree (UAST structure) corresponding to the pre-modification code and a second syntax tree (UAST structure) corresponding to the post-modification code can be obtained.
[0094] It can be understood that converting the syntax tree of the AST structure into the syntax tree of the UAST structure can eliminate the syntax differences between different computer languages, so that the calculation of code equivalent can be performed on a unified syntax tree structure, thereby improving the accuracy of the code equivalent.
[0095] S302: Perform a difference comparison between the first syntax tree and the second syntax tree to determine, in the second syntax tree, target nodes that are different from the first syntax tree in the difference comparison and the node type and edit type of each target node.
[0096] In this step, when the first syntax tree and the second syntax tree are compared for difference, each node in the first syntax tree is mapped to the corresponding node in the second syntax tree. If an unmatched node is detected, the edit path of the node is calculated, that is, a set of change operations, which are used to represent the move, update, delete or insert operations of the nodes in the first syntax tree and the second syntax tree. In this way, the nodes involved in these operations can be determined as target nodes with differences, and then the corresponding node type and edit type can be determined, where the edit type refers to the specific edit operation, and the node type can be determined according to different elements in the code, such as classes, methods, variables, etc. It should be noted that the node type refers to the type of atomic node.
[0097] S303: Calculate the change value of each target node according to the node type and edit type of each target node.
[0098] In this step, the scores and weights corresponding to different node types and the scores and weights corresponding to different edit types may be obtained, and then the change value of each target node may be calculated according to the node type and edit type of each target node.
[0099] For example, assuming that the type of the atomic node of the target node A is class, the score is 1 point, the weight is 2, and the edit type is new, the score is 1.5 points, and the weight is 3, then the change value of the target node A can be calculated as 1*2+1.5*3=6.5.
[0100] S304: Determine the sum of the change values of each target node as the initial code equivalent of the target code.
[0101] After the change value of each target node is obtained, the sum of the change values of each target node is calculated, and the calculated value is determined as the initial code equivalent of the target code.
[0102] S305: Identify whether there is a target node for invalid modification operation among the target nodes.
[0103] Since the code may be deleted and then edited back to the original code during the modification process, which essentially does not modify the code, in order to ensure the accuracy of the code equivalent, when calculating the initial code equivalent, it is also necessary to identify whether there are target nodes with invalid modification operations in each target node, and then determine whether the initial code equivalent needs to be adjusted.
[0104] S306: If yes, then adjust the initial code equivalent according to the target nodes with invalid modification operations in each target node, and determine the adjusted initial code equivalent as the code equivalent of the target code.
[0105] In this step, if there are target nodes with invalid modification operations among the target nodes, the initial code equivalent is adjusted according to the target nodes with invalid modification operations among the target nodes, and then the adjusted initial code equivalent is used as the code equivalent of the target code.
[0106] S307: If not, the initial code equivalent is determined as the code equivalent of the target code.
[0107] In this embodiment, by accurately assessing the code equivalent, we can clearly understand the actual workload of each development task or project module. In terms of development efficiency evaluation, we can intuitively compare the code equivalents completed by different personnel or teams in the same time, and accurately locate the efficient and inefficient links. This helps to reasonably allocate resources and scientifically plan project progress, and provides reliable data support and decision-making basis for team collaboration, performance evaluation, cost control and other aspects.
[0108] In one embodiment, before determining the project team to which the submitter of the code branch belongs and pushing the code development report to the corresponding group of the project team, the analysis method for code development further includes:
[0109] S1: Determine the modified code submitted this time based on the code branch.
[0110] S2: Extract the comment information in the modified code and input the comment information into the target model to obtain the inspection result corresponding to the code branch.
[0111] S3: Merge the inspection results into the code development report, and push the merged code development report as the final code development report to the group corresponding to the project team.
[0112] Among them, the target model is used to review and evaluate the semantic integrity, logical relevance and other aspects of the annotation information in the code to obtain the corresponding inspection results.
[0113] In this embodiment, the server can also extract the annotation information in the modified code, and then input the annotation information into the target model to obtain the corresponding inspection result. Finally, the inspection result can be merged with the code development report, and the merged code development report is pushed as the final code development report to the group corresponding to the project team. In this way, the annotation information of the code can also be checked and pushed to the project team, so that the project team can correct it in time, avoiding the need for a large number of modifications when problems arise later, thereby improving the R&D efficiency and quality during the project development process.
[0114] In one embodiment, determining the amount of submitted code and the number of submissions corresponding to the code branch includes:
[0115] S1: Search for the editing analysis record corresponding to the code branch in the version management platform.
[0116] S2: Determine the number of code lines modified by the code branch during this submission based on the edit analysis record, and determine the number of code lines modified as the submitted code amount corresponding to the code branch.
[0117] S3: Count the number of times the code branch is submitted to the version management platform according to the editing analysis record, and determine the number as the number of submissions corresponding to the code branch.
[0118] Among them, the editing analysis record is used to record the modification record of the corresponding code branch.
[0119] In this embodiment, the editing analysis record is determined based on the version management platform, and then the number of code lines modified during this submission is counted, which is used as the number of submitted code corresponding to the code branch. Then, the number of times the code branch is submitted to the version management platform is counted, and this number is determined as the number of submissions corresponding to the code branch. In this way, the basic information of the code branch submission can be determined.
[0120] In one embodiment, extracting the requirement identifier in the code branch and determining the corresponding requirement information in a preset requirement database according to the requirement identifier includes:
[0121] S1: Search for the requirement identifier in the submission specification of the code branch and extract the found requirement identifier.
[0122] S2: Determine a preset demand database, and search the demand database for demand information corresponding to the demand identifier.
[0123] For example, the demand information may be a description of functional requirements such as pushing messages to the platform, connecting to the middle office SMS sending backend, etc.
[0124] In this embodiment, the corresponding requirement information can be determined in the requirement database through the requirement identification, so that the performance of the code branch can be evaluated based on the requirement information to measure the requirement support and code update status of the code branch.
[0125] In one embodiment, the analysis method for code development further includes:
[0126] S1: Determine the analysis duration, and determine the current analysis time period according to the analysis duration.
[0127] S2: Summarize the code development reports generated during the analysis period to obtain development statistics during the analysis period.
[0128] The analysis duration may be manually set or adjusted. For example, the analysis duration may be set to one week, one month, or two months, etc. This application does not impose any specific restrictions on this.
[0129] For example, assuming that the analysis duration is one week, the code development reports generated in the previous week are obtained and summarized on every Monday to obtain the development statistics of the previous week.
[0130] In this embodiment, by setting scheduled tasks and analysis duration, the code development reports within the analysis duration can be automatically summarized and analyzed to obtain development statistical data, so that the project team can directly use the development statistical data when summarizing, saving the cost of manpower summary statistics, and can promptly discover problems in the development process, thereby improving the development efficiency and quality during the project development process.
[0131] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0132] The following is a description of an analysis device for code development provided in an embodiment of the present application. The analysis device for code development described below and the analysis method for code development described above can refer to each other.
[0133] like Figure 4 As shown, the present application provides an analysis device 400 for code development, the device comprising:
[0134] The code acquisition module 401 is used to acquire the code branch and determine the amount of submitted code and the number of submissions corresponding to the code branch when it is detected that a code branch is submitted to the preset version management platform;
[0135] The requirement determination module 402 is used to extract the requirement identifier in the code branch and determine the corresponding requirement information in a preset requirement database according to the requirement identifier;
[0136] The performance evaluation module 403 is used to evaluate the R&D performance of the code branch according to the demand information to obtain code performance data;
[0137] A report generation module 404, for generating a code development report based on the amount of submitted code, the number of submissions, and the code performance data;
[0138] The report push module 405 is used to determine the project team to which the submitter of the code branch belongs, and push the code development report to the corresponding group of the project team.
[0139] In one embodiment, the performance evaluation module includes:
[0140] A code determination submodule is used to determine the target code corresponding to the requirement in the support requirement information in the code branch;
[0141] A score determination submodule is used to perform a quality assessment on the target code using a preset code assessment model to obtain a quality score of the target code;
[0142] The modified code determination submodule is used to determine the pre-modification code and the post-modification code of the target code when it is submitted this time in the version management platform;
[0143] An equivalent calculation submodule, used for calculating the code equivalent of the target code according to the code before modification and the code after modification;
[0144] The data generation submodule is used to generate code performance data based on the quality score and code equivalent.
[0145] In one embodiment, the equivalent calculation submodule includes:
[0146] A code parsing unit, used to parse the pre-modification code and the post-modification code into syntax tree structures respectively, to obtain a first syntax tree corresponding to the pre-modification code and a second syntax tree corresponding to the post-modification code;
[0147] A syntax tree comparison unit, configured to compare the first syntax tree with the second syntax tree to determine, in the second syntax tree, target nodes that are different from the first syntax tree in the difference comparison and the node type and edit type of each target node;
[0148] A change value calculation unit, used to calculate the change value of each target node according to the node type and edit type of each target node;
[0149] An equivalent calculation unit, used for determining the sum of the change values of each target node as the initial code equivalent of the target code;
[0150] The equivalent adjustment unit is used to identify whether there are target nodes with invalid modification operations in each target node. If so, the initial code equivalent is adjusted according to the target nodes with invalid modification operations in each target node, and the adjusted initial code equivalent is determined as the code equivalent of the target code; if not, the initial code equivalent is determined as the code equivalent of the target code.
[0151] In one embodiment, the analysis device developed for the code further includes:
[0152] The submission code determination module is used to determine the modified code submitted this time according to the code branch;
[0153] An information extraction module is used to extract the annotation information in the modified code and input the annotation information into the target model to obtain the inspection result corresponding to the code branch;
[0154] The result merging module is used to merge the inspection results into the code development report, and push the merged code development report as the final code development report to the group corresponding to the project team.
[0155] In one embodiment, the code acquisition module includes:
[0156] The record search submodule is used to search for the editing analysis records corresponding to the code branch in the version management platform;
[0157] A code volume determination submodule is used to determine the number of code lines modified by the code branch during this submission based on the edit analysis record, and determine the number of code lines modified as the submitted code volume corresponding to the code branch;
[0158] The number determination submodule is used to count the number of times the code branch is submitted to the version management platform according to the editing analysis record, and determine the number as the number of submissions corresponding to the code branch.
[0159] In one embodiment, the demand determination module includes:
[0160] The identifier extraction submodule is used to find the requirement identifier in the submission specification of the code branch and extract the found requirement identifier;
[0161] The information search submodule is used to determine a preset demand database and search for demand information corresponding to the demand identifier in the demand database.
[0162] In one embodiment, the analysis device developed for the code further includes:
[0163] A time period determination module is used to determine the analysis time period and determine the current analysis time period according to the analysis time period;
[0164] The report summary module is used to summarize the code development reports generated during the analysis period to obtain the development statistics during the analysis period.
[0165] The division of each module in the above-mentioned analysis device for code development is only for illustration. In other embodiments, the analysis device for code development can be divided into different modules as needed to complete all or part of the functions of the above-mentioned analysis device for code development. Each module in the above-mentioned analysis device for code development can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0166] In one embodiment, the present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the analysis method for code development as described in any of the above embodiments.
[0167] In one embodiment, the present application also provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the analysis method developed for the code as described in any of the above embodiments.
[0168] Indicatively, Figure 5 As shown, Figure 5 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 500 may be provided as a server. Figure 5 , the computer device 500 includes a processing component 502, which further includes one or more processors, and a memory resource represented by a memory 501, for storing instructions executable by the processing component 502, such as an application. The application stored in the memory 501 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 502 is configured to execute instructions to perform the analysis method for code development of any of the above embodiments.
[0169] The computer device 500 may further include a power supply component 503 configured to perform power management of the computer device 500, a wired or wireless network interface 504 configured to connect the computer device 500 to a network, and an input / output (I / O) interface 505. The computer device 500 may operate based on an operating system stored in the memory 501, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.
[0170] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0171] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish an entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only include those elements, but also include other elements that are not clearly listed, or also include elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements limited by the sentence "comprise one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements. Herein, the singular "one", "one" and "described / the" may also include plural forms, unless the context clearly indicates another way. It should also be understood that the terms "include / comprise" or "have" etc. specify the existence of stated features, wholes, steps, operations, components, parts or combinations thereof, but do not exclude the possibility of the existence or addition of one or more other features, wholes, steps, operations, components, parts or combinations thereof. At the same time, the term "and / or" used in this specification includes any and all combinations of the relevant listed items.
[0172] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.
[0173] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An analysis method for code development, characterized in that: The method comprises: When it is detected that a code branch is submitted to a preset version management platform, the code branch is obtained, and the amount of submitted code and the number of submissions corresponding to the code branch are determined; Extracting the requirement identifier in the code branch, and determining corresponding requirement information in a preset requirement database according to the requirement identifier; Performing R&D performance evaluation on the code branch according to the demand information to obtain code performance data; Generate a code development report according to the submitted code amount, the submission times and the code performance data; Determine the project team to which the submitter of the code branch belongs, and push the code development report to the corresponding group of the project team.
2. The analysis method for code development according to claim 1, characterized in that: The performing R&D performance evaluation on the code branch according to the demand information to obtain code performance data includes: Determining, in the code branch, a target code that supports a requirement corresponding to the requirement information; Using a preset code evaluation model to perform quality evaluation on the target code to obtain a quality score of the target code; Determine, in the version management platform, the code before and after the modification of the target code submitted this time; Calculating a code equivalent of the target code according to the code before modification and the code after modification; Code performance data is generated based on the quality score and the code equivalence.
3. The analysis method for code development according to claim 2, characterized in that: The step of calculating the code equivalent of the target code according to the code before modification and the code after modification includes: Respectively parsing the pre-modification code and the post-modification code into syntax tree structures to obtain a first syntax tree corresponding to the pre-modification code and a second syntax tree corresponding to the post-modification code; Performing a difference comparison between the first syntax tree and the second syntax tree to determine, in the second syntax tree, target nodes that are different from the first syntax tree in the difference comparison and the node type and edit type of each target node; Calculate the change value of each target node according to the node type and edit type of each target node; Determine the sum of the change values of each target node as the initial code equivalent of the target code; Identify whether there are target nodes with invalid modification operations in each target node. If so, adjust the initial code equivalent according to the target nodes with invalid modification operations in each target node, and determine the adjusted initial code equivalent as the code equivalent of the target code; if not, determine the initial code equivalent as the code equivalent of the target code.
4. The analysis method for code development according to claim 1, characterized in that: Before determining the project team to which the submitter of the code branch belongs and pushing the code development report to a corresponding group of the project team, the method further includes: Determine the modified code submitted this time according to the code branch; Extracting comment information from the modified code and inputting the comment information into the target model to obtain a check result corresponding to the code branch; The inspection result is merged into the code development report, and the merged code development report is used as the code development report that is finally pushed to the group corresponding to the project team.
5. The analysis method for code development according to claim 1, characterized in that: The determining the amount of submitted code and the number of submissions corresponding to the code branch includes: Searching for the editing analysis record corresponding to the code branch in the version management platform; Determine the number of code lines modified by the code branch during this submission according to the editing analysis record, and determine the number of code lines modified as the submitted code amount corresponding to the code branch; The number of times the code branch is submitted to the version management platform is counted according to the editing analysis record, and the number is determined as the number of submissions corresponding to the code branch.
6. The analysis method for code development according to claim 1, characterized in that: The extracting the requirement identifier in the code branch and determining corresponding requirement information in a preset requirement database according to the requirement identifier includes: Searching for a requirement identifier in the submission specification of the code branch, and extracting the found requirement identifier; A preset demand database is determined, and demand information corresponding to the demand identifier is searched in the demand database.
7. The analysis method for code development according to any one of claims 1 to 6, characterized in that: The method further comprises: Determine an analysis duration, and determine a current analysis time period based on the analysis duration; The code development reports generated within the analysis period are summarized to obtain development statistics within the analysis period.
8. An analysis device for code development, characterized in that: The device comprises: A code acquisition module is used to acquire the code branch when it is detected that a code branch is submitted to a preset version management platform, and to determine the amount of submitted code and the number of submissions corresponding to the code branch; A requirement determination module, used to extract the requirement identifier in the code branch, and determine the corresponding requirement information in a preset requirement database according to the requirement identifier; An efficiency evaluation module, used to perform R&D efficiency evaluation on the code branch according to the demand information to obtain code efficiency data; A report generation module, used to generate a code development report according to the submitted code amount, the submission times and the code performance data; The report push module is used to determine the project team to which the submitter of the code branch belongs, and push the code development report to the corresponding group of the project team.
9. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the analysis method developed for the code as described in any one of claims 1 to 7.
10. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the analysis method developed for code as described in any one of claims 1 to 7 are performed.