CN113342687A - Method for detecting code specification in batches - Google Patents
Method for detecting code specification in batches Download PDFInfo
- Publication number
- CN113342687A CN113342687A CN202110744631.4A CN202110744631A CN113342687A CN 113342687 A CN113342687 A CN 113342687A CN 202110744631 A CN202110744631 A CN 202110744631A CN 113342687 A CN113342687 A CN 113342687A
- Authority
- CN
- China
- Prior art keywords
- code
- interface
- name
- file
- pool
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3628—Software debugging of optimised code
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a method for detecting code specifications in batches, which comprises the following steps: s1, designing an Excel configuration table, wherein the Excel configuration table comprises a plurality of sheet content pages, and a corresponding code specification is recorded in each sheet content page; s2, loading an Excel configuration table, and creating a plurality of mapping relation pools according to the code specification; and S3, acquiring the code files, checking whether the code files meet the specifications one by one according to the mapping relation pool, if not, putting the code files into the file pool to be improved, and if so, ending the detection. The invention realizes code specification detection in batches by using the Excel configuration file, and greatly improves the code detection efficiency.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method for detecting code specifications in batches.
Background
In the process of project development, different project groups have respective requirements on code specification or coding, and team members need to write codes according to the specification and the requirements so as to read the codes conveniently, but the former coding habits are generally followed in the process of writing the codes for newly-entered team members, so that the code specification is not enough, the requirements of the project groups cannot be met, manual follow-up is needed and guidance opinions are proposed, a large amount of codes need to be read in the follow-up process, a large amount of time and energy are consumed, and the efficiency is low.
Disclosure of Invention
To solve the above problems, the present invention provides a method for batch detection of code specifications.
The invention adopts the following technical scheme:
a method for batch testing code specifications, comprising the steps of:
s1, designing an Excel configuration table, wherein the Excel configuration table comprises a plurality of sheet content pages, and a corresponding code specification is recorded in each sheet content page;
s2, loading an Excel configuration table, and creating a plurality of mapping relation pools according to the code specification;
and S3, acquiring the code files, checking whether the code files meet the specifications one by one according to the mapping relation pool, if not, putting the code files into the file pool to be improved, and if so, ending the detection.
Further, the sheet content page is named by the name of the actual actor.
Furthermore, the code specification comprises a code file name, a code line number upper limit and a plurality of extension specifications taking groups as units, and each set of extension specifications comprises an interface name, an interface code line number upper limit, keywords contained in an interface and the number of keywords in the interface.
Further, the mapping relationship pool includes a relationship mapping pool G of the upper limit of the code file name and the code line number, a relationship mapping pool H of the code file name and the interface name, a relationship mapping pool K of the upper limit of the interface name and the interface code line number, a relationship mapping pool M of the interface name and the keywords contained in the interface, and a relationship mapping pool N of the interface name and the keywords in the interface.
Further, step S3 specifically includes the following steps:
s31, obtaining the mapping of the mapping relation pool G one by one to obtain the name P of the code file and the upper limit Q of the number of code lines, traversing all the code files, positioning the code file with the name P, reading the code file line by line to obtain the number of code lines; if the number of code lines is larger than the upper limit of the number of code lines, the file name of the code file is put into a file pool to be improved; otherwise, continuing to execute the next step;
s32, respectively obtaining corresponding mappings in the mapping relation pool H, K, M, N according to the code file name P in the step S31, and obtaining the upper limit of the interface code line number, the keywords contained in the interface and the number of the keywords in the interface; if all the codes of the code file P meet the conditions of the upper limit of the number of lines of the interface codes, the keywords contained in the interface and the number of the keywords in the interface, ending the detection; otherwise, the file name of the code file is put into a file pool to be improved.
After adopting the technical scheme, compared with the background technology, the invention has the following advantages:
the Excel code detection method and the Excel code detection system can intelligently analyze all data in the Excel configuration file, read corresponding standard data according to parameters transmitted by a user, namely the name of an actual executor, and analyze and compare the code files, so that irregular code files are screened out, thereby realizing batch code detection standard, greatly improving code detection efficiency and saving a large amount of time and labor.
Drawings
FIG. 1 is a flow chart of a method of the present invention;
FIG. 2 is an exemplary diagram of a sheet content page in the embodiment;
fig. 3 is a flowchart of step S3 of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Examples
As shown in fig. 1, a method for batch inspection of code specifications includes the following steps:
s1, designing an Excel configuration table, wherein the Excel configuration table comprises a plurality of sheet content pages, and a corresponding code specification is recorded in each sheet content page;
the sheet content page is named by the name of the actual actor. The code specification comprises a code file name, a code line number upper limit and a plurality of extension specifications taking groups as units, and each extension specification comprises an interface name, an interface code line number upper limit, keywords contained in an interface and the number of the keywords in the interface. The extended specification here can be provided in plural sets as necessary.
For example, as shown in fig. 2, the first row is used for illustration of the columns, and will not be derived, mainly for convenience of reading; the first column is used for the Chinese name of the remark interface, and is mainly convenient for reading; the second column is used for storing English names of the interfaces, and the names are used for creating code files; the third column is used for remarking the upper limit of the number of code lines in the code file; the fourth column to the seventh column form a group, and the group can be used as a unit to expand backwards as required; the fourth column indicates that this interface must be included in the code file; the fifth column represents the upper limit of the code line number of the interface; the sixth column represents the key phrase that the interface must contain, each key word being separated by "|"; the seventh column represents the upper limit of the number of keywords, and corresponds to the sixth column, which is also separated by "|".
S2, loading an Excel configuration table, and creating a plurality of mapping relation pools according to the code specification;
the mapping relation pool comprises a relation mapping pool G of the name of the code file and the upper limit of the number of the code lines, a relation mapping pool H of the name of the code file and the name of the interface, a relation mapping pool K of the name of the interface and the upper limit of the number of the interface code lines, a relation mapping pool M of the name of the interface and the keywords contained in the interface, and a relation mapping pool N of the name of the interface and the number of the keywords in the interface.
And S3, acquiring the code files, checking whether the code files meet the specifications one by one according to the mapping relation pool, if not, putting the code files into the file pool to be improved, and if so, ending the detection.
As shown in fig. 3, step S3 specifically includes the following steps:
s31, obtaining the mapping of the mapping relation pool G one by one to obtain the name P of the code file and the upper limit Q of the number of code lines, traversing all the code files, positioning the code file with the name P, reading the code file line by line to obtain the number of code lines; if the number of code lines is larger than the upper limit of the number of code lines, the file name of the code file is put into a file pool to be improved; otherwise, continuing to execute the next step;
for example, when a code file is input, acquiring the Z-th mapping of a mapping relation pool G to obtain a code file name P and a code line number upper limit Q, traversing all code files, positioning the code file with the file name P, reading the files line by line, putting character strings of each line into an array, filtering lines with empty contents to obtain a total line number R, if R is more than Q, indicating that the total line number of the code exceeds the line number upper limit, and putting the file name of the code file into a file pool to be improved; and then checking whether the current mapping is the last mapping of the mapping relation pool G, if so, finishing the detection, and if not, making Z equal to Z +1 and continuing to acquire the next mapping in the mapping relation pool G.
S32, respectively obtaining corresponding mappings in the mapping relation pool H, K, M, N according to the code file name P in the step S31, and obtaining the upper limit of the interface code line number, the keywords contained in the interface and the number of the keywords in the interface; if all the codes of the code file P meet the conditions of the upper limit of the number of lines of the interface codes, the keywords contained in the interface and the number of the keywords in the interface, ending the detection; otherwise, the file name of the code file is put into a file pool to be improved.
For example, if the total code line number of the code file meets the requirement, that is, R is not greater than Q, then continue to obtain a corresponding line number upper limit S, keyword and keyword number list L according to the interface name and the mapping relation pool K, M, N, compare and filter the content code segment T of the function according to the fixed writing method "funName ═ function () { }" of the interface, determine whether the line number of the code segment T exceeds S, if so, put the file name of the code file into the file pool to be improved, if not, continue traversing the list L, compare the code segment T according to the keywords, count the number of times of actual use of each keyword, determine whether the number of times of use of each keyword does not exceed the upper limit, if so, put the file name of the code file into the file pool to be improved, if not, determine whether the current mapping is the last mapping of the mapping relation pool G, if yes, the detection is finished, if not, Z is made to be Z +1, and the next mapping in the mapping relation pool G is continuously obtained.
Through the scheme, all data in the Excel configuration file can be intelligently analyzed, corresponding standard data are read according to the parameters transmitted by the user, namely the name of the actual executor, then the code file is analyzed and compared, and an irregular code file is selected, so that the code specification is detected in batches, the code detection efficiency is greatly improved, and a large amount of time and labor are saved.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (5)
1. A method for batch testing code specifications, comprising: the method comprises the following steps:
s1, designing an Excel configuration table, wherein the Excel configuration table comprises a plurality of sheet content pages, and a corresponding code specification is recorded in each sheet content page;
s2, loading an Excel configuration table, and creating a plurality of mapping relation pools according to the code specification;
and S3, acquiring the code files, checking whether the code files meet the specifications one by one according to the mapping relation pool, if not, putting the code files into the file pool to be improved, and if so, ending the detection.
2. The method of batch instrumentation code specification according to claim 1, wherein: the sheet content page is named by the name of the actual actor.
3. The method for batch instrumentation of code specifications as claimed in claim 2, wherein: the code specification comprises a code file name, a code line number upper limit and a plurality of extension specifications taking groups as units, and each extension specification comprises an interface name, an interface code line number upper limit, keywords contained in an interface and the number of the keywords in the interface.
4. A method for batch instrumentation of code specifications as claimed in claim 3, wherein: the mapping relation pool comprises a relation mapping pool G of the name of the code file and the upper limit of the number of the code lines, a relation mapping pool H of the name of the code file and the name of the interface, a relation mapping pool K of the name of the interface and the upper limit of the number of the interface code lines, a relation mapping pool M of the name of the interface and the keywords contained in the interface, and a relation mapping pool N of the name of the interface and the number of the keywords in the interface.
5. The method for batch instrumentation of code specifications as set forth in claim 4, wherein: step S3 specifically includes the following steps:
s31, obtaining the mapping of the mapping relation pool G one by one to obtain the name P of the code file and the upper limit Q of the number of code lines, traversing all the code files, positioning the code file with the name P, reading the code file line by line to obtain the number of code lines; if the number of code lines is larger than the upper limit of the number of code lines, the file name of the code file is put into a file pool to be improved; otherwise, continuing to execute the next step;
s32, respectively obtaining corresponding mappings in the mapping relation pool H, K, M, N according to the code file name P in the step S31, and obtaining the upper limit of the interface code line number, the keywords contained in the interface and the number of the keywords in the interface; if all the codes of the code file P meet the conditions of the upper limit of the number of lines of the interface codes, the keywords contained in the interface and the number of the keywords in the interface, ending the detection; otherwise, the file name of the code file is put into a file pool to be improved.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110744631.4A CN113342687B (en) | 2021-07-01 | 2021-07-01 | Method for detecting code specification in batches |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110744631.4A CN113342687B (en) | 2021-07-01 | 2021-07-01 | Method for detecting code specification in batches |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113342687A true CN113342687A (en) | 2021-09-03 |
CN113342687B CN113342687B (en) | 2022-09-09 |
Family
ID=77482037
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110744631.4A Active CN113342687B (en) | 2021-07-01 | 2021-07-01 | Method for detecting code specification in batches |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113342687B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114217828A (en) * | 2021-12-22 | 2022-03-22 | 四川启睿克科技有限公司 | Configuration method, system, device and storage medium of front-end universal code standard library |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108536472A (en) * | 2018-03-13 | 2018-09-14 | 中国银行股份有限公司 | A kind of normative inspection method and device of code |
CN109857630A (en) * | 2017-11-30 | 2019-06-07 | 阿里巴巴集团控股有限公司 | Code detection method, system and equipment |
WO2020225791A1 (en) * | 2019-05-09 | 2020-11-12 | Tata Consultancy Services Limited | Method and system for transforming wireframes to as-is screens with responsive behaviour |
CN112328506A (en) * | 2021-01-06 | 2021-02-05 | 北京云真信科技有限公司 | Web end code detection system |
CN112559354A (en) * | 2020-12-18 | 2021-03-26 | 中国平安财产保险股份有限公司 | Front-end code specification detection method and device, computer equipment and storage medium |
CN112860245A (en) * | 2021-03-10 | 2021-05-28 | 厦门极致互动网络技术股份有限公司 | Batch remarking method based on Jira system |
CN112947911A (en) * | 2021-04-26 | 2021-06-11 | 平安普惠企业管理有限公司 | Interface script generation method, device, equipment and storage medium |
-
2021
- 2021-07-01 CN CN202110744631.4A patent/CN113342687B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109857630A (en) * | 2017-11-30 | 2019-06-07 | 阿里巴巴集团控股有限公司 | Code detection method, system and equipment |
CN108536472A (en) * | 2018-03-13 | 2018-09-14 | 中国银行股份有限公司 | A kind of normative inspection method and device of code |
WO2020225791A1 (en) * | 2019-05-09 | 2020-11-12 | Tata Consultancy Services Limited | Method and system for transforming wireframes to as-is screens with responsive behaviour |
CN112559354A (en) * | 2020-12-18 | 2021-03-26 | 中国平安财产保险股份有限公司 | Front-end code specification detection method and device, computer equipment and storage medium |
CN112328506A (en) * | 2021-01-06 | 2021-02-05 | 北京云真信科技有限公司 | Web end code detection system |
CN112860245A (en) * | 2021-03-10 | 2021-05-28 | 厦门极致互动网络技术股份有限公司 | Batch remarking method based on Jira system |
CN112947911A (en) * | 2021-04-26 | 2021-06-11 | 平安普惠企业管理有限公司 | Interface script generation method, device, equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
陈燕等: "《信息系统集成技术与方法教程》", 31 October 2015, 大连海事大学出版社 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114217828A (en) * | 2021-12-22 | 2022-03-22 | 四川启睿克科技有限公司 | Configuration method, system, device and storage medium of front-end universal code standard library |
Also Published As
Publication number | Publication date |
---|---|
CN113342687B (en) | 2022-09-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Harmon et al. | The index of linguistic diversity: A new quantitative measure of trends in the status of the world's languages | |
CN110457302B (en) | Intelligent structured data cleaning method | |
CN103593352A (en) | Method and device for cleaning mass data | |
CN103593449B (en) | A kind of database resource recovery method and system | |
US10853564B2 (en) | Operation for copied content | |
CN103218365A (en) | SS Table file data processing method and system | |
CN103473056A (en) | Automatic generation method for telemetering configuration files | |
CN112926299B (en) | Text comparison method, contract review method and auditing system | |
CN113342687B (en) | Method for detecting code specification in batches | |
US6457014B1 (en) | System and method for extracting index key data fields | |
CN112364613A (en) | Automatic generation system for aircraft test data interpretation report | |
CN110837471B (en) | Test method, test device, server and storage medium | |
CN111984673B (en) | Fuzzy retrieval method and device for tree structure of power grid electric energy metering system | |
CN114861614A (en) | Method and device for filling data, electronic equipment and medium | |
CN111143450B (en) | Method and device for importing data | |
JP5679400B2 (en) | Category theme phrase extracting device, hierarchical tagging device and method, program, and computer-readable recording medium | |
CN109785099B (en) | Method and system for automatically processing service data information | |
CN114218935B (en) | Entity display method and device in data analysis | |
Firth et al. | Divisions of the United Kingdom House of Commons, from 1992 to 2003 and Beyond | |
CN103176968A (en) | Electronic device and vocabulary information display method thereof | |
CN115545008B (en) | Spectrogram file analyzing method, device, equipment and storage medium | |
CN108304430B (en) | Method for modifying database | |
Xu et al. | Enabling efficient browsing and manipulation of web tables on smartphone | |
JP2017117109A (en) | Information processing device, information processing system, information retrieval method, and program | |
CN116910017A (en) | Database migration method, device, electronic equipment and medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |