CN114691194A - Code statistical method and system - Google Patents

Code statistical method and system Download PDF

Info

Publication number
CN114691194A
CN114691194A CN202210410625.XA CN202210410625A CN114691194A CN 114691194 A CN114691194 A CN 114691194A CN 202210410625 A CN202210410625 A CN 202210410625A CN 114691194 A CN114691194 A CN 114691194A
Authority
CN
China
Prior art keywords
code
submission
counted
counting
remark
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210410625.XA
Other languages
Chinese (zh)
Inventor
徐猛
曹戎格
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BDstar Intelligent and Connected Vehicle Technology Co Ltd
Original Assignee
BDstar Intelligent and Connected Vehicle Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BDstar Intelligent and Connected Vehicle Technology Co Ltd filed Critical BDstar Intelligent and Connected Vehicle Technology Co Ltd
Priority to CN202210410625.XA priority Critical patent/CN114691194A/en
Publication of CN114691194A publication Critical patent/CN114691194A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/77Software metrics

Abstract

The invention provides a code statistical method and a system, comprising the following steps: acquiring a code to be counted; the code to be counted comprises a plurality of code segments; adding submission remarks for each code segment of the code to be counted; the submission remarks comprise submission types and belonged items; determining a code statistical condition; the code statistical conditions comprise start-stop time and project names; and traversing the codes to be counted, and counting the code segments meeting the code counting conditions to obtain a counting result. The invention solves the technical problem that the contribution of an engineer to a project cannot be rapidly, objectively and comprehensively counted in the prior art.

Description

Code statistical method and system
Technical Field
The present invention relates to the field of code statistics, and in particular, to a code statistics method and system.
Background
A project is usually developed by multiple persons, each module is usually developed and maintained by multiple persons, the number of effective codes of each engineer in the project is counted, and the work result of each engineer can be displayed. Project managers can consult such statistical data to assess work. Engineers can understand their own code quality and encoding habits to make adjustments and improvements. Thus, as projects continue to expand, data statistics for project code become increasingly important.
At present, most software companies use version management tools, but the code management tools cannot rapidly, objectively and comprehensively acquire statistical information written by each engineer of source codes, and particularly discriminate the source codes, the basic codes, copied codes and code line number changes caused by code format changes. With the continuous expansion of projects, no comprehensive and objective operation statistical data exists, the process and the trend of the project growth cannot be intuitively reflected, the submitted quantity of each developer or the project code growth cannot be roughly counted, and the contribution of the developer to the reality of the project cannot be evaluated.
Disclosure of Invention
In view of the above, the present invention provides a code statistical method and system to alleviate the technical problem existing in the prior art that the contribution of engineers to projects cannot be rapidly, objectively and comprehensively counted.
In a first aspect, an embodiment of the present invention provides a variety of code statistics methods, including: acquiring a code to be counted; the code to be counted comprises a plurality of code segments; adding submission remarks for each code segment of the code to be counted respectively; the submission remarks comprise submission types and items to which the submission remarks belong; determining a code statistical condition; the code statistical conditions comprise start and stop time and project names; and traversing the code to be counted, and counting the code segments meeting the code counting conditions to obtain a counting result.
Further, before traversing the code to be counted, the method further includes: determining a remark submitting rule; the submission remark rule comprises a submission type and a project to which the submission remark rule belongs; detecting whether the remarks meet the remark submission rule; and if so, storing the code to be counted in the distributed version control system.
Further, traversing the code to be counted, and counting the code segments meeting the code counting condition to obtain a counting result, including: and traversing the submission records of the distributed version control system, and counting the code segments meeting the code counting conditions in the submission records to obtain a counting result.
Further, the submitting the remarks further comprises: submitting a description; the method further comprises the following steps: and generating a statistical report based on the submission description and the statistical result.
In a second aspect, an embodiment of the present invention further provides a code statistics system, including: the system comprises an acquisition module, a remarking module, a determination module and a statistic module; the acquisition module is used for acquiring a code to be counted; the code to be counted comprises a plurality of code segments; the remarking module is used for respectively adding submission remarks to each code segment of the code to be counted; the submission remarks comprise submission types and belonged items; the determining module is used for determining a code statistical condition; the code statistical conditions comprise start-stop time and project names; and the counting module is used for traversing the code to be counted and counting the code segments meeting the code counting conditions to obtain a counting result.
Further, the system further comprises: a detection module to: determining a remark submitting rule; the submission remark rule comprises a submission type and a project to which the submission remark rule belongs; detecting whether the remarks meet the remark submission rule; and if so, storing the code to be counted in the distributed version control system.
Further, the statistics module is further configured to: and traversing the submission records of the distributed version control system, and counting the code segments meeting the code counting conditions in the submission records to obtain a counting result.
Further, the submitting the remarks further comprises: submitting a description; the statistics module is further configured to: and generating a statistical report based on the submission description and the statistical result.
In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method according to the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable medium having a non-volatile program code executable by a processor, where the program code causes the processor to execute the method described in the first aspect.
The invention provides a code statistical method and a system, comprising the following steps: acquiring a code to be counted; adding submission remarks for each code segment of the code to be counted; determining a code statistical condition; and traversing the codes to be counted, and counting the code segments meeting the code counting conditions to obtain a counting result. The invention adds remarks to the codes to be counted and counts the codes to be counted according to the code counting conditions in a mode of adding remarks to the codes to be counted, can accurately count the number of code lines written by an engineer, avoids miscalculation of the number of code lines caused by uploading source codes, code format change and the like, and relieves the technical problem that the contribution of the engineer to projects cannot be rapidly, objectively and comprehensively counted in the prior art.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a code statistical method according to an embodiment of the present invention;
FIG. 2 is a diagram of a code statistics system according to an embodiment of the present invention;
fig. 3 is a schematic diagram of another code statistics system according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
FIG. 1 is a flow chart of a method for code statistics provided according to an embodiment of the present invention. As shown in fig. 1, the method specifically includes the following steps:
step S102, acquiring a code to be counted; the code to be counted comprises a plurality of code segments.
Step S104, adding submission remarks for each code segment of the code to be counted; the submission remarks include the submission type and the item to which it belongs.
Optionally, submitting the remark further comprises: and (6) submitting a description.
Step S106, determining code statistical conditions; the code statistical conditions include start and end times and project names.
Optionally, the code statistical conditions further include optional conditions, such as engineer names, function development, BUG solving, reconstruction, and the like.
And step S108, traversing the code to be counted, and counting the code segments meeting the code counting condition to obtain a counting result.
Optionally, the method provided in the embodiment of the present invention further includes: and generating a statistical report based on the submission description and the statistical result.
The invention provides a code statistical method, which is characterized in that a remark mode is added to a code to be counted, the code to be counted is counted according to a code statistical condition, the number of code lines written by an engineer can be accurately counted, the change of the number of code lines caused by uploading source codes, code format change and the like is avoided by error counting, and the technical problem that the contribution of the engineer to a project cannot be quickly, objectively and comprehensively counted in the prior art is solved.
Optionally, the method provided in the embodiment of the present invention further includes, before step S108, a detection step, specifically, determining a rule for submitting remarks; the submission remark rule comprises a submission type and a project to which the submission type belongs; detecting whether the remarks meet the remark submission rule; if yes, the code to be counted is stored in a distributed version control system (GIT).
Optionally, in the method provided in the embodiment of the present invention, step S108 further includes: and traversing the submission records of the distributed version control system, and counting the code segments meeting the code counting conditions in the submission records to obtain a counting result.
The following illustrates the application steps of the method provided by the embodiment of the present invention.
Step S1: setting a code submission remark rule; the specific rules are (submission type: item: belonging item: this submission description), for example, the submission records of the modified BUG5 and the BUG6 are [ fix: bugID ═ 5]:3AH:1, and the repaired BUG 5: the problem of screen flashing;
step S2: submitting remark rules to be updated to the GIT version management system configuration;
step S3: an engineer writes codes;
step S4: the engineer prepares a commit code, adds a commit remark (e.g., [ fix: bugID 5, bugID 6: 3AH:1, bug fixed 5); submitting a code;
step S5: the GIT version management system detects whether the submitted remarks meet remark rules;
step S6: the step of submitting the remarks to accord with the remark rule is skipped to step S7; the step S4 is skipped to when the submitted remark does not accord with the remark rule, and the remark is submitted again;
step S7: storing the code and remarks in the GIT;
step S8: setting code statistical conditions, including: start time, end time, project name, engineer name (optional condition), function development (optional condition), solution BUG (optional condition), reconstruction (optional condition), etc.;
step S9: according to the conditions of the starting time, the ending time and the project name, traversing all the GIT warehouse code submission records of the project and storing the submission records meeting the conditions;
step S10: then, by combining with the submission records stored by traversing the optional conditions, adding the added codes and the number of modified code lines in the submission records which meet the conditions to generate a personal statistical report;
for example, the code statistical line of the BUG1001 is modified in step S11; step S12 is the code statistical line of some function development 103; or entire project information reports such as: the statistical line of the whole project function development code is shown in step S13, and the statistical line of the whole project solution BUG is shown in step S14;
step S11: traversing all the stored submission records, wherein the remark information in the submission records is FIX: adding codes in all submitted records of the BUG1001, and adding the number of modified code lines to generate a statistical report for modifying the BUG 1001;
step S12, traversing all the stored submission records, and setting the remark information in the submission records to be Feat: 103 adding codes in all submitted records of 103, adding the modified code line numbers to generate a statistical report of the modified BUG 1001;
step S13, traversing all the stored submission records, adding codes to all the submission records containing Feat, and adding the number of modified code lines to generate a function opening statistical report of the whole project;
step S14, traversing all the stored submission records, adding codes to all the submission records of which the remark information in the submission records contains BUG, and adding the number of modified code lines to generate a debugg statistical report of the whole project;
as can be seen from the above description, the embodiments of the present invention provide a code statistical method, in which by setting a code submission rule, according to a submission type (e.g., init, source, ref, flat, fix, docs, style, replay, perf, test, build, restore, and the like) in a submission remark, a number of code lines written by an engineer himself is accurately counted, and a change in the number of code lines caused by uploading a source code, changing a code format, building a base code of a warehouse for the first time and the like is avoided through miscalculation; meanwhile, multi-dimensional data such as function development, DUG modification, code reconstruction and the like can be counted in a more detailed manner according to the categories.
Example two:
fig. 2 is a schematic diagram of a code statistics system according to an embodiment of the present invention. As shown in fig. 2, the system includes: the system comprises an acquisition module 10, a remark module 20, a determination module 30 and a statistic module 40.
Specifically, the obtaining module 10 is configured to obtain a code to be counted; the code to be counted comprises a plurality of code segments.
A remarking module 20, configured to add a submission remark to each code segment of the code to be counted; the submission remarks include the submission type and the item to which it belongs. Optionally, submitting the remark further comprises: and (6) submitting a description.
A determining module 30, configured to determine a code statistical condition; the code statistical conditions include start and end times and project names.
Optionally, the code statistical conditions further include optional conditions, such as engineer names, function development, BUG solving, reconstruction, and the like.
And the counting module 40 is used for traversing the codes to be counted and counting the code segments meeting the code counting conditions to obtain a counting result.
The invention provides a code statistical system, which can accurately count the number of code lines compiled by an engineer by adding remarks to a code to be counted and counting the code to be counted according to a code statistical condition in a mode of adding remarks to the code to be counted, so that the change of the number of code lines caused by uploading source codes, code format change and the like due to error counting is avoided, and the technical problem that the contribution of the engineer to a project cannot be quickly, objectively and comprehensively counted in the prior art is solved.
Optionally, fig. 3 is a schematic diagram of another code statistics system provided in an embodiment of the present invention. As shown in fig. 3, the system further includes: a detection module 50 for: determining a remark submitting rule; the submission remark rule comprises a submission type and a project to which the submission type belongs; detecting whether the remarks meet the remark submission rule; and if so, storing the code to be counted in the distributed version control system.
Optionally, in an embodiment of the present invention, the statistical module 40 is further configured to: and traversing the submission records of the distributed version control system, and counting the code segments meeting the code counting conditions in the submission records to obtain a counting result.
Optionally, in an embodiment of the present invention, the statistical module 40 is further configured to: and generating a statistical report based on the submission description and the statistical result.
The embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and when the processor executes the computer program, the steps of the method in the first embodiment are implemented.
Embodiments of the present invention further provide a computer-readable medium having a non-volatile program code executable by a processor, where the program code causes the processor to execute the method in the first embodiment.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for code statistics, comprising:
acquiring a code to be counted; the code to be counted comprises a plurality of code segments;
adding submission remarks to each code segment of the code to be counted respectively; the submission remarks comprise submission types and belonged items;
determining a code statistical condition; the code statistical conditions comprise start and stop time and project names;
and traversing the code to be counted, and counting the code segments meeting the code counting conditions to obtain a counting result.
2. The method of claim 1, wherein prior to traversing the code to be counted, the method further comprises:
determining a remark submitting rule; the submission remark rule comprises a submission type and a project to which the submission remark rule belongs;
detecting whether the remarks meet the remark submission rule;
and if so, storing the code to be counted in the distributed version control system.
3. The method of claim 2, wherein traversing the code to be counted and counting code segments meeting the statistical condition of the code to obtain a statistical result comprises:
and traversing the submission records of the distributed version control system, and counting the code segments meeting the code counting conditions in the submission records to obtain a counting result.
4. The method of claim 1, wherein said submitting a remark further comprises: submitting a description; the method further comprises the following steps: and generating a statistical report based on the submission description and the statistical result.
5. A code statistics system, comprising: the system comprises an acquisition module, a remarking module, a determination module and a statistic module; wherein the content of the first and second substances,
the acquisition module is used for acquiring a code to be counted; the code to be counted comprises a plurality of code segments;
the remarking module is used for respectively adding submission remarks for each code segment of the code to be counted; the submission remarks comprise submission types and belonged items;
the determining module is used for determining a code statistical condition; the code statistical conditions comprise start and stop time and project names;
and the counting module is used for traversing the code to be counted and counting the code segments meeting the code counting conditions to obtain a counting result.
6. The system of claim 5, further comprising: a detection module to:
determining a remark submitting rule; the submission remark rule comprises a submission type and a project to which the submission remark rule belongs;
detecting whether the remarks meet the remark submission rule;
and if so, storing the code to be counted in the distributed version control system.
7. The system of claim 6, wherein the statistics module is further configured to: and traversing the submission records of the distributed version control system, and counting the code segments meeting the code counting conditions in the submission records to obtain a counting result.
8. The system of claim 5, wherein said submitting a remark further comprises: submitting a description; the statistics module is further configured to: and generating a statistical report based on the submission description and the statistical result.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method of any of the preceding claims 1 to 4 are implemented when the computer program is executed by the processor.
10. A computer-readable medium having non-volatile program code executable by a processor, wherein the program code causes the processor to perform the method of any of claims 1-4.
CN202210410625.XA 2022-04-19 2022-04-19 Code statistical method and system Pending CN114691194A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210410625.XA CN114691194A (en) 2022-04-19 2022-04-19 Code statistical method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210410625.XA CN114691194A (en) 2022-04-19 2022-04-19 Code statistical method and system

Publications (1)

Publication Number Publication Date
CN114691194A true CN114691194A (en) 2022-07-01

Family

ID=82143754

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210410625.XA Pending CN114691194A (en) 2022-04-19 2022-04-19 Code statistical method and system

Country Status (1)

Country Link
CN (1) CN114691194A (en)

Similar Documents

Publication Publication Date Title
US7571069B1 (en) Data assurance workflow derivation and execution
KR101513110B1 (en) Data quality tracking by determining metric values for child nodes and a parent node
CN110287052B (en) Root cause task determination method and device for abnormal task
CN109271321B (en) Method and device for counting contribution code number
EP2557503B1 (en) Application performance measurement and reporting
WO2020186810A1 (en) Regression test case determining method and apparatus, computer device, and storage medium
US20160292068A1 (en) Code coverage rate determination method and system
US20070234305A1 (en) Tracing errors in software
CN113127347B (en) Interface testing method, device, equipment and readable storage medium
CN110537170B (en) Method, system and computer readable storage device for analyzing large scale data processing jobs
US7231634B2 (en) Method for determining scope and cause of memory corruption
CN114490375A (en) Method, device and equipment for testing performance of application program and storage medium
JP2005301859A (en) Code search program and device
CN111367529A (en) Code contribution statistical method and device
US5826104A (en) Batch program status via tape data set information for dynamically determining the real time status of a batch program running in a main frame computer system
CN107330031B (en) Data storage method and device and electronic equipment
CN114691194A (en) Code statistical method and system
CN111352610A (en) Interface return value modification method and device, electronic equipment and storage medium
JP2006294019A (en) Generic software requirement analyzer
CN111400128B (en) Log management method and device, computer equipment and storage medium
CN112416417A (en) Code amount statistical method and device, electronic equipment and storage medium
US8195604B2 (en) System and method for verifying IMS databases on a mainframe computer
US20080256229A1 (en) Detecting Machine Utilization Activity
CN111158746B (en) Method and device for acquiring call relationship
CN114880713A (en) User behavior analysis method, device, equipment and medium based on data link

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination