Method and device for determining code workload of developer
By filtering and retaining the submission records of the same submission files in the configuration management library, the total code workload of developers is determined, and the deviation between the statistical results and the actual development workload in the existing code statistics scheme is solved, achieving more accurate results workload assessment.
Patent Information
- Application Number
- CN202411535791.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-07
AI Technical Summary
The existing code statistics scheme counts the code workload by summarizing the number of code changes involved in the file submission record of the code warehouse, which leads to a large deviation between the statistical results and the actual development workload of the developers, making it difficult to effectively evaluate development. The workload of the staff.
By obtaining the submission record of the submission file of the configuration management library, when it is determined based on the file submission attribute that there are the same submission record of multiple submission files, one of the submission records of the same submission record of multiple submission files is retained to obtain the configuration management library submission records within the library. Then, based on the committer information and the number of code changes in the submission record in the library, the total code workload of each committer is determined.
Excluding the impact of duplicate code on workload evaluation, reducing the cost of verification code workload and personnel management, and more accurately reflecting the developer's code workload.
Smart Images

Figure CN119396449A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, device, computer-readable storage medium, and program product for determining a developer's code workload. Background Art
[0002] Code statistics provide an effective means for enterprise quality and efficiency management. Managers can evaluate the development workload of developers through the results of code statistics, and developers can also adjust their work mode in a timely manner based on the relevant code statistics results. The existing code statistics solution directly counts the code by summarizing the number of lines of code changes involved in the files in the submission records of the code repository. This simple code statistics solution will result in a large deviation between the statistical results and the actual development workload of developers. Therefore, the code statistics results are difficult to use for effective evaluation of the workload of developers. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method, apparatus, device, computer-readable storage medium and program product for determining the code workload of a developer.
[0004] In order to achieve the above-mentioned purpose, the first aspect of the present application provides a method for determining the code workload of a developer, comprising:
[0005] Obtain the submission record of the submitted file in the configuration management library. The submission record includes the submitter information, the file submission attributes of the submitted file, and the number of code change lines of the submitted file;
[0006] In the configuration management library, when it is determined according to the file submission attribute that there are multiple submission records with the same submission file, one submission record among the multiple submission records with the same submission file is retained to obtain the submission record in the library of the configuration management library;
[0007] Determine the total code workload of each committer based on the committer information and the number of code change lines in the commit records in the library.
[0008] In an embodiment of the present application, the file submission attribute includes an in-library submission identifier of the submitted file; in the configuration management library, when it is determined based on the file submission attribute that there are multiple submission records with the same submitted file, one submission record among the multiple submission records with the same submitted file is retained to obtain the in-library submission record of the configuration management library, including: determining that the submission records with the same in-library submission identifier are multi-branch duplicate submission records; among the multi-branch duplicate submission records, one submission record is retained, and the remaining submission records are filtered out to obtain the in-library submission record.
[0009] In an embodiment of the present application, file submission attributes include: a submission identifier and submission instructions within the library of the submitted file; in the configuration management library, when it is determined based on the file submission attributes that there are multiple submission records with the same submitted file, one submission record among the multiple submission records with the same submitted file is retained to obtain the submission record within the library of the configuration management library, including: determining that multiple submission records with different submission identifiers within the library and the same submission instructions are selected submission records; when there are multiple submission records with the same number of code change lines in the selected submission records, one submission record is retained among the multiple submission records with the same number of code change lines, and the remaining submission records are filtered out to obtain the submission record within the library.
[0010] In the embodiment of the present application, the submission instructions include: submission time and / or submission remarks.
[0011] In an embodiment of the present application, the file submission attribute also includes the file format; obtaining the submission record of the submitted file of the configuration management library includes: in the configuration management library, according to the file format, selecting the submission record whose format of the submitted file conforms to the target file format as the submission record of the submitted file of the configuration management library; or, after retaining one of the submission records with the same submission file, including: according to the file format of the submitted file, retaining the submission record that conforms to the target file format to obtain the submission record in the library.
[0012] In an embodiment of the present application, file submission attributes include file format; based on the submitter information and the number of code change lines in the submission record in the library, the total code workload of each submitter is determined, including: in the submission record in the library, according to the preset file format importance ranking and file format, the weight of the submitted file in each submission record is determined; based on the weight of the submitted file and the number of code change lines, the total amount of code changes in the submission record is counted; based on the total amount of code changes and the submitter information, the total code workload of each submitter is counted.
[0013] In an embodiment of the present application, the weight of the submitted files in each submission record is determined according to a preset file format importance ranking and the file format, including: according to the preset file format importance ranking, determining that the submitted files in the source code file format have a first weight; according to the preset file format importance ranking, determining that the submitted files in the script file format have a second weight; wherein the first weight is greater than the second weight.
[0014] In an embodiment of the present application, the total amount of code changes includes the total number of new lines of code; before counting the total code workload of each submitter based on the total amount of code changes in the submission records and the submitter information, the method also includes: when the total number of new lines of code is greater than a preset new line of code threshold, setting the total number of new lines of code to a default value; wherein the default value is the minimum or average value of the number of new lines of code for each submission record of each submitter during the target work period.
[0015] In an embodiment of the present application, the file submission attribute includes an in-library submission identifier of the submitted file; before counting the total code workload of each submitter based on the total amount of code changes in the submission record and the submitter information, the method also includes: when the total number of new code lines in the submission record is greater than or equal to a preset new code line number threshold, and the in-library submission identifier of the submission record is the first submission identifier in the configuration management library, filtering out the submission record in the configuration management library.
[0016] In an embodiment of the present application, the number of code change lines includes: the number of newly added code lines and the number of deleted code lines; there are multiple configuration management repositories; each configuration management repository corresponds to its own submission record in the repository; based on the number of code change lines and the submitter information in the submission record in the repository, the total code workload of each submitter is counted, including: based on the submitter information, the number of newly added code lines and the number of deleted code lines in the submission record in each repository of the corresponding submitter is counted; based on the number of newly added code lines in the submission record in each repository of the submitter, the total amount of newly added code submitted by the submitter is counted; based on the number of deleted code lines in the submission record in each repository of the submitter, the total amount of deleted code submitted by the submitter is counted; based on the total amount of new code and the total amount of deleted code, the total code workload of the submitter is determined.
[0017] The second aspect of the present application provides an apparatus for determining the code workload of a developer, including: a submission record acquisition module, used to obtain the submission record of a submission file of a configuration management library, the submission record including submitter information, file submission attributes of the submission file, and the number of code change lines of the submission file; a duplicate submission screening module, used to retain one submission record of the same submission file in the configuration management library when determining that there are multiple submission records with the same submission file based on the file submission attributes, so as to obtain the in-library submission record of the configuration management library; a total code workload determination module, used to determine the total code workload of each submitter based on the submitter information and the number of code change lines in the in-library submission record.
[0018] A third aspect of the present application provides a device for determining a developer's code workload, comprising:
[0019] A memory is configured to store instructions; and a processor is configured to call the instructions from the memory and implement the method for determining the developer code workload provided according to any of the above embodiments when executing the instructions.
[0020] A fourth aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, configures the processor to execute a method for determining a developer's code workload provided by any of the above embodiments.
[0021] A fifth aspect of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method for determining the developer's code workload provided according to any of the above embodiments.
[0022] Through the above technical solution, the method for determining the developer's code workload provided by the embodiment of the present application has at least the following beneficial effects:
[0023] 1. It can eliminate the impact of duplicate code on workload assessment, thereby reducing the workload of code checking and the cost of personnel management;
[0024] 2. The commit record and its commit files of the merged branch can be compared and determined through the commit identifier in the repository that is unique to the commit record;
[0025] 3. The same submission records and submission files generated by extraction can be determined based on the submission description and the number of code change lines;
[0026] 4. You can select submission records of submitted files that match the target file format to obtain submission records in the library;
[0027] 5. The total amount of code changes in the submitted records can be obtained based on the weighted sum of the weight and the number of lines of code changes, so as to reflect the impact of the importance of each line of code changes on the workload;
[0028] 6. The total number of new code lines that exceed the threshold can be restored to a reasonable level through the default value to more accurately reflect the workload of developers;
[0029] 7. Based on the total number of new code lines in the submission record and its submission identifier in the library, the initialization submission record with a large total number of new code lines can be identified and excluded from the total code workload of the submitter, so that the total code workload can more accurately reflect the workload.
[0030] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:
[0032] Figure 1 A schematic diagram of a process flow of a method for determining a developer's code workload according to an embodiment of the present application is schematically shown;
[0033] Figure 2 A schematic diagram of a process for determining a submission record in a library according to an embodiment of the present application is shown;
[0034] Figure 3 Schematically shows the Figure 2 A flowchart of a method for determining a developer's code workload obtained by a method for determining a commit record in a repository;
[0035] Figure 4 The structural block diagram of the apparatus for determining the code workload of a developer according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0037] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0038] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0039] The acquisition, transmission, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations. In addition, it should be noted that in the embodiments of this application, some existing solutions in the industry such as certain software, components, and models may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.
[0040] The method for determining the code workload of developers provided in the embodiment of the present application quantitatively evaluates the workload of developers by counting the number of code change lines of the submitted files submitted by developers to the configuration management library. The code change lines referred to may include the number of newly added code lines and / or the number of deleted code lines.
[0041] In the code statistics process of the code warehouse, the traditional code statistics method simply obtains and counts the number of code change lines of the files submitted by the developer, and then obtains the final code statistics result. The code statistics results obtained in this way are often difficult to reflect the actual workload of the developer. Therefore, the manager cannot effectively evaluate the workload of the developer, which will cause an increase in management costs. The inventor of the present application found that when the developer submits a file to the code warehouse, he may repeatedly submit the same file or perform batch code modification behavior due to actual work needs. Therefore, based on this discovery, the inventor of the present application proposes a method for determining the code workload of the developer provided by the embodiment of the present application. The method analyzes the submission records of the code warehouse (configuration management library) and screens out repeated code change behaviors, thereby excluding the influence of repeated code in the final code statistics results, and thus obtaining code statistics results that can better reflect the code workload of the developer.
[0042] The method for determining the code workload of developers provided in this application can be applied to the terminals of developers and / or managers, including but not limited to various personal computers, laptops, smart phones, and tablet computers. The terminal is connected to the server as a code warehouse through a network. The method for determining the code workload of developers provided in this application can also be integrated into the server as part of the code warehouse program for terminal users to call.
[0043] Figure 1 A schematic diagram of a method for determining a developer's code workload provided by an embodiment of the present application is shown schematically. The method for determining a developer's code workload comprises the following steps:
[0044] S120, obtaining a submission record of a submission file of a configuration management library, wherein the submission record includes information of the submitter, file submission attributes of the submission file, and the number of code change lines of the submission file;
[0045] S140. In the configuration management library, if it is determined according to the file submission attribute that there are multiple submission records with the same submitted file, retain one submission record among the multiple submission records with the same submitted file to obtain a submission record in the library of the configuration management library;
[0046] S160. Determine the total code workload of each submitter based on the submitter information and the number of code change lines in the submission record in the library.
[0047] The above-mentioned method for determining the developer code workload provided by the embodiment of the present application, firstly obtains the submission record generated by the developer submitting the file to the configuration management library, thereby obtaining the submitter information corresponding to the submitted file, the file submission attribute of the submitted file and the number of code change lines of the submitted file. Then, according to the file submission attribute, the same submitted file in the configuration management library is determined, and after determining the same submitted file, the corresponding multiple submission records are screened to one, so as to obtain the in-library submission record of the configuration management library. Therefore, the in-library submission record will not record the repeated code change behavior of the developer, so that in the final total code workload, there will be no influence of duplicate code. Therefore, the method for determining the developer code workload provided by the embodiment of the present application can eliminate the influence of duplicate code on workload assessment, and allow the total code workload as the code statistics result to more accurately reflect the workload of the developer, thereby reducing the cost of checking the code workload and personnel management.
[0048] It can be understood that in step S120, the configuration management library can be selected according to the development project or development work, or according to the development project or development work involved in a specified time range. Each time a submitter submits a file to the configuration management library, there will be a corresponding submission record, and the number and type of submitted files submitted by the submitter each time can be plural or singular. The submitter information may include the submitter's name and / or the submitter's contact information. The number of code change lines may include the number of newly added code lines and / or the number of deleted code lines. The file submission attributes may include the submission mark, submission time, and submission comments in the library corresponding to the submitted file.
[0049] In some embodiments of the present application, the file submission attribute includes a submission identifier in the library of the submitted file. Step S140 includes:
[0050] Determine that the commit records with the same commit identifier in the library are multi-branch duplicate commit records;
[0051] Among the repeated commit records in multiple branches, keep one commit record and filter out the rest to get the commit records in the library.
[0052] It can be understood that multiple branch duplicate submission records include multiple submission records that record the same submission file. In actual projects or work, there will be different branches of the development program, and different branches are divided according to factors such as the program's operating environment and version. Therefore, there will be an operation in which developers synchronize the submission files submitted to a branch to other branches. After the operation is completed, the submission identifiers in the library of the same submission files submitted to multiple branches are the same.
[0053] As an example, in a Git code repository, merging branches (git merge) is used to merge the code in the development phase into a more stable branch for testing or version release. This action directly merges all the submitted files on a branch into other branches, and the submission records and corresponding submitted files remain unchanged. The submission records and their submitted files copied through the above actions can be compared and determined through the submission record's unique in-library submission identifier. Among them, the in-library submission identifier is a submission ID called SHA or hash in the Git code repository, which is used to identify specific submission files, submission time and submitter.
[0054] Since repeated submission of submitted files is not limited to the above-mentioned actions such as merging branches in Git code repositories that can ensure that the commit identifier in the repository remains unchanged, in order to identify and determine the same commit record and its corresponding submitted file when the commit identifier in the repository is variable, the present application embodiment also provides another implementation of step S140.
[0055] In some embodiments of the present application, the file submission attributes include: a submission identifier and a submission description in the library of the submitted file; step S140 includes:
[0056] Determine multiple submission records in the library with different submission identifiers and the same submission description as selected submission records;
[0057] In the case that there are multiple submission records with the same number of code change lines in the selected submission records, one submission record is retained among the multiple submission records with the same number of code change lines, and the remaining submission records are filtered out to obtain the submission records in the library.
[0058] Thus, among multiple submission records with different submission identifiers, submission records with the same submission description are screened out. If the submission description is the same, the submission files corresponding to these submission records may be the same submission file. Then, among these submission records, submission records with the same number of code change lines are determined as submission records expressing the same submission file, so that multiple submission records with the same submission file can be filtered out to one submission record, and the submission records with the same submission file are filtered out to obtain the submission records in the library.
[0059] It can be understood that the submission description may include submission time and / or submission remarks, wherein the submission time is the time when the configuration management library responds to the submission action, and the submission remarks are the remarks provided by the submitter for submitting the file.
[0060] As an example, in a Git code repository, cherry-pick is usually used to synchronize the specified commit files on a branch to different development branches to update the development content of a module. This action synchronizes the same commit files to multiple branches, but the commit ID in the repository will change. Therefore, the same commit files can be identified based on the commit description and the number of lines of code changes, and the commit records of the same commit files can be filtered out to obtain the commit records in the repository.
[0061] In order to exclude the influence of submitted files that do not reflect the code development work of the developer, the method for determining the developer's code workload provided in the embodiment of the present application also considers the influence of the file format of the submitted files on the total code workload of the final submitter.
[0062] Based on the above, in some embodiments of the present application, the file submission attribute also includes the file format;
[0063] Step S120 includes:
[0064] In the configuration management library, according to the file format, a submission record whose format of the submission file conforms to the target file format is selected as the submission record of the submission file of the configuration management library;
[0065] Or, after one of the commit records that retains the same commit file, include:
[0066] According to the file format of the submitted file, retain the submission record that conforms to the target file format to obtain the submission record in the library.
[0067] Therefore, the method for determining the developer's code workload provided in the embodiment of the present application can select submission records of submission files that match the target file format according to the target file format to obtain submission records in the library. In the above embodiment, the step of filtering submission records according to the file format can be performed in step S120, or in step S140, after filtering submission records of the same submission file.
[0068] It can be understood that the target file format may include file types related to development work, such as .java, .cpp, .c, etc.; file types unrelated to development work are excluded from the target file format, and file types unrelated to development work may include, for example, .log, .txt, etc.
[0069] Specifically, one submission record may correspond to multiple submission files. Therefore, when filtering submission records according to the target file format, it is necessary to compare and filter the multiple submission files in the submission record one by one, and retain the relevant information of the submission files in the submission record that conform to the target file format. Therefore, if the entries of multiple submission files in the submission record are filtered according to the target file format, only the entries of the retained submission files will be used in subsequent code statistics.
[0070] After obtaining the transaction records in the database, step S160 is executed to obtain the total code workload of each submitter.
[0071] Considering that different types of submitted files reflect different degrees of developer workload, in some embodiments of the present application, the file submission attribute includes the file format, and step S160 includes:
[0072] S162, in the submission records in the library, according to the preset file format importance ranking and file format, determine the weight of the submission file in each submission record;
[0073] S164. Count the total amount of code changes in the submitted records according to the weight of the submitted files and the number of code change lines;
[0074] S166. Count the total code workload of each submitter based on the total amount of code changes and submitter information.
[0075] The method for determining the code workload of developers provided in the embodiment of the present application assigns weights to each submitted file corresponding to the submission record according to a preset file importance ranking, and obtains the total code change amount of the submission record based on the weighted sum of the weight and the number of lines of code change. The total code change amount is then summarized according to the submitter information to obtain the total code workload of each submitter. Therefore, the total code workload not only reflects the number of lines of code change of the submitter's submitted files, but also reflects the impact of the importance of each line of code change on the submitter's workload, and can therefore more comprehensively and accurately reflect the submitter's workload.
[0076] It can be understood that the preset file format importance ranking can be, for example, sorted according to the source code file format and the script file format, where the source code file format is more important. The weight of the file format with greater importance is also higher. The source code file format can include, for example: .c, .cpp, .java, .sql, .js, .vue, .py; the script file format can include: .xml, .sh, .pl. Among them, the weight of the source code file format can be, for example, 0.6, the weight of the script file format can be, for example, 0.3, and the weight of the remaining file formats can be, for example, 0.1.
[0077] Specifically, step S162 may include:
[0078] According to a preset order of importance of the file formats, determining that the submitted file in the source code file format has the first weight;
[0079] According to the preset file format importance ranking, it is determined that the submitted file in the script file format has a second weight; wherein the first weight is greater than the second weight.
[0080] In some embodiments of the present application, the total amount of code changes obtained in step S164 may include the total number of newly added code lines. Before executing step S166, the following steps are also included:
[0081] When the total number of new code lines is greater than the preset threshold of the number of new code lines, the total number of new code lines is set to the default value; wherein the default value is the minimum or average number of new code lines of each submission record of each submitter during the target work period.
[0082] In the actual development process, developers may use automated means to generate batch codes, make batch modifications, etc., so the total number of newly added code lines calculated in step S164 may be too large and cannot reflect the actual workload of the developers. Therefore, by setting a threshold for the number of newly added code lines, the total number of newly added code lines of each submission record is checked. If the total number of newly added code lines exceeds the above threshold for the number of newly added code lines, it is determined that the submission file corresponding to the submission record has the above-mentioned automated or batch generation and modification of code, and the threshold for the number of newly added code lines of the submission record is set to the default value. The default value is set to the minimum or average value of the number of newly added code lines of each submission record during the target work period, so the total number of newly added code lines that exceeds the threshold for the number of newly added code lines can be restored to a reasonable level to more accurately reflect the workload of the developers.
[0083] Furthermore, in the actual development process, developers may also perform initialization operations for the configuration management repository, and therefore first submit various files to the configuration management repository, and these submitted files are actually existing codes migrated to the configuration management repository.
[0084] In order to more accurately reflect the workload of developers, in some embodiments of the present application, the file submission attribute includes a submission identifier in the library of the submitted file; before executing step S166, the following steps are also included:
[0085] When the total number of newly added code lines of the submission record is greater than or equal to the preset threshold number of newly added code lines, and the submission identifier in the repository of the submission record is the first submission identifier in the configuration management repository, the submission record is filtered out in the configuration management repository.
[0086] Since the submitted files involved in the initialization of the configuration management library are existing files migrated thereto, and their code volume is generally higher than the total number of lines of new code added by each submitter, that is, the developer, in a normal single submission during the project development process, they should not be included in the total code workload of the submitter. Therefore, before executing step S166, based on the total number of new code lines in the submission record and its submission identifier in the library, the initialization submission record with a large total number of new code lines is determined, and it is excluded from the total code workload of the submitter, so that the total code workload can more accurately reflect the workload of the submitter, that is, the developer.
[0087] In some embodiments of the present application, the number of code change lines may include: the number of newly added code lines and the number of deleted code lines; there are multiple configuration management repositories; each configuration management repository corresponds to its own in-repository submission record;
[0088] Step S160 includes:
[0089] According to the submitter information, count the number of new code lines and the number of deleted code lines in the corresponding submitter's submission records in each repository;
[0090] According to the number of new code lines in the submission records of the submitter in each library, the total amount of new code submitted by the submitter is calculated;
[0091] According to the number of deleted code lines in the commit records in each library, the total amount of deleted code submitted by the committer is calculated;
[0092] Determine the total code workload of the submitter based on the total amount of new code and the total amount of deleted code.
[0093] Since in the actual project development process, the same project may need to use multiple configuration management libraries, or the same developer may submit files to multiple configuration management libraries, the method provided in the embodiment of the present application also takes into account the situation where there are multiple configuration management libraries. At this time, each configuration management library obtains the submission record in its library according to step S120 and step S140, and then counts the number of newly added code lines and the number of deleted code lines according to the submission record in its library, and implements the statistical results to the person according to the submitter information, thereby obtaining the total code workload of the submitter.
[0094] Specifically, each configuration management repository may first perform statistics within the scope of submission records within the repository to obtain the in-repository statistical results of the number of new code lines and the number of deleted code lines of the submitters within each configuration management repository, and then summarize the statistical results within each repository and classify them to each submitter according to the submitter information to obtain the total code workload of the submitter.
[0095] To facilitate understanding of the technical solution provided in the embodiments of the present application, the following takes the Git code repository (hereinafter referred to as the Git repository) as an example. Figure 2 and Figure 3 , an exemplary description is given of the method for determining the developer's code workload provided in an embodiment of the present application.
[0096] First, determine the configuration management library system based on the projects or development work involved in the specified time range, further filter out the configuration management libraries to be counted in the configuration management library system, and generate a list of configuration management library pull methods. In the Git library, the configuration management library pull method list is the Git library clone address list. The configuration management library range can be set to the Git library involved in the development work of a project within the specified time range, excluding the document library, deployment script library and other repositories that are not related to the development work.
[0097] Then execute Figure 2Step S120 shown. Specifically, according to the list of configuration management library pulling methods, pull the configuration management libraries one by one to the specified directory, and obtain the submission records of all branches within the specified time range of the configuration management library according to the characteristics of the version management tool of the configuration management library, including the submission ID, submitter information, submission file name, and the number of new and deleted code lines involved in each file. Taking the Git library as an example, the Git command line can be directly used to obtain the submission records of all branches within the specified time range of the code warehouse, including the submission ID, submitter information, submission file name, and the number of new and deleted code lines involved in each file.
[0098] Then according to Figure 2 Steps S142 and S144, as well as steps S146 and S148 shown in the figure screen the submission records corresponding to the submission files submitted repeatedly by multiple branches. After the screening is completed, the submission records corresponding to the submission files that meet the target file format are screened according to step S220 to obtain the submission records in the library.
[0099] Then execute Figure 3 Steps S320 and S340 are shown to obtain the total amount of code changes for each submission record.
[0100] Specifically, in a specific example, the weight of files with suffixes such as .c, .cpp, .java, .sql, .js, .vue, and .py is set to 0.6, the weight of files with suffixes such as .xml, .sh, and .pl is set to 0.3, and the weight of files with other suffixes is set to 0.1. A submission record includes: a.java file involves 100 new lines of code and 5 deleted lines of code; b.sql file involves 250 new lines of code and 200 deleted lines of code; c.sh file involves 50 new lines of code and 30 deleted lines of code; the local configuration ignore list involves 5 new lines of code and 0 deleted lines of code;
[0101] Then the total number of new lines of code in this commit record is:
[0102] 60%*(100+250)+30%*50+10%*5=225.5 rows;
[0103] The total number of lines of code deleted is:
[0104] 60%*(5+200)+30%*30+10%*0=132 rows.
[0105] Then, according to step S360 and step 380, each submission record is judged and processed, and the total number of new code lines greater than the preset new code line number threshold is set as the default value, or further judgment is made. If the in-library submission identifier of these submission records of the total number of new code lines is the first submission identifier in the configuration management library, then the submission record is filtered out of the final statistical results as the initialization submission record of the configuration management library.
[0106] Then, step S390 is executed. Since there are multiple configuration management repositories, when executing step 390, the amount of code added and deleted by each submitter (developer) in each configuration management repository needs to be summarized to form a data report on the amount of code in the configuration management repository related to the project or development work within the specified time range, which may include submitter information, configuration management repository, number of new code lines, number of deleted code lines, etc.
[0107] In summary, the method for determining the developer's code workload provided by the embodiment of the present application can determine the scope of the configuration management library according to the configuration library system to which the project or actual development work belongs, obtain the submission records of the configuration management library within the specified time range, ensure the correlation between the statistical data and the actual development work, and be able to count the number of lines of code changes in different types of configuration management libraries. By judging, filtering and processing the submission files that cause statistical deviations in the obtained submission records, it is possible to avoid the problem of large deviations between the statistical results and the actual development workload caused by repeated submissions of multiple branches, the amount of code generated by files unrelated to the development work, initialization of warehouse submissions, automatic code generation or batch modification of code, etc., ensuring that the statistical results can be effectively used and reducing the cost of abnormal code volume data confirmation and review. Users can set the judgment and processing conditions and statistical reports according to the actual situation of the project or enterprise, so that the statistical method has higher flexibility and adaptability.
[0108] It should be understood that, although each step in the flow chart provided by the embodiment of the present application is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is clear explanation in this article, the execution of these steps does not have strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the embodiment of the present application may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0109] The embodiment of the present application also provides a device for determining a developer's code workload, including:
[0110] The submission record acquisition module 420 is used to acquire the submission record of the submission file of the configuration management library, and the submission record includes the submitter information, the file submission attribute of the submission file, and the number of code change lines of the submission file;
[0111] A duplicate submission screening module 440 is used to retain one submission record from among the submission records with the same submitted files in the configuration management library when it is determined according to the file submission attribute that there are multiple submission records with the same submitted files, so as to obtain the submission record in the library of the configuration management library;
[0112] The total code workload determination module 460 is used to determine the total code workload of each submitter based on the submitter information and the number of code change lines in the submission record in the library.
[0113] The device for determining the developer code workload includes a processor and a memory, the memory is configured to store instructions; the processor is configured to call instructions from the memory and when executing the instructions, it can implement the method for determining the developer code workload provided according to any of the above embodiments.
[0114] The processor includes a kernel, which calls the corresponding program unit from the memory. The kernel can be set to one or more, and the method for determining the workload of the developer's code is implemented by adjusting the kernel parameters.
[0115] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0116] An embodiment of the present application provides a storage medium having instructions stored thereon, which, when executed by a processor, configures the processor to execute a method for determining a developer's code workload provided in any of the above embodiments.
[0117] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the method for determining the developer's code workload provided by any of the above embodiments.
[0118] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0119] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0120] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0121] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0122] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0123] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0124] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0125] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0126] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for determining a developer's code workload, characterized in that The method comprises: Obtaining a submission record of a submission file of a configuration management repository, wherein the submission record includes information of a submitter, file submission attributes of the submission file, and the number of code change lines of the submission file; In the configuration management library, when it is determined according to the file submission attribute that there are multiple submission records with the same submitted file, one submission record among the multiple submission records with the same submitted file is retained to obtain the in-library submission record of the configuration management library; The total code workload of each submitter is determined according to the submitter information and the number of code change lines in the submission record in the library.
2. The method according to claim 1, characterized in that: The file submission attribute includes a submission identifier within the library of the submitted file; The step of retaining one of the submission records with the same submitted files in the configuration management repository, when it is determined according to the file submission attribute that there are multiple submission records with the same submitted files, so as to obtain the submission record in the configuration management repository, includes: Determine that the submission records with the same submission identifier in the library are multi-branch duplicate submission records; Among the multiple branch repeated submission records, one submission record is retained, and the remaining submission records are filtered out to obtain the submission record in the library.
3. The method according to claim 1, characterized in that The file submission attributes include: a submission identifier and a submission description within the library of the submitted file; The step of retaining one of the submission records with the same submitted files in the configuration management repository, when it is determined according to the file submission attribute that there are multiple submission records with the same submitted files, so as to obtain the submission record in the configuration management repository, includes: Determine the plurality of submission records in the library that have different submission identifiers and the same submission descriptions as selected submission records; In the case that there are multiple submission records with the same number of code change lines in the selected submission records, one submission record is retained among the multiple submission records with the same number of code change lines, and the remaining submission records are filtered out to obtain the submission records in the library.
4. The method according to claim 3, characterized in that The submission instructions include: submission time and / or submission remarks.
5. The method according to claim 1, characterized in that: The file submission attributes also include file format; The step of obtaining the submission record of the submission file of the configuration management repository includes: In the configuration management repository, according to the file format, a submission record whose format of the submitted file conforms to the target file format is selected as a submission record of the submitted file of the configuration management repository; Alternatively, after retaining one of the submission records that is the same as the submission file, the step includes: According to the file format of the submitted file, the submission record that conforms to the target file format is retained to obtain the submission record in the library.
6. The method according to claim 1, characterized in that The file submission attributes include file format; Determining the total code workload of each submitter according to the submitter information and the number of code change lines in the submission record in the library includes: In the submission records in the library, according to the preset file format importance ranking and the file format, the weight of the submitted file in each submission record is determined; Counting the total amount of code changes in the submission record according to the weight of the submission file and the number of code change lines; According to the total amount of each code change and the submitter information, the total code workload of each submitter is counted.
7. The method according to claim 6, characterized in that The step of determining the weight of the submitted file in each submission record according to the preset file format importance ranking and the file format includes: According to the preset file format importance ranking, determining that the submitted file in the source code file format has a first weight; According to the preset file format importance ranking, it is determined that the submitted file in the script file format has a second weight; wherein the first weight is greater than the second weight.
8. The method according to claim 6, characterized in that The total amount of code changes includes the total number of newly added code lines; Before calculating the total code workload of each submitter based on the total code changes in the submission record and the submitter information, the method further includes: When the total number of new code lines is greater than a preset threshold value for the number of new code lines, the total number of new code lines is set to a default value; wherein the default value is the minimum or average number of new code lines of each submission record of each submitter during the target work period.
9. The method according to claim 8, characterized in that The file submission attribute includes a submission identifier within the library of the submitted file; Before calculating the total code workload of each submitter based on the total code changes in the submission record and the submitter information, the method further includes: When the total number of newly added code lines of the submission record is greater than or equal to the preset threshold number of newly added code lines, and the in-library submission identifier of the submission record is the first submission identifier in the configuration management library, the submission record is filtered out in the configuration management library.
10. The method according to claim 1, characterized in that The number of code change lines includes: the number of newly added code lines and the number of deleted code lines; the number of the configuration management repositories is multiple; each of the configuration management repositories corresponds to its own submission record in the repositories; The total code workload of each submitter is counted according to the number of code change lines and the submitter information in the submission record in the library, including: According to the submitter information, the number of newly added code lines and the number of deleted code lines in the submission records of the corresponding submitter in each of the libraries are counted; According to the number of newly added code lines in the submission record of the submitter in each of the libraries, the total amount of newly added code submitted by the submitter is obtained by counting; According to the number of deleted code lines in the submission record of the submitter in each of the libraries, the total amount of deleted code submitted by the submitter is obtained by counting; The total code workload of the submitter is determined based on the total amount of newly added code and the total amount of deleted code.
11. A device for determining the code workload of a developer, characterized in that include: A submission record acquisition module is used to acquire submission records of submission files of the configuration management library, wherein the submission records include information of the submitter, file submission attributes of the submission file, and the number of code change lines of the submission file; A duplicate submission screening module is used to retain one submission record from among the submission records with the same submitted file in the configuration management library when it is determined according to the file submission attribute that there are multiple submission records with the same submitted file in the configuration management library, so as to obtain the submission record in the library of the configuration management library; The total code workload determination module is used to determine the total code workload of each submitter based on the submitter information and the number of code change lines in the submission record in the library.
12. A device for determining a developer's code workload, characterized in that include: a memory configured to store instructions; as well as A processor is configured to call the instructions from the memory and implement the method for determining the developer code workload according to any one of claims 1 to 10 when executing the instructions.
13. A machine-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by a processor, the processor is configured to perform the method for determining developer code workload according to any one of claims 1 to 10.
14. A computer program product comprising a computer program, characterized in that The computer program implements the method for determining developer code workload according to any one of claims 1 to 10 when executed by a processor.