CN109753286A - A method of the code method based on functional label counts its call number - Google Patents
A method of the code method based on functional label counts its call number Download PDFInfo
- Publication number
- CN109753286A CN109753286A CN201811629987.8A CN201811629987A CN109753286A CN 109753286 A CN109753286 A CN 109753286A CN 201811629987 A CN201811629987 A CN 201811629987A CN 109753286 A CN109753286 A CN 109753286A
- Authority
- CN
- China
- Prior art keywords
- code
- code method
- item
- call number
- functional label
- 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
Links
Landscapes
- Stored Programmes (AREA)
Abstract
The invention discloses a kind of methods that the code method based on functional label counts its call number, and control authority improves code method quality, belong to software development and software test field, solution needs to count total method number, call number and called mode and annotation etc. manually, the case where being easy to appear statistics leakage, the problems such as to cause comprehensively, quickly to understand the total code method number of project, the call number of each code method and called mode and annotation.The present invention parses the item code obtained, is that each code method in item code adds functional label;Based on all code methods for being added to functional label, obtains the number that is called after paying close attention to code method to it and count, obtain the data of call number Yu corresponding function label phase mapping;The called number of each concern code is ranked up, grade classification is carried out to the code method after sorting out, corresponding permission early warning is determined according to grade.The present invention is used to judge the importance of code method.
Description
Technical field
A method of the code method based on functional label counts its call number, for judging the important of code method
Property, and control authority improves code method quality, belongs to software development and software testing technology field.
Background technique
Code method refers to one group of code block realized with specific function inside software code (referring to item code).
In inventory item code in the case where very huge and multiple person cooperational, project team member judges current each generation comprehensively
The significance level of code method is very difficult, causes when modifying code method, is easy because considering existing code method
Incomplete and write out defective code method, cause great adverse effect in actual use: test man mentions in task
When survey, to the coverage of function after the importance and code method modification due to not knowing modification code, survey not can determine that
The significance level of examination and the manpower of investment.
Items analyzing technology in the prior art, can only analyze the overall structure of project, can not detailed analysis go out item
Purpose method information, annotation information and mode content.
In order to solve problem above, it is necessary first to which functional label is beaten to the code method of project.The function of project is clicked through
Row, which refines to summarize, forms function point, and distinguishes critical function and general function;Then by analysis project code, by all generations
Code method is stored in accurate testing service platform and is saved, and by the platform, gives all code method correlation tags, allows code side
Whether all functional label of method simultaneously is labeled as being important Function Point Method.The analysis method is artificial abstraction function point, and people exists
Accurate test platform beats functional label manually.
In the modification of project Persisting exploitation, by scan item code, parses and count the various dimensions of item code
Data are saved in computer system, and are based on importance by defining some judgment rules come code designation method, and if being divided into
Dry grade;Then according to the importance rate of code method, different grades of modification authority is controlled.Different grades of exploit person
Member, can only modify the code method of corresponding grade, to improve the quality of item code.Simultaneously to different brackets code method
Difference, project team member, according to different importance, put into more manpowers and consider more full when exploitation and test
Face.
The judgement for carrying out code method importance using the above scheme, needs to count total method number, call number manually
With called mode and annotation, the case where being easy to appear statistics leakage, to cause comprehensively, quickly to understand total generation of project
Code method number, the call number of each code method and called mode and annotation.Just personnel and project team is newly added in middle rank
Member is unfamiliar with item code, can not quickly judge the significance level of code method, when modifying code, due to not
It can judge importance, so causing to consider not comprehensive enough, cause aacode defect.
Summary of the invention
Aiming at the problem that the studies above, the code method statistics based on functional label that the purpose of the present invention is to provide a kind of
The method of its call number solves existing analytic method, needs to count total method number, call number and called side manually
Formula and annotation etc. are easy to appear the case where statistics is leaked, to cause the total code method that cannot comprehensively, quickly understand project a
The problems such as number, the call number of each code method and called mode and annotation.
In order to achieve the above object, the present invention adopts the following technical scheme:
A method of the code method based on functional label counts its call number, which is characterized in that including walking as follows
It is rapid:
The item code that step 1, parsing obtain is added based on standard abstraction syntax tree for each code method in item code
Add functional label;
Step 2, based on all code methods for being added to functional label, the number that is called to it is counted, is adjusted
With the data of number and corresponding function label phase mapping.
Further, the specific steps of the step 1 are as follows:
Step 1.1, the store path for obtaining item code, obtain item code according to store path;
Step 1.2, parsing item code obtain each code method, using standard abstraction grammer tree representation item code, obtain
To item code structure, it is based on item code structure, traverses each node of item code structure tree;
Step 1.3 filters out the code side that class node and class node include from each node of item code structure tree
Method node obtains corresponding class name and packet name by way of obtaining attribute in class node, while obtaining corresponding generation
Code method node, and code method title, code method annotation are obtained, and from code method node with < class name, code method
<code method name, code method remaining information>>key-value pair form are stored, remaining method information includes the code method
Corresponding packet name, class name, code method name, code method body, method of calling, the file path at called place, called generation
Code method is invoked at the Nth row number of file in the specific location and code method of file.
Step 1.4 according to item code function is not all that each item code establishes lexicon, automatically analyzes each generation
Relative words in code method annotation extraction lexicon, establish the mapping between vocabulary and functional label, add for each code method
Corresponding function label completes the addition of the functional label of each code method.
Further, the step 1.3 further includes carrying out MD5 algorithm process to code method body using MD5, obtains code side
The MD5 informative abstract of body of laws is compared by the MD5 informative abstract to code method body, fast and accurately to determine code side
Whether method, which has, is modified.
Further, the specific steps of the step 2 are as follows:
Step 2.1, creation include the code method list of all code methods and corresponding functional label;
Step 2.2 counts call number of the code method list in item code, obtain call number with it is right
Answer the data of functional label phase mapping;Specifically: traversal item code structure tree obtains each code method in code method list
Calling node, parsing calls the initial position at the called place of context, code method in node at calling;
By the called code method of context matches at calling, and it is added in the code method invocation list of creation
Accumulative call number obtains the call number and corresponding function label phase mapping of code method by code method invocation list
Data.
The present invention compared with the existing technology, its advantages are shown in:
One, each code method is obtained by the parsing to item code in the present invention, then based on the item code after parsing
Standard abstraction syntax tree is obtained, after parsing by standard abstraction syntax tree, joined the conditional filtering of code method (i.e. based on class
Code method path inside node, code method name and code method body are screened) and MD5 comparison, it can be precisely and fast
The code of the acquisition of speed eligible (i.e. code method body has change, and code method functional label is the vocabulary inside lexicon)
Method and various information, that is, when needing to carry out importance analysis to item code, scanning analysis item code through the invention, energy
Tag along sort, the various information of available project quickly are carried out to each method, i.e. institute's letter in need learns that code method is important
Personnel's (including non-technical personnel) of property, can be apparent from the information of item code, such as code method number, method comprehensively
Annotation, method parameter, method be called number, and binding function label just can determine whether code on the basis of not needing reading code
Significance level, to modification carry out early warning;
Two, the present invention confirms code by combining the called number of code method and the corresponding functional label of code method
The importance of method may be implemented after beating functional label, integration project code point that is, by beating functional label to code method
Amending method and function point are corresponded to, judge coverage by analysis.
Specific embodiment
Below in conjunction with specific embodiment, the invention will be further described.
In order to solve existing analytic method, need to count manually total method number, call number and called mode and
Annotation etc., the case where being easy to appear statistics leakage, thus cause comprehensively, quickly to understand the total code method number of project,
The problems such as call number of each code method and called mode and annotation.It is specific as follows the present invention provides a kind of method:
A method of the code method based on functional label counts its call number, includes the following steps:
The item code that step 1, parsing obtain is added based on standard abstraction syntax tree for each code method in item code
Add functional label;Specific steps are as follows:
Step 1.1, the store path for obtaining item code, obtain item code according to store path;
Step 1.2, parsing item code obtain each code method, using standard abstraction grammer tree representation item code, obtain
To item code structure, it is based on item code structure, traverses each node of item code structure tree;
Step 1.3 filters out the code side that class node and class node include from each node of item code structure tree
Method node obtains corresponding class name and packet name by way of obtaining attribute in class node, while obtaining corresponding generation
Code method node, and code method title, code method annotation are obtained, and from code method node with < class name, code method
<code method name, code method remaining information>>key-value pair form are stored, remaining method information includes the code method
Corresponding packet name, class name, code method name, code method body, method of calling, the file path at called place, called generation
Code method is invoked at the Nth row number of file in the specific location and code method of file.It further include using MD5 to code method body
MD5 algorithm process is carried out, the MD5 informative abstract of code method body is obtained, passes through the MD5 informative abstract pair to code method body
Than being modified fast and accurately to determine whether code method has.
Step 1.4 according to item code function is not all that each item code establishes lexicon, automatically analyzes each generation
Relative words in code method annotation extraction lexicon, establish the mapping between vocabulary and functional label, add for each code method
Corresponding function label completes the addition of the functional label of each code method.
Step 2, based on all code methods for being added to functional label, the number that is called to it is counted, is adjusted
With the data of number and corresponding function label phase mapping.Specific steps are as follows:
Step 2.1, creation include the code method list of all code methods and corresponding functional label;
Step 2.2 counts call number of the code method list in item code, obtain call number with it is right
Answer the data of functional label phase mapping;Specifically: traversal item code structure tree obtains each code method in code method list
Calling node, parsing calls the initial position at the called place of context, code method in node at calling;
By the called code method of context matches at calling, and it is added in the code method invocation list of creation
Accumulative call number obtains the call number and corresponding function label phase mapping of code method by code method invocation list
Data.
Embodiment
Certain announced project (i.e. item code) currently has 10000 code methods, 10 developers, 3 tests
Personnel are responsible for product maintenance.When the next publication window of preplanning, some functions can be modified and realized.Carry out code development it
Before, the method mentioned through the invention, we can obtain the call number and corresponding function of this 10000 code methods
Label, if subsequent A method that need to be to be modified is core methed, needing B method to be modified is inessential method, just according to power
Limit divides, and advanced developer is responsible for the modification of A method, and B method has junior staff;After method is modified, code needs to submit
To code library.For code method operation is submitted, judge whether the code method submitted is core methed, if so, judgement mentions
Whether friendship personnel are senior staff, if it is senior staff, just allow to be submitted to code library.
After code is submitted, project carries out mentioning the survey stage.The method that tester mentions through the invention judges this modification
Which (can realize by code method body) is method have, what significance level and function point be, so that it is determined that test scope
And the reasonable arrangement of resource.
The above is only the representative embodiment in the numerous concrete application ranges of the present invention, to protection scope of the present invention not structure
At any restrictions.It is all using transformation or equivalence replacement and the technical solution that is formed, all fall within rights protection scope of the present invention it
It is interior.
Claims (4)
1. a kind of method that the code method based on functional label counts its call number, which comprises the steps of:
The item code that step 1, parsing obtain is each code method addition function in item code based on standard abstraction syntax tree
It can label;
Step 2, based on all code methods for being added to functional label, the number that is called to it counts, obtain call time
Several data with corresponding function label phase mapping.
2. the method that a kind of code method based on functional label according to claim 1 counts its call number, special
Sign is, the specific steps of the step 1 are as follows:
Step 1.1, the store path for obtaining item code, obtain item code according to store path;
Step 1.2, parsing item code obtain each code method, using standard abstraction grammer tree representation item code, obtain item
Mesh code structure is based on item code structure, traverses each node of item code structure tree;
Step 1.3 filters out the code method section that class node and class node include from each node of item code structure tree
Point obtains corresponding class name and packet name by way of obtaining attribute in class node, while obtaining corresponding code side
Method node, and code method title, code method annotation are obtained, and from code method node with < class name, code method < generation
Code method name, code method remaining information > > key-value pair form are stored, remaining method information includes the code method pair
Packet name, class name, the code method name, code method body, method of calling, the file path at called place, called code answered
Method is invoked at the Nth row number of file in the specific location and code method of file.
Step 1.4 according to item code function is not all that each item code establishes lexicon, automatically analyzes each code side
Relative words in method annotation extraction lexicon, establish the mapping between vocabulary and functional label, correspond to for the addition of each code method
Functional label completes the addition of the functional label of each code method.
3. the method that a kind of code method based on functional label according to claim 2 counts its call number, special
Sign is that the step 1.3 further includes carrying out MD5 algorithm process to code method body using MD5, obtains code method body
MD5 informative abstract is compared by the MD5 informative abstract to code method body, fast and accurately whether to determine code method
Have and is modified.
4. the method that a kind of code method based on functional label according to claim 3 counts its call number, special
Sign is, the specific steps of the step 2 are as follows:
Step 2.1, creation include the code method list of all code methods and corresponding functional label;
Step 2.2 counts call number of the code method list in item code, obtains call number and corresponding function
The data of energy label phase mapping;Specifically: traversal item code structure tree obtains the tune of each code method in code method list
With node, the initial position at the called place of context, code method in node at calling is called in parsing;
By the called code method of context matches at calling, and it is added in the code method invocation list of creation and adds up
Call number obtains the call number of code method and the number of corresponding function label phase mapping by code method invocation list
According to.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811629987.8A CN109753286A (en) | 2018-12-28 | 2018-12-28 | A method of the code method based on functional label counts its call number |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811629987.8A CN109753286A (en) | 2018-12-28 | 2018-12-28 | A method of the code method based on functional label counts its call number |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109753286A true CN109753286A (en) | 2019-05-14 |
Family
ID=66403229
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811629987.8A Pending CN109753286A (en) | 2018-12-28 | 2018-12-28 | A method of the code method based on functional label counts its call number |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109753286A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110399132A (en) * | 2019-06-18 | 2019-11-01 | 平安科技(深圳)有限公司 | Maintaining method, device, computer equipment and the storage medium of item code |
CN110413733A (en) * | 2019-07-23 | 2019-11-05 | 上海易点时空网络有限公司 | Code statistical method and device |
CN110780882A (en) * | 2019-11-08 | 2020-02-11 | 网易(杭州)网络有限公司 | Code file processing method, device and system, electronic equipment and storage medium |
CN112417852A (en) * | 2020-12-07 | 2021-02-26 | 中山大学 | Method and device for judging importance of code segment |
CN113495753A (en) * | 2021-07-06 | 2021-10-12 | 北京百度网讯科技有限公司 | Project label acquisition method and device, electronic equipment and storage medium |
CN113900962A (en) * | 2021-12-10 | 2022-01-07 | 广州易方信息科技股份有限公司 | Code difference detection method and device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101261604A (en) * | 2008-04-09 | 2008-09-10 | 中兴通讯股份有限公司 | Software quality evaluation apparatus and software quality evaluation quantitative analysis method |
US20150278074A1 (en) * | 2014-03-28 | 2015-10-01 | International Business Machines Corporation | Logging code generation and distribution |
CN106970820A (en) * | 2017-04-26 | 2017-07-21 | 腾讯科技(深圳)有限公司 | Code storage method and code storage |
CN107943514A (en) * | 2017-11-01 | 2018-04-20 | 北京大学 | The method for digging and system of core code element in a kind of software document |
-
2018
- 2018-12-28 CN CN201811629987.8A patent/CN109753286A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101261604A (en) * | 2008-04-09 | 2008-09-10 | 中兴通讯股份有限公司 | Software quality evaluation apparatus and software quality evaluation quantitative analysis method |
US20150278074A1 (en) * | 2014-03-28 | 2015-10-01 | International Business Machines Corporation | Logging code generation and distribution |
CN106970820A (en) * | 2017-04-26 | 2017-07-21 | 腾讯科技(深圳)有限公司 | Code storage method and code storage |
CN107943514A (en) * | 2017-11-01 | 2018-04-20 | 北京大学 | The method for digging and system of core code element in a kind of software document |
Non-Patent Citations (2)
Title |
---|
李阵等: "《基于多特征权重分配的源代码搜索优化》", 《计算机应用》 * |
邹天得: "《JavaScript的语法解析与抽象语法树》", 《HTTPS:// WWW.CNBLOGS.COM/VIDERING/ARTICLES/7587042.HTML》 * |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110399132A (en) * | 2019-06-18 | 2019-11-01 | 平安科技(深圳)有限公司 | Maintaining method, device, computer equipment and the storage medium of item code |
CN110399132B (en) * | 2019-06-18 | 2023-12-22 | 平安科技(深圳)有限公司 | Method, device, computer equipment and storage medium for maintaining project codes |
CN110413733A (en) * | 2019-07-23 | 2019-11-05 | 上海易点时空网络有限公司 | Code statistical method and device |
CN110780882A (en) * | 2019-11-08 | 2020-02-11 | 网易(杭州)网络有限公司 | Code file processing method, device and system, electronic equipment and storage medium |
CN110780882B (en) * | 2019-11-08 | 2023-12-01 | 网易(杭州)网络有限公司 | Method, device, system, electronic equipment and storage medium for processing code file |
CN112417852A (en) * | 2020-12-07 | 2021-02-26 | 中山大学 | Method and device for judging importance of code segment |
CN112417852B (en) * | 2020-12-07 | 2022-01-25 | 中山大学 | Method and device for judging importance of code segment |
CN113495753A (en) * | 2021-07-06 | 2021-10-12 | 北京百度网讯科技有限公司 | Project label acquisition method and device, electronic equipment and storage medium |
CN113900962A (en) * | 2021-12-10 | 2022-01-07 | 广州易方信息科技股份有限公司 | Code difference detection method and device |
CN113900962B (en) * | 2021-12-10 | 2022-03-18 | 广州易方信息科技股份有限公司 | Code difference detection method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109753286A (en) | A method of the code method based on functional label counts its call number | |
US10830817B2 (en) | Touchless testing platform | |
Jiang et al. | Co-evolution of infrastructure and source code-an empirical study | |
Sun et al. | An empirical study on real bugs for machine learning programs | |
CN104185840B (en) | It is used for being prioritized the mthods, systems and devices of multiple tests in lasting deployment streamline | |
CN109656615A (en) | A method of permission early warning is carried out based on code method significance level | |
CN108108297A (en) | The method and apparatus of automatic test | |
CN111459799A (en) | Software defect detection model establishing and detecting method and system based on Github | |
Tosun et al. | Ai-based software defect predictors: Applications and benefits in a case study | |
CN106874180A (en) | Detection System And Method Thereof | |
Pascarella et al. | Re-evaluating method-level bug prediction | |
CN106257474A (en) | Air pollution exception location mechanism | |
CN107025170A (en) | For the system and method for the test case augmentation of the automation based on covering designed a model | |
CN102043716A (en) | Automatic software testing method based on business driving | |
US20120297364A1 (en) | Augmented design structure matrix visualizations for software system analysis | |
CN109670306A (en) | Electric power malicious code detecting method, server and system based on artificial intelligence | |
de Oliveira Neto et al. | Full modification coverage through automatic similarity-based test case selection | |
CN110245077A (en) | A kind of response method and equipment of program exception | |
Aversano et al. | Evaluating architecture stability of software projects | |
CN109408385A (en) | A kind of disfigurement discovery method based on mischief rule and classifying feedback | |
CN112153378A (en) | Method and system for testing video auditing capability | |
CN116383833A (en) | Method and device for testing software program code, electronic equipment and storage medium | |
Xu et al. | Multi-Granularity Code Smell Detection using Deep Learning Method based on Abstract Syntax Tree. | |
Corea et al. | A taxonomy of business rule organizing approaches in regard to business process compliance | |
Stringfellow et al. | Comparison of software architecture reverse engineering methods |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190514 |
|
RJ01 | Rejection of invention patent application after publication |