CN109508204B - Front-end code quality detection method and device - Google Patents

Front-end code quality detection method and device Download PDF

Info

Publication number
CN109508204B
CN109508204B CN201811363465.8A CN201811363465A CN109508204B CN 109508204 B CN109508204 B CN 109508204B CN 201811363465 A CN201811363465 A CN 201811363465A CN 109508204 B CN109508204 B CN 109508204B
Authority
CN
China
Prior art keywords
database
code
test
feedback information
terminal
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
CN201811363465.8A
Other languages
Chinese (zh)
Other versions
CN109508204A (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.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric 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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN201811363465.8A priority Critical patent/CN109508204B/en
Publication of CN109508204A publication Critical patent/CN109508204A/en
Application granted granted Critical
Publication of CN109508204B publication Critical patent/CN109508204B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method and a device for detecting the quality of a front-end code, which are used for testing the front-end code for multiple times.

Description

Front-end code quality detection method and device
Technical Field
The invention relates to the technical field of code detection, in particular to a front-end code quality detection method and device.
Background
With the development of internet technology, the web era is subjected to multiple upgrades, the position of the front-end technology is gradually improved, various technologies and frameworks of the front end are more and more abundant, in the process of project development, the experience and code style styles of developers in a front-end development team are different and lack of a uniform standard, the condition causes that codes of the whole project are difficult to read, the later maintenance is not facilitated, and the quality test of the front-end codes is more and more important.
There is no clear method and apparatus for front-end code quality detection in the existing market, the existing technology is basically suitable for detecting various mainstream coding technologies, there is no targeted quality detection standard, basically, the detection method is matched according to language codes, or one detection method is suitable for multiple language codes, there are many detection methods and many technical languages, for example, there are existing detection technologies of unit test, integration test, system test, confirmation test and acceptance test, which will cause confusion and non-standard, and the workload of code quality detection is getting bigger and bigger, there is an urgent need for a method and apparatus for setting front-end code quality detection, which improves the standardization of code quality detection and the development efficiency of front-end developers.
Disclosure of Invention
Aiming at the problems, the front-end code quality detection method aims to perform systematic quality detection on the written codes of front-end workers, improve the later maintenance and reading of project development, improve the working efficiency of the project developers, unify the front-end code quality detection method, and achieve the advantages of standardization and strong pertinence.
The invention realizes the purpose through the following technical scheme:
a front-end code quality detection method, comprising:
performing matching analysis according to frame data used by a front-end development project in a terminal frame, identifying a frame used by a developer, performing scanning detection on a front-end code file, performing comparison test with frame file data of a terminal device, detecting whether a related frame file is lacked and the file name is not standard, detecting an unqualified file name and automatically identifying and archiving the lacked file in a notFile database;
the terminal equipment detects a notFile database, if the data terminal equipment returns feedback information 101, a front-end developer is prompted to modify the frame file, no data exists in the notFile database, the terminal returns the feedback information 100, the test frame passes, next-step testing is carried out, the information is fed back 101, the front-end developer carries out corresponding modification according to the notFile database, and after the modification is finished, the front-end developer submits the feedback information again and continues to return the testing until the terminal returns a result 100;
performing automatic detection, analysis and matching on the front-end code coding format specifications of all code files according to the regular expression, detecting unqualified codes, automatically labeling, and storing in a notNorm database;
the terminal equipment detects the notNorm database, if the feedback information 201 returned by the data terminal equipment exists, a front-end developer is prompted to modify the code specification, no data exists in the notNorm database, the terminal returns the feedback information 200, the test code specification passes, next-step testing is carried out, the feedback information 201 is fed back, the front-end developer carries out corresponding modification according to the notNorm database, the test code specification is submitted again after modification is finished, the test code specification is returned continuously until the terminal returns the result 200, and next-step testing is carried out;
automatically detecting, analyzing and matching the code repetition rate of all front-end codes according to the regular expression to obtain more repeated codes, performing regular matching on the matched repeated codes by a function method, and storing detection data in a repeat database;
the terminal equipment detects a repeat database, if the data terminal equipment returns feedback information 301, a front-end developer is prompted to perform code optimization, codes are packaged, the code amount is reduced, no data exists in the repeat database, the terminal returns the feedback information 300, the code optimization is passed, next-step testing is performed, the information is fed back 301, the front-end developer performs corresponding modification according to the repeat database, the code optimization testing is continued to be submitted again after the modification is completed, and the next-step testing is performed until the terminal returns a result 300;
running a front-end code by the device, automatically testing whether an error report file exists in the running process, and storing error report contents in an error database;
the method comprises the steps that a terminal device detects an error database, if a data terminal device returns feedback information 401, a front-end developer is prompted to modify and report errors, no data exists in the error database, the terminal returns the feedback information 400, no error prompt is given when a code runs, the test is passed, next-step testing is carried out, the feedback information 401 is fed back, the front-end developer carries out modification according to error reporting information stored in the error database, the code is submitted again after modification, the code is returned again to run and error reporting test is carried out until the terminal returns a result 400, and next-step testing is carried out;
according to the page effect display picture input by a tester at the terminal equipment, carrying out automatic code operation test, and storing a test effect substandard module in a notpage database;
the method comprises the steps that a terminal device detects a notpage database, if a feedback result 501 is returned by the terminal device, a front-end developer is prompted that the display effect of some page modules does not reach the standard, the page modules are modified, no data exists in the notpage database, the terminal returns feedback information 500, the display effect of a code running page is matched with the input effect, the test is passed, the next test is carried out, the information 501 is fed back, the front-end developer carries out modification according to unqualified page information stored in the notpage database, the returned page effect test is submitted again after the modification is finished, and the next test is carried out until the terminal returns the result 500;
according to the functional requirements of each module input by a tester in the terminal equipment, code operation automatic detection is carried out, and the test function is stored in a notFunction database in a way of not conforming to the module;
the terminal equipment detects the notFunction database, if the data terminal equipment returns a feedback result 601, the front-end developer is prompted that the display effect of some function modules does not reach the standard and carries out modification, no data exists in the notFunction database, the terminal returns feedback information 600, the function effect of the code running page is matched with the input effect, the test is passed, the next test is carried out, the information 601 is fed back, the front-end developer carries out modification according to the information of unqualified function modules stored in the notFunction database, the return test is submitted again after the modification is finished, and the test is finished until the terminal returns the result 600.
As a further optimization, the notfile database is a file unqualified database, the notNorm database is a code format non-standard database, the repeat database is a code repeating database, the error database is an error reporting database, the notpage database is a page display unqualified database, and the notFunction database is a function unqualified database.
Another aspect of the present invention provides a front-end code quality detection apparatus, including:
the code acquisition module to be detected is used for acquiring the uploaded front-end code file;
the code detection rule acquisition module is used for acquiring a detection rule matched with the code of the current code file;
the code scanning module is used for scanning the codes to be detected by using a code detection rule to obtain a code scanning result;
and the code detection result determining module is used for determining a code detection result according to the code scanning result.
As a further optimization, the detection rules correspond to at least two detection rules that match each other.
The invention has the beneficial effects that:
the invention relates to a method and a device for detecting the quality of a front-end code, which are mainly used for testing the front-end code for many times.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the embodiments or the drawings needed to be practical in the prior art description, and obviously, the drawings in the following description are only some embodiments of the embodiments, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic diagram of a front-end code quality detection method provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
As shown in fig. 1, a front-end code quality detection method of the present invention includes:
performing matching analysis according to frame data used by a front-end development project in a terminal frame, identifying a frame used by a developer, performing scanning detection on a front-end code file, performing comparison test with frame file data of a terminal device, detecting whether a related frame file is lacked and the file name is not standard, detecting an unqualified file name and automatically identifying and archiving the lacked file in a notFile database;
the terminal equipment detects a notFile database, if the data terminal equipment returns feedback information 101, a front-end developer is prompted to modify the frame file, no data exists in the notFile database, the terminal returns the feedback information 100, the test frame passes, next-step testing is carried out, the information is fed back 101, the front-end developer carries out corresponding modification according to the notFile database, and after the modification is finished, the front-end developer submits the feedback information again and continues to return the testing until the terminal returns a result 100;
performing automatic detection, analysis and matching on the front-end code coding format specifications of all code files according to the regular expression, detecting unqualified codes, automatically labeling, and storing in a notNorm database;
the terminal equipment detects the notNorm database, if the feedback information 201 returned by the data terminal equipment exists, a front-end developer is prompted to modify the code specification, no data exists in the notNorm database, the terminal returns the feedback information 200, the test code specification passes, next-step testing is carried out, the feedback information 201 is fed back, the front-end developer carries out corresponding modification according to the notNorm database, the test code specification is submitted again after modification is finished, the test code specification is returned continuously until the terminal returns the result 200, and next-step testing is carried out;
automatically detecting, analyzing and matching the code repetition rate of all front-end codes according to the regular expression to obtain more repeated codes, performing regular matching on the matched repeated codes by a function method, and storing detection data in a repeat database;
the terminal equipment detects a repeat database, if the data terminal equipment returns feedback information 301, a front-end developer is prompted to perform code optimization, codes are packaged, the code amount is reduced, no data exists in the repeat database, the terminal returns the feedback information 300, the code optimization is passed, next-step testing is performed, the information is fed back 301, the front-end developer performs corresponding modification according to the repeat database, the code optimization testing is continued to be submitted again after the modification is completed, and the next-step testing is performed until the terminal returns a result 300;
running a front-end code by the device, automatically testing whether an error report file exists in the running process, and storing error report contents in an error database;
the method comprises the steps that a terminal device detects an error database, if a data terminal device returns feedback information 401, a front-end developer is prompted to modify and report errors, no data exists in the error database, the terminal returns the feedback information 400, no error prompt is given when a code runs, the test is passed, next-step testing is carried out, the feedback information 401 is fed back, the front-end developer carries out modification according to error reporting information stored in the error database, the code is submitted again after modification, the code is returned again to run and error reporting test is carried out until the terminal returns a result 400, and next-step testing is carried out;
according to the page effect display picture input by a tester at the terminal equipment, carrying out automatic code operation test, and storing a test effect substandard module in a notpage database;
the method comprises the steps that a terminal device detects a notpage database, if a feedback result 501 is returned by the terminal device, a front-end developer is prompted that the display effect of some page modules does not reach the standard, the page modules are modified, no data exists in the notpage database, the terminal returns feedback information 500, the display effect of a code running page is matched with the input effect, the test is passed, the next test is carried out, the information 501 is fed back, the front-end developer carries out modification according to unqualified page information stored in the notpage database, the returned page effect test is submitted again after the modification is finished, and the next test is carried out until the terminal returns the result 500;
according to the functional requirements of each module input by a tester in the terminal equipment, code operation automatic detection is carried out, and the test function is stored in a notFunction database in a way of not conforming to the module;
the terminal equipment detects the notFunction database, if the data terminal equipment returns a feedback result 601, the front-end developer is prompted that the display effect of some function modules does not reach the standard and carries out modification, no data exists in the notFunction database, the terminal returns feedback information 600, the function effect of the code running page is matched with the input effect, the test is passed, the next test is carried out, the information 601 is fed back, the front-end developer carries out modification according to the information of unqualified function modules stored in the notFunction database, the return test is submitted again after the modification is finished, and the test is finished until the terminal returns the result 600.
The notfile database is an unqualified file database, the notNorm database is an unqualified code format database, the repeat database is a code repeat database, the error database is an error reporting database, the notpage database is a failed page display database, and the notFunction database is an unqualified function database.
Another aspect of the present invention provides a front-end code quality detection apparatus, including:
the code acquisition module to be detected is used for acquiring the uploaded front-end code file;
the code detection rule acquisition module is used for acquiring a detection rule matched with the code of the current code file;
the code scanning module is used for scanning the codes to be detected by using a code detection rule to obtain a code scanning result; and the code detection result determining module is used for determining a code detection result according to the code scanning result.
The detection rules correspond to at least two detection rules which are matched with each other. The detection rule is determined according to an application method.
The method needs to test the front-end code for multiple times in the test process to determine the final result, can improve the test efficiency in the code test and save product resources, and the used database is used for storing temporary data which are not qualified temporarily, and deleting the database after the code is qualified, thereby saving resources.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims. It should be noted that the various technical features described in the above embodiments can be combined in any suitable manner without contradiction, and the invention is not described in any way for the possible combinations in order to avoid unnecessary repetition. In addition, any combination of the various embodiments of the present invention is also possible, and the same should be considered as the disclosure of the present invention as long as it does not depart from the spirit of the present invention.

Claims (4)

1. A front-end code quality detection method, comprising:
performing matching analysis according to frame data used by a front-end development project in a terminal frame, identifying a frame used by a developer, performing scanning detection on a front-end code file, performing comparison test with frame file data of a terminal device, detecting whether a related frame file is lacked and the file name is not standard, detecting an unqualified file name and automatically identifying and archiving the lacked file in a notFile database;
the terminal equipment detects a notFile database, if the data terminal equipment returns feedback information 101, a front-end developer is prompted to modify the frame file, no data exists in the notFile database, the terminal returns the feedback information 100, the test frame passes, next-step testing is carried out, the information is fed back 101, the front-end developer carries out corresponding modification according to the notFile database, and after the modification is finished, the front-end developer submits the feedback information again and continues to return the testing until the terminal returns a result 100;
performing automatic detection, analysis and matching on the front-end code coding format specifications of all code files according to the regular expression, detecting unqualified codes, automatically labeling, and storing in a notNorm database;
the terminal equipment detects the notNorm database, if the feedback information 201 returned by the data terminal equipment exists, a front-end developer is prompted to modify the code specification, no data exists in the notNorm database, the terminal returns the feedback information 200, the test code specification passes, next-step testing is carried out, the feedback information 201 is fed back, the front-end developer carries out corresponding modification according to the notNorm database, the test code specification is submitted again after modification is finished, the test code specification is returned continuously until the terminal returns the result 200, and next-step testing is carried out;
automatically detecting and analyzing the code repetition rate of all front-end codes according to the regular expression to obtain repeated codes, performing regular matching on the matched repeated codes by a function method, and storing detection data in a repeat database;
the terminal equipment detects a repeat database, if the data terminal equipment returns feedback information 301, a front-end developer is prompted to perform code optimization, codes are packaged, the code amount is reduced, no data exists in the repeat database, the terminal returns the feedback information 300, the code optimization is passed, next-step testing is performed, the information is fed back 301, the front-end developer performs corresponding modification according to the repeat database, the code optimization testing is continued to be submitted again after the modification is completed, and the next-step testing is performed until the terminal returns a result 300;
running a front-end code by the device, automatically testing whether an error report file exists in the running process, and storing error report contents in an error database;
the method comprises the steps that a terminal device detects an error database, if a data terminal device returns feedback information 401, a front-end developer is prompted to modify and report errors, no data exists in the error database, the terminal returns the feedback information 400, no error prompt is given when a code runs, the test is passed, next-step testing is carried out, the feedback information 401 is fed back, the front-end developer carries out modification according to error reporting information stored in the error database, the code is submitted again after modification, the code is returned again to run and error reporting test is carried out until the terminal returns a result 400, and next-step testing is carried out;
according to the page effect display picture input by a tester at the terminal equipment, carrying out automatic code operation test, and storing a test effect substandard module in a notpage database;
the method comprises the steps that a terminal device detects a notpage database, if a feedback result 501 is returned by the terminal device, a front-end developer is prompted that the display effect of some page modules does not reach the standard, the page modules are modified, no data exists in the notpage database, the terminal returns feedback information 500, the display effect of a code running page is matched with the input effect, the test is passed, the next test is carried out, the information 501 is fed back, the front-end developer carries out modification according to unqualified page information stored in the notpage database, the returned page effect test is submitted again after the modification is finished, and the next test is carried out until the terminal returns the result 500;
according to the functional requirements of each module input by a tester in the terminal equipment, code operation automatic detection is carried out, and the test function is stored in a notFunction database in a way of not conforming to the module;
the terminal equipment detects the notFunction database, if the data terminal equipment returns a feedback result 601, the front-end developer is prompted that the display effect of some function modules does not reach the standard and carries out modification, no data exists in the notFunction database, the terminal returns feedback information 600, the function effect of the code running page is matched with the input effect, the test is passed, the next test is carried out, the information 601 is fed back, the front-end developer carries out modification according to the information of unqualified function modules stored in the notFunction database, the return test is submitted again after the modification is finished, and the test is finished until the terminal returns the result 600.
2. The front-end code quality detection method according to claim 1, wherein the notFile database is a file reject database, the notNorm database is a code format non-specification database, the repeat database is a code duplicate database, the error database is an error report database, the notpage database is a page display reject database, and the notFunction database is a function reject database.
3. The apparatus for detecting the front-end code quality detection method according to claim 1, comprising:
the code acquisition module to be detected is used for acquiring the uploaded front-end code file;
the code detection rule acquisition module is used for acquiring a detection rule matched with the code of the current code file;
the code scanning module is used for scanning the codes to be detected by using a code detection rule to obtain a code scanning result;
and the code detection result determining module is used for determining a code detection result according to the code scanning result.
4. The detecting device for the front-end code quality detecting method according to claim 3, wherein the detecting rules correspond to at least two detecting rules matched with each other.
CN201811363465.8A 2018-11-15 2018-11-15 Front-end code quality detection method and device Active CN109508204B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811363465.8A CN109508204B (en) 2018-11-15 2018-11-15 Front-end code quality detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811363465.8A CN109508204B (en) 2018-11-15 2018-11-15 Front-end code quality detection method and device

Publications (2)

Publication Number Publication Date
CN109508204A CN109508204A (en) 2019-03-22
CN109508204B true CN109508204B (en) 2021-08-06

Family

ID=65748703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811363465.8A Active CN109508204B (en) 2018-11-15 2018-11-15 Front-end code quality detection method and device

Country Status (1)

Country Link
CN (1) CN109508204B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112230889A (en) * 2020-10-16 2021-01-15 湖南皖湘科技有限公司 Method for making software development coding specification
CN112612516B (en) * 2020-12-30 2024-05-03 瑞庭网络技术(上海)有限公司 Code processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105159831A (en) * 2015-08-31 2015-12-16 浪潮集团有限公司 Method for automatically monitoring quality of software code
CN106095446A (en) * 2016-06-14 2016-11-09 深圳市彬讯科技有限公司 Software source code on-line detecting system and detection method thereof
CN106201861A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 The detection method of a kind of code quality and device
CN108205493A (en) * 2016-12-20 2018-06-26 腾讯科技(深圳)有限公司 A kind of code detection method, terminal, server and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9286063B2 (en) * 2012-02-22 2016-03-15 Veracode, Inc. Methods and systems for providing feedback and suggested programming methods

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201861A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 The detection method of a kind of code quality and device
CN105159831A (en) * 2015-08-31 2015-12-16 浪潮集团有限公司 Method for automatically monitoring quality of software code
CN106095446A (en) * 2016-06-14 2016-11-09 深圳市彬讯科技有限公司 Software source code on-line detecting system and detection method thereof
CN108205493A (en) * 2016-12-20 2018-06-26 腾讯科技(深圳)有限公司 A kind of code detection method, terminal, server and system

Also Published As

Publication number Publication date
CN109508204A (en) 2019-03-22

Similar Documents

Publication Publication Date Title
CN108446223B (en) Business scene automatic testing method based on dynamic compilation
CN111324526B (en) Interface test system, method and server
CN106326116B (en) The method and apparatus of product test
CN107370637B (en) Vehicle-mounted ECU communication function automatic test system and method
CN105138461A (en) Interface testing method and device for application program
CN104239219A (en) Software defect positioning technology on-line evaluating and experimenting platform and method based on coverage
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN109508204B (en) Front-end code quality detection method and device
CN106557419B (en) Program testing method and device
CN111400505A (en) Method and system for matching fault elimination scheme of power consumption information acquisition system
CN105335246A (en) Method for automatically repairing program crash defect based on question-answer website analysis
CN114201408A (en) Regression testing method, device, computer equipment and storage medium
CN102043720A (en) Method and device for generating test data automatically by utilizing structured query language (SQL) sentences
CN111966587A (en) Data acquisition method, device and equipment
CN112506757A (en) Automatic test method, system, computer device and medium thereof
CN106933572B (en) Measurement model based on LLVM intermediate representation program slice
CN109815124B (en) MBSE-based interlocking function defect analysis method and device and interlocking system
CN111666193B (en) Method and system for monitoring and testing terminal function based on real-time log analysis
CN107423221A (en) A kind of web applies sustainable method of testing and system
CN110442514A (en) The method that defect repair is recommended is realized based on learning algorithm
CN117421217A (en) Automatic software function test method, system, terminal and medium
CN114661615B (en) FPGA software testing method and device
CN110968518A (en) Analysis method and device for automatic test log file
CN110688823A (en) XML file verification method and device
CN116016270A (en) Switch test management method and device, electronic equipment and storage 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