CN114489756A - Code quality evaluation method, device and equipment and readable storage medium - Google Patents

Code quality evaluation method, device and equipment and readable storage medium Download PDF

Info

Publication number
CN114489756A
CN114489756A CN202210111383.4A CN202210111383A CN114489756A CN 114489756 A CN114489756 A CN 114489756A CN 202210111383 A CN202210111383 A CN 202210111383A CN 114489756 A CN114489756 A CN 114489756A
Authority
CN
China
Prior art keywords
code
information
compiling
malicious
quality
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210111383.4A
Other languages
Chinese (zh)
Inventor
王者诗
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech 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 CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202210111383.4A priority Critical patent/CN114489756A/en
Publication of CN114489756A publication Critical patent/CN114489756A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3608Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3616Software analysis for verifying properties of programs using software metrics

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to the technical field of software testing, in particular to a method, a device, equipment and a readable storage medium for evaluating the quality of a code, wherein the method comprises the steps of acquiring code information submitted by a code writer; performing quality analysis on the code information submitted by the code writer to obtain code information meeting the requirements; compiling the code information meeting the requirements to obtain code compiling information; deleting the malice in the code compiling information, then constructing mirror image information based on the code compiling information with the malice code deleted, and storing the mirror image information into a storage database; and carrying out code testing based on the mirror image information in the storage database, and judging whether the codes meet the requirements according to the testing result to obtain the quality evaluation result of the codes. The invention can reduce the errors of manual operation and labor cost by automatically carrying out the processes of code quality analysis, compiling, mirroring and the like, and ensure the quality of code test.

Description

Code quality evaluation method, device, equipment and readable storage medium
Technical Field
The invention relates to the technical field of software testing, in particular to a method, a device and equipment for evaluating the quality of a code and a readable storage medium.
Background
In order to better meet the user requirements and provide more functions, the number of application programs installed and run on the terminal equipment is increased, but for the terminal equipment, if an installation package which is not subjected to the running test in the same environment is directly installed, the system of the terminal equipment is likely to be crashed, and the terminal equipment cannot work. Therefore, the developed code needs to be tested in advance to determine whether the code can be installed and run on the mobile terminal device. The code testing usually needs the submission of records of developers, a large amount of time is consumed to rollback codes, the reason why the mobile phone cannot be started due to the submitted codes is searched, the testing needs to be suspended or terminated, the working efficiency of software testing is reduced, and a method for summarizing and compiling the codes is further needed.
Disclosure of Invention
The present invention aims to provide a method, an apparatus, a device and a readable storage medium for evaluating the quality of a code, so as to improve the above problems. In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
in one aspect, the present application provides a method for evaluating quality of a code, the method including:
acquiring code information submitted by a code writer; obtaining code compiling information according to the code information; comparing the code compiling information with a preset code information table, and marking codes which do not exist in the preset code information table to obtain malicious codes; carrying out malicious value conversion on the malicious codes according to database information called by the malicious codes, and carrying out clustering based on a distance-class algorithm based on the converted malicious values to obtain a clustering center; comparing the converted malicious values by using the clustering center as a malicious value threshold to obtain malicious codes larger than the converted malicious values, and deleting the malicious codes larger than the converted malicious values to obtain code compiling information for deleting the malicious codes; and constructing mirror image information based on the code compiling information of the malicious codes, carrying out code test on the mirror image information, and obtaining a quality evaluation result of the codes according to a test result.
In a second aspect, an embodiment of the present application provides an apparatus for evaluating quality of a code, where the apparatus includes:
the acquisition module is used for acquiring code information submitted by a code writer;
the analysis module is used for obtaining code compiling information according to the code information;
the first comparison module is used for comparing the code compiling information with a preset code information table and marking codes which are not in the preset code information table to obtain malicious codes;
the clustering module is used for converting the malicious codes into malicious values according to database information called by the malicious codes and clustering based on a distance-based algorithm based on the converted malicious values to obtain a clustering center;
the second comparison module is used for comparing the converted malicious value by taking the clustering center as a malicious value threshold to obtain a malicious code larger than the converted malicious value, and deleting the malicious code larger than the converted malicious value to obtain code compiling information for deleting the malicious code;
and the test module is used for constructing mirror image information based on the code compiling information of the malicious codes, carrying out code test on the mirror image information and obtaining a quality evaluation result of the codes according to a test result.
And the first testing unit is used for testing the codes based on the mirror image information in the storage database, judging whether the codes meet the requirements according to the testing result and obtaining the quality evaluation result of the codes.
In a third aspect, an embodiment of the present application provides a quality evaluation apparatus for a code, where the apparatus includes a memory and a processor. The memory is used for storing a computer program; the processor is used for realizing the steps of the quality evaluation method of the codes when executing the computer program.
In a fourth aspect, the present application provides a readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the quality assessment method of the code.
In a fifth aspect, the present application also provides a computer program product or a computer program comprising a computer program for loading and executing the steps of the method for quality assessment of a code as described, when the computer program is executed by a processor.
The invention has the beneficial effects that:
according to the invention, the quality of the code information submitted by the code personnel is automatically analyzed, and the malicious codes are removed, compiled, mirrored and the like to obtain a piece of qualified code mirror image information, and then the code mirror image information is tested, so that the errors of manual operation can be reduced, the labor cost can be reduced, and the quality of the code test can be ensured.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
FIG. 1 is a schematic flow chart of a method for evaluating the quality of a code according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of an apparatus for evaluating quality of a code according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a quality evaluation device for codes according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
As shown in fig. 1, the present embodiment provides a quality evaluation method of a code, which includes step S1, step S2, step S3, step S4, step S5, and step S6.
Step S1, code information submitted by a code writer is obtained;
step S2, obtaining code compiling information according to the code information;
step S3, comparing the code compiling information with a preset code information table, and marking codes which do not exist in the preset code information table to obtain malicious codes;
step S4, carrying out malicious value conversion on the malicious codes according to database information called by the malicious codes, and carrying out clustering based on a distance-class algorithm based on the converted malicious values to obtain a clustering center;
step S5, comparing the converted malicious values by taking the clustering center as a malicious value threshold to obtain malicious codes larger than the converted malicious values, and deleting the malicious codes larger than the converted malicious values to obtain code compiling information for deleting the malicious codes;
and step S6, constructing mirror image information based on the code compiling information of the malicious codes, carrying out code test on the mirror image information, and obtaining a quality evaluation result of the codes according to the test result.
It can be understood that the invention automatically performs quality analysis on the code information submitted by the code personnel, performs the processing of eliminating, compiling, mirroring and the like on malicious codes to obtain a qualified code mirror image information, and then performs the test, thereby reducing the errors of manual operation, reducing the labor cost and ensuring the quality of the code test.
It can be understood that the preset code information table in the above steps is a preset code for calling the database, which can be known, and if there is a code for calling the database that is not in the preset code information table in the test code, the code for calling the database that is not in the preset code information table is proved to be a malicious code, the code for calling the database that is not in the preset code information table can be marked as the malicious code.
It can be understood that, in the above steps, the malicious code is converted into a malicious value according to the database information called by the malicious code, the malicious value is judged and converted according to the core degree of the database called by the malicious code, and the higher the core degree of the database called by the malicious code is, the larger the malicious value is, so that whether a person intentionally embezzles company information can be determined.
The method includes the steps of clustering a plurality of malicious values through a distance-class clustering algorithm, determining a clustering center of the malicious values, taking the clustering center of the malicious values as a threshold, comparing each malicious value with the threshold to obtain a malicious value larger than the threshold, and deleting the malicious values larger than the threshold to protect information in a database from being called so as to protect information security.
In a specific embodiment of the present disclosure, the step S2 includes steps S21 and S22.
Step S21, performing quality analysis on the code information submitted by the code writer to obtain code information meeting the requirements;
and step S22, compiling the code information meeting the requirements to obtain code compiling information.
It can be understood that the invention can prevent errors from occurring during testing and causing waste of a large amount of manpower and material resources by detecting the quality of the code information.
In a specific embodiment of the present disclosure, the step S21 includes a step S211, a step S212, and a step S213.
Step S211, calling the project branch information in the code information submitted by the writer;
step S212, judging whether the number of the project branches of the code information is greater than preset threshold information, if so, analyzing the project branches of the code information according to a language rule corresponding to the preset code information, and judging whether semantic errors occur in the code information;
and step S213, packaging the code information without semantic error to obtain code information meeting the requirement.
It can be understood that the invention judges whether the code information has redundant branches by judging whether the item score number of the code information is greater than the threshold value, if so, the code information represents that a code error occurs, and analyzes the semantic information of the code, deletes the code information with the semantic error, and obtains the code information meeting the requirements.
In a specific embodiment of the present disclosure, the step S22 includes a step S221 and a step S222.
Step S221, generating a keyword based on the code information meeting the requirement, and sending the keyword to a storage database for version number retrieval to obtain the version number of the code information meeting the requirement;
step S222, determining a compiling method according to the version number of the code information, and automatically compiling the code to obtain code compiling information.
It can be understood that the invention can classify the key words of the codes written by a plurality of people and then compile the codes according to different versions, thereby reducing the possibility of compiling errors.
In a specific embodiment of the present disclosure, the step S222 includes a step S2221 and a step S2222.
Step S2221, judging whether the version numbers of the code information are the same version, if so, directly calling a compiling rule of the version to compile to obtain a compiling result;
step S2222, if the version numbers of the code information are different versions, converting the code information of the different versions into the same version which is the most original in the code information of the different versions, and calling the compiling rules of the same version which is the most original in the code information of the different versions to respectively compile, so as to obtain compiling results.
It can be understood that the invention obtains a uniform compiling result by performing classification compiling on the versions of the code information, thereby reducing the risk of testing errors caused by differences of the versions during testing.
In a specific embodiment of the present disclosure, the step S6 includes steps S61 and S62.
Step S61, calling the mirror image information, and backing up the mirror image information to obtain mirror image backup information;
and step S62, printing a preset time label and a preset test purpose label on the mirror image backup information, and sending the mirror image backup information to a backup database for classified storage.
It can be understood that the invention records each test information by backing up and labeling the mirror image information in the database, and can determine the reason of non-compliance in each test.
In a specific embodiment of the present disclosure, the step S6 includes a step S63, a step S64, and a step S65.
Step S63, sending the mirror image information to a code test module for code running test to obtain a test result of code running;
step S64, if the test result of the code running is successful, the test result of the code running is marked as green and sent to the communication equipment of the code writer;
and step S65, if the test result of the code operation is operation failure, marking the specific position of the code with operation failure as red, and sending the specific position of the code with operation failure to the communication equipment of the code writer.
It can be understood that the invention can quickly find out the reason and modify the reason by marking the test result and directly sending the failure information to the code writer.
Example 2
As shown in fig. 2, the present embodiment provides an apparatus for generating a test case snapshot, which includes an obtaining module 701, an analyzing module 702, a first comparing module 703, a clustering module 704, a second comparing module 705, and a testing module 706.
An obtaining module 701, configured to obtain code information submitted by a code writer;
an analysis module 702, configured to obtain code compiling information according to the code information;
a first comparison module 703, configured to compare the code compiling information with a preset code information table, and mark codes that are not in the preset code information table to obtain a malicious code;
the clustering module 704 is used for converting the malicious code into a malicious value according to the database information called by the malicious code, and clustering based on a distance-class algorithm based on the converted malicious value to obtain a clustering center;
a second comparison module 705, configured to compare the converted malicious value with the cluster center as a malicious value threshold to obtain a malicious code greater than the converted malicious value, and delete the malicious code greater than the converted malicious value to obtain code compiling information for deleting the malicious code;
the testing module 706 is configured to construct mirror image information based on the code compiling information of the malicious code, perform code testing on the mirror image information, and obtain a quality evaluation result of the code according to a testing result.
In a specific embodiment of the present disclosure, the analysis module 702 includes an analysis unit 7021 and a compiling unit 7022.
An analyzing unit 7021, configured to perform quality analysis on the code information submitted by the code writer to obtain code information meeting requirements;
and a compiling unit 7022, configured to compile the code information meeting the requirement to obtain code compiling information.
In a specific embodiment of the present disclosure, the analysis unit 7021 includes a first calling sub-unit 70211, a first determining sub-unit 70212, and a first processing sub-unit 70213.
A first calling subunit 70211, configured to call the item branch information in the code information submitted by the writer;
a first determining subunit 70212, configured to determine whether the number of project branches of the code information is greater than preset threshold information, and if the number of project branches of the code information is greater than the preset threshold information, analyze the project branch information of the code information according to a language rule corresponding to preset code information, and determine whether a semantic error occurs in the code information;
the first processing subunit 70213 is configured to pack the code information without semantic error, so as to obtain code information that meets the requirement.
In a specific embodiment of the present disclosure, the compiling unit 7022 includes a second processing sub-unit 70221 and a third processing sub-unit 70222.
A second processing subunit 70221, configured to generate a keyword based on the code information meeting the requirement, and send the keyword to a storage database to perform version number retrieval, so as to obtain a version number of the code information meeting the requirement;
and a third processing subunit 70222, configured to determine a compiling method according to the version number of the code information, and perform automatic compiling on the code to obtain code compiling information.
In a specific embodiment of the present disclosure, the third processing subunit 70222 includes a second judging subunit 702221 and a third judging subunit 702222.
A second determining subunit 702221, configured to determine whether the version numbers of the code information are the same version, and if the version numbers of the code information are the same version, directly invoke the compiling rule of the version to compile, so as to obtain a compiling result;
a third determining subunit 702222, configured to, if the version number of the code information is a different version, convert the code information of the different version into the same version that is the most original in the code information of the different version, and call the compiling rules of the same version that is the most original in the code information of the different version to perform compiling, respectively, so as to obtain a compiling result.
In a specific embodiment of the present disclosure, the testing module 706 includes a second calling subunit 7061 and a first saving subunit 7062.
A second calling subunit 7061, configured to call the mirror image information, and backup the mirror image information to obtain mirror image backup information;
the first saving subunit 7062 is configured to print a preset time label and a preset test use label on the mirror image backup information, and send the mirror image backup information to the backup database for classified storage.
In a specific embodiment of the present disclosure, the testing module 706 includes a first testing subunit 7063, a first sending subunit 7064, and a second sending subunit 7065.
The first testing subunit 7063 is configured to send the mirror image information in the storage database to a code testing module, and perform a code running test to obtain a test result of code running;
the first sending subunit 7064 is configured to mark the test result of the code operation as green if the test result of the code operation is successful, and send the test result of the code operation to the communication device of the code writer;
a second sending subunit 7065, configured to mark, if the test result of the code operation is an operation failure, a specific position of the code that has failed to operate as red, and send the specific position of the code that has failed to operate to the communication device of the code writer.
It should be noted that, regarding the apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated herein.
Example 3
Corresponding to the above method embodiments, the embodiments of the present disclosure also provide a quality evaluation device of a code, and the quality evaluation device of a code described below and the quality evaluation method of a code described above may be referred to in correspondence with each other.
Fig. 3 is a block diagram illustrating a quality assessment apparatus 800 for code in accordance with an exemplary embodiment. As shown in fig. 3, the quality evaluation apparatus 800 of the code may include: a processor 801, a memory 802. The quality assessment apparatus 800 of the code may also include one or more of a multimedia component 803, an input/output (I/O) interface 804, and a communication component 805.
The processor 801 is configured to control the overall operation of the quality evaluation apparatus 800 of the code, so as to complete all or part of the steps in the quality evaluation method of the code. The memory 802 is used to store various types of data to support the operation of the quality assessment device 800 of the code, which data may include, for example, instructions for any application or method operating on the quality assessment device 800 of the code, as well as application-related data such as contact data, transceived messages, pictures, audio, video, and so forth. The Memory 802 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The multimedia components 803 may include screen and audio components. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 802 or transmitted through the communication component 805. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 804 provides an interface between the processor 801 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the quality evaluation device 800 of the code and other devices. Wireless communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination of one or more of them, so that the corresponding communication component 805 may include: Wi-Fi module, bluetooth module, NFC module.
In an exemplary embodiment, the code quality evaluation Device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components, for performing one of the above-mentioned code quality evaluation methods.
In another exemplary embodiment, there is also provided a computer readable storage medium including program instructions which, when executed by a processor, implement the steps of the quality assessment method of code described above. For example, the computer readable storage medium may be the above-mentioned memory 802 including program instructions executable by the processor 801 of the quality evaluation apparatus 800 of the code to perform the above-mentioned quality evaluation method of the code.
Example 4
Corresponding to the above method embodiment, the embodiment of the present disclosure further provides a readable storage medium, and a readable storage medium described below and a quality evaluation method of a code described above may be referred to correspondingly.
A readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method for quality assessment of a code of the above-mentioned method embodiment.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.
Example 5
Based on the same principle as the method provided by the embodiment of the present application, the embodiment of the present application also provides a computer program product or a computer program, which includes computer instructions, and the computer instructions are stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method for evaluating the quality of the code provided in any of the alternative embodiments of the present application.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
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 claims.

Claims (17)

1. A method for evaluating the quality of a code, comprising:
acquiring code information submitted by a code writer;
obtaining code compiling information according to the code information;
comparing the code compiling information with a preset code information table, and marking codes which do not exist in the preset code information table to obtain malicious codes;
carrying out malicious value conversion on the malicious codes according to database information called by the malicious codes, and carrying out clustering based on a distance-class algorithm based on the converted malicious values to obtain a clustering center;
comparing the converted malicious values by using the clustering center as a malicious value threshold to obtain malicious codes larger than the converted malicious values, and deleting the malicious codes larger than the converted malicious values to obtain code compiling information for deleting the malicious codes;
and constructing mirror image information based on the code compiling information of the malicious code, carrying out code test on the mirror image information, and obtaining a quality evaluation result of the code according to a test result.
2. The method for evaluating the quality of a code according to claim 1, wherein the obtaining code compilation information according to the code information comprises:
performing quality analysis on the code information submitted by the code writer to obtain code information meeting the requirements;
and compiling the code information meeting the requirements to obtain code compiling information.
3. The method for evaluating the quality of the code according to claim 2, wherein the step of analyzing the quality of the code information submitted by the code writer to obtain code information meeting the requirements comprises the following steps:
calling the project branch information in the code information submitted by the writer;
judging whether the number of the project branches of the code information is greater than preset threshold information, if so, analyzing the project branches of the code information according to a language rule corresponding to the preset code information, and judging whether semantic errors occur in the code information;
and packaging the code information without semantic errors to obtain code information meeting the requirements.
4. The method for evaluating the quality of the code according to claim 2, wherein compiling the code information meeting the requirement to obtain code compiling information comprises:
generating a keyword based on the code information meeting the requirements, and sending the keyword to a storage database for version number retrieval to obtain the version number of the code information meeting the requirements;
and determining a compiling method according to the version number of the code information, and automatically compiling the code to obtain code compiling information.
5. The method for evaluating the quality of the code according to claim 4, wherein the step of determining a compiling method according to the version number of the code information and automatically compiling the code to obtain the code compiling information comprises:
judging whether the version numbers of the code information are the same version, if so, directly calling a compiling rule of the version for compiling to obtain a compiling result;
if the version number of the code information is different versions, converting the code information of the different versions into the same version which is the most original in the code information of the different versions, and calling the compiling rules of the same version which is the most original in the code information of the different versions to respectively compile to obtain compiling results.
6. The method for evaluating the quality of the code according to claim 1, wherein after the constructing the mirror information based on the code compiling information of the malicious code, the method further comprises:
calling the mirror image information, and backing up the mirror image information to obtain mirror image backup information;
and printing a preset time label and a preset test purpose label on the mirror image backup information, and sending the mirror image backup information to a backup database for classified storage.
7. The method for evaluating the quality of a code according to claim 1, wherein the code test is performed on the mirror image information, and a quality evaluation result of the code is obtained according to a test result, including;
sending the mirror image information to a code testing module, and carrying out code operation testing to obtain a testing result of code operation;
if the test result of the code operation is successful, marking the test result of the code operation as green and sending the green test result to the communication equipment of the code writer;
and if the test result of the code operation is operation failure, marking the specific position of the code with the operation failure as red, and sending the specific position of the code with the operation failure to the communication equipment of the code writer.
8. An apparatus for evaluating the quality of a code, comprising:
the acquisition module is used for acquiring code information submitted by a code writer;
the analysis module is used for obtaining code compiling information according to the code information;
the first comparison module is used for comparing the code compiling information with a preset code information table and marking codes which do not exist in the preset code information table to obtain malicious codes;
the clustering module is used for carrying out malicious value transformation on the malicious codes according to database information called by the malicious codes and carrying out clustering based on a distance-class algorithm based on the transformed malicious values to obtain a clustering center;
the second comparison module is used for comparing the converted malicious value by taking the clustering center as a malicious value threshold to obtain a malicious code larger than the converted malicious value, and deleting the malicious code larger than the converted malicious value to obtain code compiling information for deleting the malicious code;
and the test module is used for constructing mirror image information based on the code compiling information of the malicious codes, carrying out code test on the mirror image information and obtaining a quality evaluation result of the codes according to a test result.
9. The apparatus for quality assessment of code according to claim 8, wherein said analysis module comprises:
the analysis unit is used for carrying out quality analysis on the code information submitted by the code writer to obtain code information meeting the requirements;
and the compiling unit is used for compiling the code information meeting the requirements to obtain code compiling information.
10. The apparatus for evaluating quality of a code according to claim 9, wherein said analyzing unit includes:
the first calling subunit is used for calling the project branch information in the code information submitted by the writer;
the first judging subunit is configured to judge whether the number of the item branches of the code information is greater than preset threshold information, and if the number of the item branches of the code information is greater than the preset threshold information, analyze the item branch information of the code information according to a language rule corresponding to the preset code information, and judge whether the code information has a semantic error;
and the first processing subunit is used for packaging the code information without semantic error to obtain code information meeting the requirement.
11. The apparatus for evaluating quality of code according to claim 9, wherein said compiling unit includes:
the second processing subunit is used for generating a keyword based on the code information meeting the requirements, and sending the keyword to a storage database for version number retrieval to obtain the version number of the code information meeting the requirements;
and the third processing subunit is used for determining a compiling method according to the version number of the code information and automatically compiling the code to obtain code compiling information.
12. The method of claim 11, wherein the third processing subunit comprises:
the second judging subunit is used for judging whether the version numbers of the code information are the same version, and if the version numbers of the code information are the same version, directly calling a compiling rule of the version to compile to obtain a compiling result;
and the third judging subunit is used for converting the code information of different versions into the same most original version in the code information of different versions and calling the compiling rules of the same most original version in the code information of different versions to respectively compile so as to obtain a compiling result if the version number of the code information is different versions.
13. The apparatus for quality assessment of code according to claim 8, wherein said test module comprises:
the second calling subunit is used for calling the mirror image information and backing up the mirror image information to obtain mirror image backup information;
and the first storage subunit is used for printing a preset time label and a preset test purpose label on the mirror image backup information and sending the mirror image backup information to the backup database for classified storage.
14. The apparatus for quality assessment of code according to claim 8, wherein said test module further comprises;
the first testing subunit is used for sending the mirror image information in the storage database to a code testing module, and carrying out code operation testing to obtain a code operation testing result;
the first sending subunit is used for marking the test result of the code running as green if the test result of the code running is successful, and sending the test result of the code running to the communication equipment of the code writer;
and the second sending subunit is used for marking the specific position of the code with the operation failure as red if the test result of the code operation is the operation failure, and sending the specific position of the code with the operation failure to the communication equipment of the code writer.
15. A quality evaluation apparatus of a code, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the method for quality assessment of code according to any one of claims 1 to 8 when executing said computer program.
16. A readable storage medium, characterized by: the readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the method for quality assessment of a code according to any one of claims 1 to 8.
17. A computer program product, characterized in that the computer program product comprises a computer program for loading and executing the steps of the method for quality assessment of a code according to any of claims 1-8 when executed by a processor.
CN202210111383.4A 2022-01-29 2022-01-29 Code quality evaluation method, device and equipment and readable storage medium Pending CN114489756A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210111383.4A CN114489756A (en) 2022-01-29 2022-01-29 Code quality evaluation method, device and equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210111383.4A CN114489756A (en) 2022-01-29 2022-01-29 Code quality evaluation method, device and equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN114489756A true CN114489756A (en) 2022-05-13

Family

ID=81479070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210111383.4A Pending CN114489756A (en) 2022-01-29 2022-01-29 Code quality evaluation method, device and equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114489756A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190080445A (en) * 2017-12-28 2019-07-08 숭실대학교산학협력단 Whitelist construction method for analyzing malicious code, computer readable medium and device for performing the method
CN111061488A (en) * 2019-12-18 2020-04-24 深圳前海环融联易信息科技服务有限公司 Method and device for detecting quality of front-end code, computer equipment and storage medium
CN111339531A (en) * 2020-02-24 2020-06-26 南开大学 Malicious code detection method and device, storage medium and electronic equipment
CN112269594A (en) * 2020-10-30 2021-01-26 北京首都在线科技股份有限公司 Project code quality evaluation method, device, equipment and storage medium
CN113742730A (en) * 2021-11-04 2021-12-03 北京生泰尔科技股份有限公司 Malicious code detection method, system and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190080445A (en) * 2017-12-28 2019-07-08 숭실대학교산학협력단 Whitelist construction method for analyzing malicious code, computer readable medium and device for performing the method
CN111061488A (en) * 2019-12-18 2020-04-24 深圳前海环融联易信息科技服务有限公司 Method and device for detecting quality of front-end code, computer equipment and storage medium
CN111339531A (en) * 2020-02-24 2020-06-26 南开大学 Malicious code detection method and device, storage medium and electronic equipment
CN112269594A (en) * 2020-10-30 2021-01-26 北京首都在线科技股份有限公司 Project code quality evaluation method, device, equipment and storage medium
CN113742730A (en) * 2021-11-04 2021-12-03 北京生泰尔科技股份有限公司 Malicious code detection method, system and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN110413506B (en) Test case recommendation method, device, equipment and storage medium
CN110688307B (en) JavaScript code detection method, device, equipment and storage medium
CN110209684A (en) Tracking, device, system and the medium of database D DL change operation
CN113326247B (en) Cloud data migration method and device and electronic equipment
CN109872230B (en) Test method and device of financial data analysis system, medium and electronic equipment
CN114238948A (en) Application program detection method and device, electronic equipment and storage medium
CN112650670A (en) Application testing method, device, system, electronic equipment and storage medium
CN112688966A (en) Webshell detection method, device, medium and equipment
CN112559489A (en) Block chain supervision method and equipment based on cross-chain and storage medium
CN114610608A (en) Test case processing method and device, electronic equipment and storage medium
CN113869789A (en) Risk monitoring method and device, computer equipment and storage medium
CN112241362A (en) Test method, test device, server and storage medium
CN112650673A (en) Method and device for creating test case in transaction tracking system and electronic equipment
CN108111328B (en) Exception handling method and device
CN113609008A (en) Test result analysis method and device and electronic equipment
CN110688305B (en) Test environment synchronization method, device, medium and electronic equipment
CN111258562A (en) Java code quality inspection method, device, equipment and storage medium
CN114489756A (en) Code quality evaluation method, device and equipment and readable storage medium
CN110716866A (en) Code quality scanning method and device, computer equipment and storage medium
CN113672512A (en) Code inspection rule generating method, code inspection method, device and medium
CN113900956A (en) Test case generation method and device, computer equipment and storage medium
CN115145623A (en) White box monitoring method, device, equipment and storage medium of software business system
CN114116471A (en) Automatic code scanning method, system, electronic equipment and storage medium
CN113805861A (en) Code generation method based on machine learning, code editing system and storage medium
CN112948478A (en) Link-based code analysis 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