CN113342687B - Method for detecting code specification in batches - Google Patents

Method for detecting code specification in batches Download PDF

Info

Publication number
CN113342687B
CN113342687B CN202110744631.4A CN202110744631A CN113342687B CN 113342687 B CN113342687 B CN 113342687B CN 202110744631 A CN202110744631 A CN 202110744631A CN 113342687 B CN113342687 B CN 113342687B
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.)
Active
Application number
CN202110744631.4A
Other languages
Chinese (zh)
Other versions
CN113342687A (en
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.)
Ultimate Attainment Interactive Network Technical Concern Co ltd In Xiamen
Original Assignee
Ultimate Attainment Interactive Network Technical Concern Co ltd In Xiamen
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 Ultimate Attainment Interactive Network Technical Concern Co ltd In Xiamen filed Critical Ultimate Attainment Interactive Network Technical Concern Co ltd In Xiamen
Priority to CN202110744631.4A priority Critical patent/CN113342687B/en
Publication of CN113342687A publication Critical patent/CN113342687A/en
Application granted granted Critical
Publication of CN113342687B publication Critical patent/CN113342687B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3628Software debugging of optimised code

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

Method for detecting code specification in batches
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 specification 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 code file name and the upper limit of 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 interface name and the upper limit of 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 number of 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 device can intelligently analyze all data in the Excel configuration file, reads corresponding standard data according to parameters transmitted by a user, namely the name of an actual executor, and then analyzes and compares the code files, so that irregular code files are screened out, code specification batch detection is achieved, code detection efficiency is greatly improved, and a large amount of time and labor are saved.
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 may 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 lines of the code, 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 lines of the interface code, 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 line number of the interface codes, the keywords contained in the interface and the number of the keywords in the interface, finishing the detection; otherwise, the file name of the code file is put into a file pool to be improved.
For example, if the total number of code lines of the code file meets the requirement, i.e. R ≦ Q, then continue to obtain a corresponding upper limit S of line numbers, keywords, and a list L of keyword numbers according to the interface name and the mapping relation pool K, M, N, compare and filter out 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 each keyword is actually used, 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 (1)

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; the sheet content page is named by the name of the actual executor; 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;
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;
s3, obtaining code files, checking whether the code files meet the standard one by one according to the mapping relation pool, if not, putting the code files into a file pool to be improved, and if so, ending the detection;
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 the corresponding mapping in the mapping relation pool H, K, M, N according to the code file name P in the step S31, and obtaining the interface name, 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 accord with the conditions of the interface name, the upper limit of the number of lines of the interface code, the keywords contained in the interface and the number of the keywords in the interface, finishing the detection; otherwise, the file name of the code file is put into a file pool to be improved.
CN202110744631.4A 2021-07-01 2021-07-01 Method for detecting code specification in batches Active CN113342687B (en)

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 CN113342687A (en) 2021-09-03
CN113342687B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
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

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857630B (en) * 2017-11-30 2022-08-02 阿里巴巴集团控股有限公司 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
CN112328506B (en) * 2021-01-06 2021-04-13 北京云真信科技有限公司 Web end code detection system
CN112860245B (en) * 2021-03-10 2022-07-19 厦门极致互动网络技术股份有限公司 Batch remarking method based on Jira system
CN112947911A (en) * 2021-04-26 2021-06-11 平安普惠企业管理有限公司 Interface script generation method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113342687A (en) 2021-09-03

Similar Documents

Publication Publication Date Title
CN110457302B (en) Intelligent structured data cleaning method
CN109740122B (en) Method and device for converting thinking guide graph use case file
CN103218365A (en) SS Table file data processing method and system
CN112926299B (en) Text comparison method, contract review method and auditing system
Ugale et al. Document management system: A notion towards paperless office
CN113342687B (en) Method for detecting code specification in batches
CN103473056A (en) Automatic generation method for telemetering configuration files
CN106325596A (en) Automatic error correction method and system for writing handwriting
CN112364613A (en) Automatic generation system for aircraft test data interpretation report
CN111191429A (en) System and method for automatic filling of data table
CN110837471B (en) Test method, test device, server and storage medium
IL145325A (en) System and method for extracting index key data fields
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
CN109785099B (en) Method and system for automatically processing service data information
CN113435217A (en) Language test processing method and device and electronic equipment
CN112417819A (en) Word document information extraction method and device, electronic equipment and medium
JP2011150603A (en) Category theme phrase extracting device, hierarchical tag attaching device, method, and program, and computer-readable recording medium
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
JP2018181121A (en) Analyzer, analysis program, and analysis method
JP2017117109A (en) Information processing device, information processing system, information retrieval method, and program
Xu et al. Enabling efficient browsing and manipulation of web tables on smartphone

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