Code line difference automatic statistical method, statistical system and equipment
By performing structured parsing and hash value matching on the multi-repository engineering architecture, a multi-repository intelligent identification mechanism is constructed, which solves the problem of the inability to accurately delineate repository boundaries in existing technologies and achieves efficient, accurate statistics and automated display of cross-version code line differences.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NINGBO JOYNEXT TECH CO LTD
- Filing Date
- 2026-01-04
- Publication Date
- 2026-05-12
Smart Images

Figure CN122018976A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software code development and management technology, and more specifically, to an automatic statistical method, system and device for calculating line differences in code. Background Technology
[0002] Lines of code statistics are a technical tool in software project management that can assess project scale, quantify team workload, advance development progress, and optimize resource allocation. Accurate statistical results help managers understand module complexity and personnel output, providing a basis for plan adjustments and performance evaluations. Today, software architecture is evolving towards modularity, and multi-repository collaboration has become the mainstream for large-scale projects. Each repository has a clear division of labor yet is interdependent, working together to support the project's operation.
[0003] Existing code line counting solutions are mainly designed for single repositories. Their function is to scan, parse, and count the lines of code files under a specified path. They are not specifically developed for projects with multiple repositories working together, and cannot adapt to the statistical needs of large projects with multiple repositories.
[0004] However, the relevant technologies have at least one of the following problems: the existing code line statistics lack a multi-repository identification mechanism, which makes it impossible for the code line statistics system to accurately delineate the code boundaries of each repository, thus failing to achieve separate statistics of code lines in each repository, thereby affecting the relevance and usability of the code line data. Summary of the Invention
[0005] The technical problem solved by this invention is that existing line-of-code statistics lack a multi-repository identification mechanism, which makes it impossible for the line-of-code statistics system to accurately delineate the code boundaries of each repository, thus failing to achieve separate statistics of line-of-code for each repository, thereby affecting the relevance and usability of the line-of-code data.
[0006] To address the aforementioned problems, in a first aspect, embodiments of the present invention provide an automatic method for calculating line-of-code differences. This automatic method is used to calculate line-of-code differences between different versions of a multi-repository project. The automatic method includes the following steps: S1: Perform structured analysis on the architecture of the multi-repository project to extract the current dictionary database data of each code repository; S2: According to the configuration rules of the target project, input multiple identifier parameters corresponding to multiple versions of the project with code line differences to be counted, and use the method in step S1 to obtain multiple dictionary database data corresponding to multiple versions of the project. S3: Perform source matching comparison on multiple dictionary databases to be statistically analyzed, and perform differentiated classification processing based on the differences between multiple versions of the project. S4: Based on the data association of multiple dictionary databases to be statistically analyzed, retrieve the code resources corresponding to multiple version projects, calculate the quantitative data of code lines corresponding to each unit identifier through preset statistical rules, and store the code line data of different unit identifiers in multiple version projects in association. S5: Integrate and deploy the statistical processes of steps S1 to S4 on the automated execution platform to standardize and interactively display the cross-version engineering row difference data corresponding to multiple identifier parameters; Among them, multiple version projects include at least two version projects.
[0007] Compared with existing technologies, the technical effects achieved by adopting this technical solution are as follows: This solution constructs a multi-repository intelligent identification mechanism by performing structured parsing and extracting dictionary database data from the multi-repository engineering architecture, accurately delineating the code boundaries of each repository, and solving the problem that existing code line statistics systems cannot separately count the code lines of each repository, resulting in insufficient data specificity and usability.
[0008] Furthermore, by inputting identifier parameters, comparing and contrasting source-based data from multiple version dictionaries, and processing differences, combined with preset statistical rules, the code line data corresponding to each unit identifier is quantitatively calculated and stored in association, which improves the accuracy of cross-version code line difference statistics and avoids statistical deviations caused by manual configuration errors.
[0009] In addition, by integrating the entire statistical process into the automated execution platform, the automated execution, standardized presentation, and interactive display of cross-version difference statistics are realized, eliminating tedious operations such as manual repetitive configuration and warehouse updates, and improving statistical efficiency and convenience.
[0010] In one embodiment of the present invention, step S1 specifically includes: An automated statistics script is built based on a pre-defined general standardized interface to count all code repositories of the current version of the project, and the counted dictionary data is stored in a dictionary structure.
[0011] Compared with existing technologies, the technical effects achieved by this solution are as follows: This solution builds automated statistical scripts through a pre-set general standardized interface. On the one hand, it eliminates the dependence on manual configuration in existing statistical methods, and can automatically and comprehensively count all code repositories of the current version of the project, avoiding omissions or duplications that may occur in manual statistics, thereby improving the efficiency of multi-repository identification and data collection. On the other hand, it uses a dictionary structure to store the extracted current dictionary database data, making the information of each code repository structured and clear, thereby solving the problem of ambiguous code boundary division caused by the lack of a multi-repository identification mechanism in existing technologies, and further enhancing the relevance and usability of code line statistics.
[0012] In one embodiment of the present invention, the dictionary database data includes: the repository path and hash value of each code repository.
[0013] Compared with existing technologies, the technical effects achieved by this solution are as follows: This solution incorporates the repository paths and hash values of each code repository into the dictionary database. First, it achieves accurate location of the physical location of each code repository in a multi-repository project through the repository paths, solving the problem that existing technologies cannot clearly delineate the boundaries of each repository's code. Second, the hash value, as a unique identifier of the repository content, can quickly verify the integrity and uniqueness of the repository code, effectively avoiding statistical distortion caused by duplicate code references or version obfuscation, and ensuring the accuracy of the code line data of each repository.
[0014] In one embodiment of the present invention, the multiple version projects include a first version project and a second version project, and step S3 specifically includes: Determine whether the dictionary database contains both the first repository path corresponding to the first version of the project and the second repository path corresponding to the second version of the project. If both the first and second repository paths exist, then compare the first hash value of the first version project with the second hash value of the second version project. If the first hash value is the same as the second hash value, then neither the first version project nor the second version project will be marked.
[0015] Compared with existing technologies, the technical effects achieved by this solution are as follows: In step S3 of this solution, the first step is to determine whether the repository paths of the first version project and the second version project exist simultaneously in the dictionary database. Then, based on the premise that the repository paths exist, the hash values of the two are compared. Finally, versions with the same hash value are not marked, forming an efficient screening mechanism of "path matching → hash verification → no marking for indistinguishable versions". This solves the problem of repeated processing of indistinguishable repositories in cross-version statistics in existing technologies, thereby ensuring the correspondence of multiple version repositories. The uniqueness of the hash value quickly identifies repositories with completely identical content, avoiding invalid statistical calculations and marking operations, thereby improving the efficiency of cross-version difference classification. At the same time, it reduces statistical redundancy caused by interference from indistinguishable data, further enhancing the targeting and efficiency of multi-repository project code line statistics.
[0016] In one embodiment of the present invention, if the first hash value and the second hash value are inconsistent, the first warehouse path and the second warehouse path are marked as updated warehouses.
[0017] Compared with existing technologies, the technical effects achieved by this solution are as follows: When the hash values of the first and second versions of the project are inconsistent, the solution marks the corresponding repository path as the updated repository. By leveraging the unique identifier characteristic of hash values for code content, it achieves accurate and rapid location of repositories that have changed between multiple versions. This solves the problem that existing technologies require checking all repositories one by one to find differences, which is inefficient and prone to omissions. As a result, it improves the targeting and efficiency of cross-version code line statistics.
[0018] In one embodiment of the present invention, if only the first warehouse path exists in the dictionary database, then the first warehouse path is marked as the update warehouse.
[0019] Compared with existing technologies, the technical effects achieved by this solution are as follows: This solution marks the first repository path of the first version project as an updated repository when it only exists in the dictionary database. It accurately captures the "retained repository in the scenario corresponding to the repository deletion" in multiple version projects, solving the problem that existing technologies easily overlook the changes in the relationship between the addition and deletion of repositories during version iterations, resulting in incomplete difference identification. The marking can be completed quickly by directly judging the existence of the repository path without complex verification. This ensures the completeness of difference identification and clarifies the objects of subsequent statistics, thereby improving the efficiency of cross-version difference classification.
[0020] In one embodiment of the present invention, if only the second warehouse path exists in the dictionary database, then the second warehouse path is marked as a newly added warehouse.
[0021] Compared with existing technologies, the technical effects achieved by this solution are as follows: This solution marks a newly added repository when only the second repository path of the second version project exists in the dictionary database. It accurately identifies the differences in "repository additions" in multiple version iterations, and solves the problems of existing technologies being slow to identify cross-version new repositories, easily missing them, and resulting in incomplete statistical data. The existence of the repository path can be used to quickly locate the new repository without complex content comparison, which improves the efficiency of difference identification and ensures the comprehensiveness of the statistical scope.
[0022] In one embodiment of the present invention, step S4 specifically includes: Get the first repository path corresponding to the first version project and the first hash value associated with the first repository path. Use the first hash value as an index to retrieve the first version code corresponding to the first version project. Get the second repository path corresponding to the second version project and the second hash value associated with the second repository path. Use the second hash value as an index to retrieve the second version code corresponding to the second version project. Based on the first repository path value and its associated first hash value, the second repository path value and its associated second hash value, count the number of first lines of code corresponding to the first repository path value and the number of second lines of code corresponding to the second repository path value. Establish a mapping relationship between repository path values between the first and second version projects, and associate and store the number of lines of code corresponding to the same repository path value in different version projects.
[0023] Compared with existing technologies, the technical effects achieved by adopting this technical solution are as follows: The technical solution in step S4 of this solution accurately retrieves the corresponding version code by using hash values as indexes, combines the repository path association to count the number of code lines in each version, and establishes a path mapping relationship to store the data. This solves the problems of existing technologies, such as difficulty in accurately associating data from multiple versions in the same repository, and the scattered and poorly correlated statistical results. The unique identification characteristic of hash values ensures the accuracy of code retrieval and avoids statistical errors caused by version confusion. Meanwhile, the repository path mapping and associated storage enable clear traceability of code line data in different versions of the same repository. This not only improves the accuracy of code line statistics but also provides structured data support for subsequent cross-version difference analysis and workload quantification, thereby enhancing the usability and management value of the statistical results.
[0024] Secondly, embodiments of the present invention also provide an automatic statistical system for code line differences. The automatic statistical system is used to implement the automatic statistical method in any of the above examples. The automatic statistical system includes: The structure parsing module is used to perform structured parsing of the architecture of a multi-repository project in order to extract the current dictionary database data of each code repository. The data acquisition module is used to input multiple identifier parameters corresponding to multiple versions of the project with differences in code lines to be counted, according to the configuration rules of the target project, and to obtain multiple dictionary database data corresponding to multiple versions of the project using the method in step S1. The differentiation processing module is used to perform source matching comparison on multiple dictionary databases to be statistically analyzed, and to perform differentiated classification processing based on the differences between multiple versions of the project. The quantitative statistics module is used to retrieve code resources corresponding to multiple versions of the project based on multiple dictionary databases to be statistically analyzed. It calculates the quantitative data of code lines corresponding to each unit identifier through preset statistical rules and stores the code line data of different unit identifiers in multiple versions of the project in association. The automation integration module is used to integrate and deploy the statistical processes of steps S1 to S4 on the automated execution platform, and to present and interactively display the cross-version engineering row difference data corresponding to multiple identifier parameters.
[0025] Compared with existing technologies, the technical effects achieved by adopting this technical solution are as follows: it can achieve the technical effects corresponding to any of the above examples, which will not be elaborated here.
[0026] Thirdly, embodiments of the present invention also provide an automatic code line difference counting device, the automatic counting device comprising: The processor, storage medium, and communication interface are included. The storage medium stores computer-executable instructions, and the communication interface is used to establish a data connection with the code storage unit and automated execution platform of the multi-library project. When the processor executes the computer-executable instructions in the storage medium, it implements the automatic statistical method in any of the above examples.
[0027] Compared with existing technologies, the technical effects achieved by adopting this technical solution are as follows: it can achieve the technical effects corresponding to any of the above examples, which will not be elaborated here.
[0028] By adopting the technical solution of the present invention, the following technical effects can be achieved: (1) The present invention provides an automatic statistical method for code line differences. By performing structured parsing and extracting dictionary database data from the multi-database engineering architecture, a multi-repository intelligent identification mechanism is constructed to accurately divide the code boundaries of each repository. This solves the problem that the existing code line statistics system cannot separately count the code lines of each repository, resulting in insufficient data specificity and usability. (2) By inputting the identifier parameter, comparing the source of the multi-version dictionary library and classifying the differences, and combining the preset statistical rules, the code line data corresponding to each unit identifier is quantitatively calculated and stored in association, which improves the accuracy of cross-version code line difference statistics and avoids statistical deviation caused by manual configuration error. (3) The entire statistical process is integrated and deployed on the automated execution platform, realizing the automated execution, standardized presentation and interactive display of cross-version difference statistics, eliminating tedious operations such as manual repetitive configuration and warehouse updates, and improving statistical efficiency and convenience. Attached Figure Description
[0029] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Figure 1 A flowchart illustrating an automatic code line difference calculation method provided in an embodiment of the present invention; Figure 2 A detailed flowchart of an automatic code line difference calculation method provided for a specific embodiment of the present invention; Figure 3This is a schematic diagram of a module for an automatic code line difference statistics system provided in an embodiment of the present invention.
[0030] Explanation of reference numerals in the attached figures: 100. Structure Analysis Module; 200. Data Acquisition Module; 300. Differentiation Processing Module; 400. Quantitative Statistics Module; 500. Automation Integration Module. Detailed Implementation
[0031] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0032] like Figure 1 As shown, this embodiment of the invention provides an automatic method for calculating line-of-code differences. This automatic method is used to calculate line-of-code differences between different versions of a multi-database project. The automatic method includes the following steps: S1: Perform structured analysis on the architecture of the multi-repository project to extract the current dictionary database data of each code repository; S2: According to the configuration rules of the target project, input multiple identifier parameters corresponding to multiple versions of the project with code line differences to be counted, and use the method in step S1 to obtain multiple dictionary database data corresponding to multiple versions of the project. S3: Perform source matching comparison on multiple dictionary databases to be statistically analyzed, and perform differentiated classification processing based on the differences between multiple versions of the project. S4: Based on the data association of multiple dictionary databases to be statistically analyzed, retrieve the code resources corresponding to multiple version projects, calculate the quantitative data of code lines corresponding to each unit identifier through preset statistical rules, and store the code line data of different unit identifiers in multiple version projects in association. S5: Integrate and deploy the statistical processes of steps S1 to S4 on the automated execution platform to standardize and interactively display the cross-version engineering row difference data corresponding to multiple identifier parameters; Among them, multiple version projects include at least two version projects (or three or more version projects).
[0033] Specifically, this solution constructs a multi-repository intelligent identification mechanism by performing structured parsing and extracting dictionary database data from the multi-repository engineering architecture. It accurately delineates the code boundaries of each repository, solving the problem that existing code line statistics systems cannot separately count the code lines of each repository, resulting in insufficient data specificity and usability.
[0034] Furthermore, by inputting identifier parameters, comparing and contrasting source-based data from multiple version dictionaries, and processing differences, combined with preset statistical rules, the code line data corresponding to each unit identifier is quantitatively calculated and stored in association, which improves the accuracy of cross-version code line difference statistics and avoids statistical deviations caused by manual configuration errors.
[0035] In addition, by integrating the entire statistical process into the automated execution platform, the automated execution, standardized presentation, and interactive display of cross-version difference statistics are realized, eliminating tedious operations such as manual repetitive configuration and warehouse updates, and improving statistical efficiency and convenience.
[0036] In one embodiment of the present invention, step S1 specifically includes: An automated statistics script is built based on a pre-defined general standardized interface to count all code repositories of the current version of the project, and the counted dictionary data is stored in a dictionary structure.
[0037] Specifically, this solution builds automated statistical scripts through a pre-defined, standardized interface. On the one hand, it eliminates the reliance on manual configuration in existing statistical methods, enabling automatic and comprehensive statistics of all code repositories in the current version of the project. This avoids omissions or duplications that may occur with manual statistics, thereby improving the efficiency of multi-repository identification and data collection. On the other hand, it uses a dictionary structure to store the extracted data from the current dictionary database, making the information of each code repository structured and clear. This solves the problem of ambiguous code boundary delineation caused by the lack of a multi-repository identification mechanism in existing technologies, further enhancing the relevance and usability of code line statistics.
[0038] In one embodiment of the present invention, the dictionary database data includes: the repository path and hash value of each code repository.
[0039] Specifically, this solution incorporates the repository paths and hash values of each code repository into the dictionary database. First, the repository paths enable precise location of the physical location of each code repository in a multi-repository project, solving the problem that existing technologies cannot clearly define the boundaries of each repository's code. Second, the hash value, as a unique identifier for the repository content, can quickly verify the integrity and uniqueness of the repository code, effectively avoiding statistical distortion caused by duplicate code references or version obfuscation, and ensuring the accuracy of the code line data for each repository.
[0040] In one embodiment of the present invention, the multiple version projects include a first version project and a second version project, and step S3 specifically includes: Determine whether the dictionary database contains both the first repository path corresponding to the first version of the project and the second repository path corresponding to the second version of the project. If both the first and second repository paths exist, then compare the first hash value of the first version project with the second hash value of the second version project. If the first hash value is the same as the second hash value, then neither the first version project nor the second version project will be marked.
[0041] Specifically, in this solution, step S3 first determines whether the repository paths of both the first and second version projects exist simultaneously in the dictionary database. Then, based on the premise that the repository paths exist, the hash values of the two are compared. Finally, versions with the same hash value are not marked, forming an efficient filtering mechanism of "path matching → hash verification → no marking for indistinguishable versions". This solves the problem of repeated processing of indistinguishable repositories in cross-version statistics in existing technologies, thereby ensuring the correspondence of multiple version repositories. The uniqueness of the hash value quickly identifies repositories with completely identical content, avoiding invalid statistical calculations and marking operations, thus improving the efficiency of cross-version difference classification. At the same time, it reduces statistical redundancy caused by interference from indistinguishable data, further enhancing the targeting and efficiency of multi-repository project code line statistics.
[0042] In one embodiment of the present invention, if the first hash value and the second hash value are inconsistent, the first warehouse path and the second warehouse path are marked as update warehouses.
[0043] Specifically, this solution marks the corresponding repository path as the updated repository when the hash values of the first and second versions of the project are inconsistent. By leveraging the unique identifier characteristic of hash values for code content, it achieves accurate and rapid location of repositories that have changed between multiple versions. This solves the problem that existing technologies require checking all repositories one by one to find differences, which is inefficient and prone to omissions. As a result, it improves the targeting and efficiency of cross-version code line statistics.
[0044] In one embodiment of the present invention, if only the first warehouse path exists in the dictionary database, then the first warehouse path is marked as the update warehouse.
[0045] Specifically, this solution marks the first repository path of the first version project as an updated repository when it only exists in the dictionary. This accurately captures the "retained repository in the scenario corresponding to the repository deletion" in multiple version projects, solving the problem in existing technologies that easily overlook the changes in the relationship between the addition and deletion of repositories during version iterations, leading to incomplete difference identification. The marking can be completed quickly by directly judging the existence of the repository path without complex verification, which not only ensures the completeness of difference identification but also clarifies the objects of subsequent statistics, thereby improving the efficiency of cross-version difference classification.
[0046] In one embodiment of the present invention, if only the second warehouse path exists in the dictionary database, the second warehouse path is marked as a newly added warehouse.
[0047] Specifically, this solution marks a newly added repository as such when the dictionary database only contains the second repository path of the second version project. This accurately identifies the differences in "new repository additions" across multiple version iterations, solving the problems of existing technologies being slow to identify new repositories across versions, easily missing entries, and resulting in incomplete statistical data. The existence of the repository path can be used to quickly locate the new repository without complex content comparison, which improves the efficiency of difference identification and ensures the comprehensiveness of the statistical scope.
[0048] In one embodiment of the present invention, step S4 specifically includes: Get the first repository path corresponding to the first version project and the first hash value associated with the first repository path. Use the first hash value as an index to retrieve the first version code corresponding to the first version project. Get the second repository path corresponding to the second version project and the second hash value associated with the second repository path. Use the second hash value as an index to retrieve the second version code corresponding to the second version project. Based on the first repository path value and its associated first hash value, the second repository path value and its associated second hash value, count the number of first lines of code corresponding to the first repository path value and the number of second lines of code corresponding to the second repository path value. Establish a mapping relationship between repository path values between the first and second version projects, and associate and store the number of lines of code corresponding to the same repository path value in different version projects.
[0049] Specifically, the technical solution in step S4 of this plan accurately retrieves the corresponding version code by using hash values as indexes, combines the repository path association to count the number of code lines in each version, and establishes a path mapping relationship to store the data. This solves the problems of existing technologies, such as difficulty in accurately associating data from multiple versions in the same repository, and the fragmented and poorly correlated statistical results. The unique identifier characteristic of hash values ensures the accuracy of code retrieval and avoids statistical errors caused by version confusion. Meanwhile, the repository path mapping and associated storage enable clear traceability of code line data in different versions of the same repository. This not only improves the accuracy of code line statistics but also provides structured data support for subsequent cross-version difference analysis and workload quantification, thereby enhancing the usability and management value of the statistical results.
[0050] Secondly, such as Figure 3As shown, this embodiment of the invention also provides an automatic statistical system for code line differences. The automatic statistical system is used to implement the automatic statistical method in any of the above examples. The automatic statistical system includes a structure parsing module 100, a data acquisition module 200, a difference processing module 300, a quantitative statistical module 400, and an automated integration module 500. Specifically, the structure parsing module 100 is used to perform structured parsing of the architecture of the multi-repository project to extract the current dictionary database data of each code repository. The data acquisition module 200 is used to input multiple identifier parameters corresponding to multiple versions of the project with code line differences to be statistically analyzed according to the configuration rules of the target project, and to obtain multiple dictionary database data to be statistically analyzed for multiple versions of the project using the method in step S1. The differentiation processing module 300 is used to perform source matching comparison on multiple dictionary database data to be statistically analyzed, and to perform differentiation classification processing according to the difference scenarios between multiple versions of the project. The quantitative statistics module 400 is used to retrieve the code resources corresponding to multiple versions of the project based on the data of multiple dictionary databases to be statistically analyzed, calculate the code line quantitative data corresponding to each unit identifier through preset statistical rules, and store the code line data of different unit identifiers in multiple versions of the project. The automated integration module 500 is used to integrate and deploy the statistical process of steps S1 to S4 on the automated execution platform, and to present and interactively display the cross-version project line difference data corresponding to multiple identifier parameters in a standardized manner.
[0051] Thirdly, embodiments of the present invention also provide an automatic statistical device for code line differences. The automatic statistical device includes: a processor, a storage medium, and a communication interface. The storage medium stores computer-executable instructions, and the communication interface is used to establish a data connection with the code storage unit and automated execution platform of a multi-library project. When the processor executes the computer-executable instructions in the storage medium, it implements the automatic statistical method in any of the above examples.
[0052] In a specific embodiment, such as Figure 3 As shown, this embodiment of the invention provides an automatic method for calculating line-of-code differences. This automatic method is used to calculate line-of-code differences between different versions of a multi-repository project (taking two version projects as an example). The automatic method includes the following steps: Click Start, and the automatic statistics system will perform structured analysis of the architecture of the multi-database project to extract the current dictionary database data of each code repository; According to the configuration rules of the target project, input multiple identifier parameters corresponding to the first version project and multiple identifier parameters corresponding to the second version process for the code line differences to be counted, and use the method in step S1 to obtain the first dictionary database data to be counted for the first version project and the second dictionary database data to be counted for the second version project. Perform source matching comparison on the first and second dictionary databases to be analyzed. Then, perform differentiated classification processing based on the differences between the first and second version projects (specific steps are: determine if the dictionary database contains both the first repository path corresponding to the first version project and the second repository path corresponding to the second version project; if both exist, compare the first hash value and the second hash value of the first and second version projects; if they match, do not mark either version project; if they do not match, mark both the first and second repository paths as updated repositories; if only the second repository path exists in the dictionary database, mark it as a newly added repository). Based on the first and second statistical dictionary databases, the first version code corresponding to the first version project and the second version code corresponding to the second version project are retrieved. The code line quantification data corresponding to each unit identifier is calculated through preset statistical rules, and the code line data of different unit identifiers in the first and second version projects are stored in association. The statistical processes of steps S1 to S4 are integrated and deployed on an automated execution platform to standardize and interactively display the cross-version engineering row difference data corresponding to multiple identifier parameters (such as generating comparison tables). This concludes the statistical task.
[0053] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.
Claims
1. An automatic statistical method for code line differences, characterized in that, The automatic statistics method is used to count the differences in lines of code between different versions of a multi-database project. The automatic statistics method includes the following steps: S1: Perform structured analysis on the architecture of the multi-repository project to extract the current dictionary database data of each code repository; S2: According to the configuration rules of the target project, input multiple identifier parameters corresponding to multiple versions of the project with code line differences to be counted, and use the method in step S1 to obtain multiple dictionary database data corresponding to the multiple versions of the project. S3: Perform source matching comparison on the multiple dictionary databases to be counted, and perform differentiated classification processing based on the differences between the multiple version projects; S4: Based on the data association of the multiple dictionary databases to be statistically analyzed, retrieve the code resources corresponding to the multiple version projects, calculate the code line quantification data corresponding to each unit identifier through preset statistical rules, and store the code line data of different unit identifiers in the multiple version projects in association. S5: Integrate and deploy the statistical processes of steps S1 to S4 on the automated execution platform to standardize and interactively display the cross-version engineering line difference data corresponding to the multiple identifier parameters; Among them, the multiple version projects include at least two version projects.
2. The automated statistical method according to claim 1, characterized in that, Step S1 specifically includes: An automated statistics script is built based on a pre-defined general standardized interface to count all code repositories of the current version of the project, and the counted data is stored in a dictionary structure.
3. The automated statistical method according to claim 1, characterized in that, The dictionary database data includes: the repository path and hash value of each code repository.
4. The automated statistical method according to claim 3, characterized in that, The multiple version projects include a first version project and a second version project, and step S3 specifically includes: Determine whether the dictionary database contains both the first repository path corresponding to the first version project and the second repository path corresponding to the second version project; If both the first repository path and the second repository path exist, then compare the first hash value of the first version project with the second hash value of the second version project; If the first hash value is the same as the second hash value, then neither the first version project nor the second version project will be marked.
5. The automated statistical method according to claim 4, characterized in that, If the first hash value is inconsistent with the second hash value, then the first repository path and the second repository path are marked as update repositories.
6. The automated statistical method according to claim 4, characterized in that, If the first warehouse path exists only in the dictionary database, then the first warehouse path is marked as the update warehouse.
7. The automated statistical method according to claim 4, characterized in that, If the second warehouse path exists only in the dictionary database, then the second warehouse path is marked as a newly added warehouse.
8. The automated statistical method according to any one of claims 4-7, characterized in that, Step S4 specifically includes: Obtain the first repository path corresponding to the first version project and the first hash value associated with the first repository path, and use the first hash value as an index to retrieve the first version code corresponding to the first version project; Obtain the second repository path corresponding to the second version project and the second hash value associated with the second repository path. Use the second hash value as an index to retrieve the second version code corresponding to the second version project. Based on the first repository path value and its associated first hash value, the second repository path value and its associated second hash value, the number of first lines of code corresponding to the first repository path value and the number of second lines of code corresponding to the second repository path value are counted. Establish a mapping relationship between the repository path values of the first version project and the second version project, and store the number of lines of code corresponding to the same repository path value in different version projects in a related manner.
9. An automatic statistical system for line-of-code differences, characterized in that, The automatic statistical system is used in the automatic statistical method according to any one of claims 1-8, and the automatic statistical system comprises: The structure parsing module (100) is used to perform structured parsing on the architecture of the multi-library project in order to extract the current dictionary library data of each code repository. The data acquisition module (200) is used to input multiple identifier parameters corresponding to multiple versions of the project with differences in code lines to be counted according to the configuration rules of the target project, and to obtain multiple dictionary database data corresponding to the multiple versions of the project using the method in step S1. The differentiation processing module (300) is used to perform source matching comparison on the multiple dictionary databases to be statistically analyzed, and to perform differentiation classification processing according to the differences between the multiple version projects. The quantitative statistics module (400) is used to retrieve the code resources corresponding to the multiple version projects based on the multiple dictionary databases to be counted, calculate the code line quantitative data corresponding to each unit identifier through preset statistical rules, and store the code line data of different unit identifiers in the multiple version projects in association. An automated integration module (500) is used to integrate and deploy the statistical processes of steps S1 to S4 on an automated execution platform, and to present and interactively display the cross-version engineering line difference data corresponding to the multiple identifier parameters in a standardized manner.
10. An automatic statistical device for line-of-code differences, characterized in that, The automatic statistical device includes: The system includes a processor, a storage medium, and a communication interface. The storage medium stores computer-executable instructions, and the communication interface is used to establish a data connection with the code storage unit and automated execution platform of a multi-library project. When the processor executes the computer-executable instructions in the storage medium, it implements the automatic statistical method according to any one of claims 1-8.