CN116991718A - Code scanning method, device, computer equipment and storage medium - Google Patents

Code scanning method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116991718A
CN116991718A CN202310926844.8A CN202310926844A CN116991718A CN 116991718 A CN116991718 A CN 116991718A CN 202310926844 A CN202310926844 A CN 202310926844A CN 116991718 A CN116991718 A CN 116991718A
Authority
CN
China
Prior art keywords
scanning
target
result
scan
item
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
CN202310926844.8A
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.)
China Telecom Technology Innovation Center
China Telecom Corp Ltd
Original Assignee
China Telecom Technology Innovation Center
China Telecom Corp 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 China Telecom Technology Innovation Center, China Telecom Corp Ltd filed Critical China Telecom Technology Innovation Center
Priority to CN202310926844.8A priority Critical patent/CN116991718A/en
Publication of CN116991718A publication Critical patent/CN116991718A/en
Pending legal-status Critical Current

Links

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/3604Software analysis for verifying properties of programs
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The present application relates to the field of artificial intelligence technology, and in particular, to a code scanning method, apparatus, computer device, and storage medium. The method comprises the following steps: scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms; determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results; and determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item. The application can optimize the code scanning analysis efficiency.

Description

Code scanning method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence technology, and in particular, to a code scanning method, apparatus, computer device, and storage medium.
Background
In the process of software development, in order to ensure the code quality and improve the security, a code scanning engine is generally introduced to analyze the source code. The conventional scanning algorithm can generate a corresponding scanning result, but only a single scanning algorithm is relied on, so that the dimension is sometimes insufficient or the coverage area is not wide enough, and the problem of missing report occurs.
At present, the problem of comprehensive coverage of scanning dimension is guaranteed by introducing various scanning algorithms, but the problem of confidence is introduced in another layer. When multiple scanning algorithms diverge from the same scanning item, it is impossible to quickly distinguish which scanning algorithm should be more accurate for the scanning result of the scanning item, and under this condition, the more scanning algorithms are applied, the greater the possibility of false alarm (divergence) from the scanning item.
In the traditional technology, false alarm identification is carried out manually under the condition that false alarm (divergence) occurs to a scanning item, so that the scanning analysis efficiency is lower.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a code scanning method, apparatus, computer device, and storage medium capable of optimizing code scanning analysis efficiency.
In a first aspect, the present application provides a code scanning method, the method comprising:
scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
In one embodiment, determining the target scanning result from the scanning results of each scanning algorithm on the target scanning item according to the scanning accuracy of each scanning algorithm on the target scanning item comprises:
determining the type of a result according to the scanning result of each scanning algorithm on the target scanning item;
for any result type, determining an accuracy weighting result of the result type according to the scanning accuracy of each scanning algorithm corresponding to the result type on the target scanning item;
and determining a target scanning result from the scanning results of the target scanning item by each scanning algorithm according to the accuracy weighted results corresponding to each result type.
In one embodiment, determining the target scan result from the scan results of each scan algorithm on the target scan term according to the accuracy weighted result corresponding to each result type includes:
determining a proportion value among accuracy weighted results corresponding to each result type;
if the ratio value is larger than the first threshold value or smaller than the second threshold value, determining the result type with the highest accuracy weighted result as the target scanning result, wherein the first threshold value is larger than the second threshold value.
In one embodiment, the method further comprises:
If the ratio value is larger than the second threshold value and smaller than the first threshold value, returning each result type to the manual processing module;
and acquiring a manual processing result corresponding to the target scanning item from the manual processing module, and taking the manual processing result as a target scanning result.
In one embodiment, the method further comprises:
and returning the target scanning item and the manual processing result corresponding to the target scanning item to the updating module so as to update each scanning algorithm in the updating module according to the manual processing result.
In one embodiment, the method further comprises:
acquiring historical scanning records of each scanning algorithm on each scanning item;
determining each scanning dimension corresponding to each scanning item and the scanning accuracy of each scanning algorithm to each scanning dimension according to the historical scanning record;
and acquiring the scanning accuracy of each scanning algorithm on the target scanning item from the scanning accuracy of each scanning algorithm on each scanning dimension.
In a second aspect, the present application also provides a code scanning device, the device comprising:
the global scanning module is used for scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
The conflict recording module is used for determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and the result determining module is used for determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
In a third aspect, the present application also provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
In a fifth aspect, the application also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of:
scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
According to the code scanning method, the code scanning device, the computer equipment and the storage medium, a plurality of scanning algorithms are supported to scan simultaneously, global scanning results corresponding to the scanning algorithms are obtained, target scanning items with conflicts between the scanning results are determined according to comparison conditions between the global scanning results, and the difference of the scanning results of the algorithms can be automatically analyzed. Since the scan results corresponding to the target scan item are conflicting (divergent), it is explained that, in all the scan algorithms, the scan results of the scan item by a part of the scan algorithms are correct, and the scan results of the scan item by other part of the scan algorithms are misreported, and if the scan results of each scan algorithm are determined manually, the manual load is increased. According to the application, the scanning results of the target scanning items by the scanning algorithms are comprehensively analyzed, based on the scanning accuracy of the target scanning items by the scanning algorithms, the scanning algorithms are mutually referred, the purpose of automatically judging false alarm results is realized, the target scanning results are determined from the scanning results of the target scanning items by the scanning algorithms, the false alarm results are discarded, the more accurate scanning results are reserved, the scanning algorithms have stronger adaptability, and the code scanning efficiency is improved and the scanning accuracy is ensured by an intelligent automatic identification mode.
Drawings
FIG. 1 is a flow chart of a code scanning method in one embodiment;
FIG. 2 is a flow chart of determining a target scan result in one embodiment;
FIG. 3 is a block diagram of a code scanning system in one embodiment;
FIG. 4 is a block diagram of a code scanner in one embodiment;
fig. 5 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In the process of software development, in order to ensure the code quality and improve the security, a code scanning engine is generally introduced to analyze the source code. The scanning algorithm in the code scanning engine can generate a corresponding scanning result, but only a single scanning algorithm is relied on, so that the dimension is sometimes insufficient, or the coverage is not wide enough, and the problem of missing report can occur.
In the traditional technology, the dimension problem is guaranteed by introducing a plurality of scanning algorithms into a code scanning engine, however, the results of the scanning algorithms are mutually independent and need to be scanned independently, and scanning items with conflicting scanning results need to be processed manually, so that not only is the manual burden increased, but also the scanning efficiency is reduced.
As shown in fig. 1, an embodiment of the present application provides a code scanning method, which may be executed by a computer device, including the steps of:
s101, scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms.
Wherein different scanning algorithms correspond to different scanning rules. It will be appreciated that the types and numbers of scan dimensions corresponding to different scan rules may differ, or that different scan rules may differ with respect to the scan pattern of the same scan dimension.
Specifically, any scan rule may be represented by: (scanning dimensions corresponding to the scanning rule, scanning objects corresponding to the scanning dimensions, and scanning modes corresponding to the scanning dimensions).
Illustratively, each scan dimension may include: code defect multi-language scanning, complexity scanning, repetition rate scanning, code line scanning, code vulnerability scanning, incremental code scanning and other dimensions.
The multi-language scanning refers to a scanning engine adopting a corresponding language according to codes written in different languages, so that a scanning object corresponding to the scanning dimension is a type of the code language. The complexity scan includes a scan of the complexity of the code decision structure, and the code complexity further includes indexes such as inheritance depth, class coupling, number of code lines, and a total maintainable index, so that the scan object corresponding to the scan dimension is the indexes such as inheritance depth, class coupling, number of code lines, and a total maintainable index. The repetition rate scanning includes creating at least one scanned document set, one unscanned document set, performing the repetition rate scanning on documents in the scanned document set and the unscanned document set, and performing the repetition rate scanning on documents inside the unscanned document set. The repetition rate scan refers to a code line repetition rate value between every two code files, so that the scan object corresponding to the scan dimension is each code line. The code line scanning mainly acquires line information in a code file, and the line information comprises at least one of the following information: the total number of lines, the blank number of lines, and the comment number of lines, and therefore, the scan object corresponding to the scan dimension is each code line. The code bug scanning comprises the steps of scanning any one or more of input verification errors, SQL query structure errors and buffer overflow errors, and mainly detecting code bugs or defects, so that scanning objects corresponding to the scanning dimension are input, structure and buffer overflow error objects. The incremental code scanning firstly needs to determine which codes are newly added codes or modified codes in the scanning, and then scans the newly added or modified code files, so that the scanning object corresponding to the scanning dimension is each newly added or modified code.
Further, the global scan result of any one scan algorithm corresponds to the scan rule, and refers to the sum of scan results obtained when the scan algorithm scans each scan object. For example, the scan result corresponding to each scan object may include: (30 th line code, scan result corresponding to 30 th line code in repetition rate scan dimension), (45 th line code, scan result corresponding to 45 th line code in repetition rate scan dimension), (10 th line code, scan result corresponding to 10 th line code in code line scan dimension), (22 nd line code, scan result corresponding to 22 nd line code in code line scan dimension), (I buffer overflow, scan result corresponding to code leak scan dimension), and the like.
S102, determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results.
The scanning item is the scanning object under each scanning dimension. Accordingly, the target scan item may be described by (a scan dimension, a target scan object in the scan dimension), and the number of target scan items is at least one. It will be appreciated that the reason why there is a conflict in the scan results for the same scan item in the same scan dimension is the difference in the scan pattern between the scan algorithms.
S103, determining a target scanning result from the scanning results of the target scanning items by the scanning algorithms according to the scanning accuracy of the target scanning items by the scanning algorithms.
The scanning accuracy of the target scanning item is characterized by the scanning accuracy of the scanning dimension corresponding to the target scanning item; the scanning accuracy of each scanning dimension by any scanning algorithm can be determined by historical scan records.
When determining the target scanning result from the scanning results of each scanning algorithm on the target scanning item, any one of the following two ways may be adopted: in one implementation manner, among the scanning accuracies of each scanning algorithm to the target scanning items, the scanning result of the scanning algorithm with the highest scanning accuracy to the pair of target scanning items can be determined as a target scanning result; in another implementation manner, the decision weight of each scanning algorithm on the target scanning item can be determined according to the scanning accuracy of each scanning algorithm on the target scanning item, and the target scanning result is comprehensively determined according to the decision weight corresponding to each scanning result.
In the code scanning method, the application supports a plurality of scanning algorithms to scan simultaneously, obtains the global scanning results corresponding to the scanning algorithms, determines the target scanning items with conflict among the scanning results according to the comparison condition among the global scanning results, and can automatically analyze the difference of the scanning results of the algorithms. Since the scan results corresponding to the target scan item are conflicting (divergent), it is explained that, in all the scan algorithms, the scan results of the scan item by a part of the scan algorithms are correct, and the scan results of the scan item by other part of the scan algorithms are misreported, and if the scan results of each scan algorithm are determined manually, the manual load is increased. According to the application, the scanning results of the target scanning items by the scanning algorithms are comprehensively analyzed, based on the scanning accuracy of the target scanning items by the scanning algorithms, the scanning algorithms are mutually referred, the purpose of automatically judging false alarm results is realized, the target scanning results are determined from the scanning results of the target scanning items by the scanning algorithms, the false alarm results are discarded, the more accurate scanning results are reserved, the scanning algorithms have stronger adaptability, and the code scanning efficiency is improved and the scanning accuracy is ensured by an intelligent automatic identification mode.
In one embodiment, the method, in determining the scanning accuracy of each scanning algorithm for a target scan item, comprises: acquiring historical scanning records of each scanning algorithm on each scanning item; determining each scanning dimension corresponding to each scanning item and the scanning accuracy of each scanning algorithm to each scanning dimension according to the historical scanning record; and acquiring the scanning accuracy of each scanning algorithm on the target scanning item from the scanning accuracy of each scanning algorithm on each scanning dimension.
The history scan record of any scan algorithm for each scan item may be a history scan result of the scan algorithm for each scan item in a preset history period, as in the above example, the scan item is described by (a scan dimension, a scan object in the scan dimension). It is understood that each scan dimension corresponding to each scan term refers to the sum of the scan dimensions corresponding to all scan terms.
Specifically, for any scanning algorithm, the scanning accuracy of the scanning algorithm on each scanning dimension is obtained through statistics of historical scanning records, and the statistical analysis process can be executed by an accuracy analysis model corresponding to the scanning algorithm. In this embodiment, after determining the target scan item, determining a target scan dimension corresponding to the target scan item, and determining the scan accuracy of each scan algorithm for the target scan dimension from the scan accuracy of each scan algorithm for each scan dimension, as the scan accuracy of each scan algorithm for the target scan item.
In the embodiment, the scanning accuracy of each scanning dimension is obtained through the historical scanning record by automatic analysis, manual participation is not needed, and the intellectualization and automation of the algorithm are improved.
As shown in fig. 2, the present embodiment provides an alternative way of determining the target scan result from the scan results of the target scan items by each scan algorithm, that is, a way of refining S103, according to the scan accuracy of the target scan items by each scan algorithm. The specific implementation process can comprise the following steps:
s201, determining the result type according to the scanning result of each scanning algorithm on the target scanning item.
For example, the scan result of the partial scan algorithm in each scan algorithm on the target scan item is I, and the scan result of the other partial scan algorithm on the target scan item is II, and the result types include I type and II type.
S202, aiming at any result type, determining an accuracy weighting result of the result type according to the scanning accuracy of each scanning algorithm corresponding to the result type on the target scanning item.
Exemplary, each of the scanning algorithms corresponding to the type I is { scanning algorithm a, scanning algorithm C }, and each of the scanning algorithms corresponding to the type II is { scanning algorithm B, scanning algorithm D }, respectively.
Further, the scanning accuracy of the scanning algorithm A on the target scanning item is 80%, the scanning accuracy of the scanning algorithm C on the target scanning item is 85%, the scanning accuracy of the scanning algorithm C on the target scanning item is 70%, and the scanning accuracy of the scanning algorithm D on the target scanning item is 90%.
The accuracy weighting result corresponding to the type I is: 80%. Weight value of algorithm a + 85%. Weight value of algorithm C; the accuracy weighting result corresponding to type II is: 70% weight value of algorithm B +90% weight value of algorithm D. The weight value of the scanning algorithm a, the weight value of the scanning algorithm C, the weight value of the scanning algorithm B, and the weight value of the scanning algorithm D may be preset values.
S203, determining a target scanning result from the scanning results of the target scanning item by each scanning algorithm according to the accuracy weighting result corresponding to each result type.
Specifically, determining a ratio value between accuracy weighted results corresponding to each result type; if the ratio value is larger than the first threshold value or smaller than the second threshold value, determining the result type with the highest accuracy weighted result as the target scanning result.
Wherein the first threshold is greater than the second threshold.
Illustratively, a ratio value between accuracy weighted results is obtained according to the accuracy weighted results corresponding to the type I and the accuracy weighted results corresponding to the type II; if the ratio value is greater than the first threshold value or less than the second threshold value, the difference between the accuracy weighting result corresponding to the type I and the accuracy weighting result corresponding to the type II is larger, which specifically includes the following two cases:
(1) And if the proportion value is larger than the first threshold value, the accuracy weighting result corresponding to the I type is larger than the accuracy weighting result corresponding to the I type, and the difference value is larger.
(2) If the ratio value is smaller than the second threshold value, the accuracy weighting result corresponding to the I type is smaller than the accuracy weighting result corresponding to the I type, and the difference value is larger.
The result type with the highest accuracy weighted result is determined, and it can be understood that the result type with the highest accuracy weighted result indicates that more scanning algorithms correspond to the result type, and the scanning result corresponding to the result type is determined as the target scanning result.
In addition, if the ratio value is larger than the second threshold value and smaller than the first threshold value, returning each result type to the manual processing module; and acquiring a manual processing result corresponding to the target scanning item from the manual processing module, and taking the manual processing result as a target scanning result.
It can be understood that if the ratio value is greater than the second threshold and less than the first threshold, it indicates that the difference between the accuracy weighted result corresponding to the type I and the accuracy weighted result corresponding to the type II is small, which accuracy is similar to the accuracy corresponding to the type I and which accuracy is not easy to distinguish is more reliable, at this time, each result type is returned to the manual processing module, the manual processing result corresponding to the target scanning item is obtained from the manual processing module, and the manual processing result is used as the target scanning result.
Further, the target scanning item and the manual processing result corresponding to the target scanning item are returned to the updating module, so that each scanning algorithm in the updating module is updated according to the manual processing result.
Specifically, for any scanning algorithm, in this embodiment, the source code and the manual processing result corresponding to the target scanning item in the source code are used as a history scanning record, and returned to the updating module corresponding to the scanning algorithm, and the scanning algorithm is updated by updating the data set, so as to improve the scanning accuracy of the scanning algorithm on the target scanning item.
In this embodiment, each result type is first distinguished, and the results of each scanning algorithm are mutually referred according to the accuracy weighting result corresponding to each result type, so that the result types with higher accuracy are automatically discarded and automatically reserved for determining the false alarm result types, and the accuracy of scanning analysis is improved.
As shown in fig. 3, the present embodiment provides a code scanning system 10 corresponding to the code scanning method, where the scanning system includes: an input source management module 101, a false positive detection module 102, a false positive processing module 103 and an optimization updating module 104.
The input source management module 101 is used for supporting and expanding access of multiple scanning algorithms, and is a basic management component for supporting multiple-algorithm scanning by the code scanning system.
The false positive detection module 102 is configured to identify, on the basis of multiple algorithms, that a target scan item that has a conflict exists, and is an identification component for the target scan item.
Specifically, a scan term input model is built in the false alarm detection module 102, the input of the scan term input model is a global scan result corresponding to each scan algorithm, and the output of the scan term input model is a target scan term with conflict in the scan result. In addition, the scan term input model is also used for analyzing each scan dimension corresponding to each scan algorithm and each scan algorithm corresponding to any scan dimension; it can be understood that each scanning dimension corresponding to any scanning algorithm is an algorithm image of the scanning algorithm.
The false alarm processing module 103 is configured to analyze and decide the identified target scan term, and the processing result may be negatively fed back to optimize the next decision.
The false alarm processing module 103 determines the type of the result according to the scanning result of each scanning algorithm on the target scanning item; aiming at any result type, according to the scanning accuracy of each scanning algorithm corresponding to the result type to the target scanning item; determining an accuracy weighting result of the result type according to each scanning accuracy; and determining a target scanning result from the scanning results of the target scanning item by each scanning algorithm according to the accuracy weighted results corresponding to each result type.
Specifically, for any scanning algorithm, according to each scanning accuracy, a radar-like graph mechanism of the algorithm is established, the advantage item of each algorithm is noted, and then accuracy weighting result estimation is carried out.
Further, when determining the target scan result from the scan results of each scan algorithm on the target scan term, each scan algorithm is illustratively compared to voters, assuming there are 10 voters currently. The scanning results of each scanning algorithm on the target scanning item are compared with the results of the target scanning item as competitors, and currently, two competitors AB exist. The threshold is set to 2 to 1. If the ticket number A9 ticket B1 ticket is 9 to 1, the proportionality coefficient exceeds the threshold value, and the result is reliable, namely, the target scanning result is determined from the scanning results of each scanning algorithm on the target scanning item. If the number of tickets A5 ticket B5 ticket is 1 to 1, the ratio coefficient is lower than the threshold value, and the result is not credible.
The update module 104 is optimized, and is mainly used for optimizing the false alarm error correction capability for a long time.
After detection is completed, outputting aiming at a target scanning item, identifying a part of scenes which are not easy to distinguish (the results are not reliable) in the previous rounds of iteration, taking the manual processing result as real input after identification, continuously optimizing a scanning item input model, optimizing the accuracy rate of scene identification, and automatically optimizing a system.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a code scanning device for realizing the above related code scanning method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in one or more code scanning device embodiments provided below may refer to the limitation of the code scanning method hereinabove, and will not be repeated here.
In one embodiment, as shown in FIG. 4, there is provided a code scanning apparatus 20 comprising: a global scanning module 201, a conflict logging module 202 and a result determination module 203, wherein:
the global scanning module 201 is configured to scan the source code according to different scanning algorithms, so as to obtain a global scanning result corresponding to each scanning algorithm;
a conflict recording module 202, configured to determine, according to a comparison condition between global scan results, a target scan item in which a conflict exists between the scan results;
the result determining module 203 is configured to determine a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
In one embodiment, the result determination module 203 includes:
the type determining submodule is used for determining the type of the result according to the scanning result of each scanning algorithm on the target scanning item;
the weighting calculation sub-module is used for determining an accuracy weighting result of any result type according to the scanning accuracy of each scanning algorithm corresponding to the result type on the target scanning item;
and the voting selection sub-module is used for determining a target scanning result from the scanning results of the target scanning item by each scanning algorithm according to the accuracy weighted result corresponding to each result type.
In one embodiment, the vote selection submodule is further configured to: determining a proportion value among accuracy weighted results corresponding to each result type;
if the ratio value is larger than the first threshold value or smaller than the second threshold value, determining the result type with the highest accuracy weighted result as the target scanning result, wherein the first threshold value is larger than the second threshold value.
In one embodiment, the code scanning apparatus further comprises a feedback module for: if the ratio value is larger than the second threshold value and smaller than the first threshold value, returning each result type to the manual processing module;
and acquiring a manual processing result corresponding to the target scanning item from the manual processing module, and taking the manual processing result as a target scanning result.
In one embodiment, the code scanning apparatus further comprises an update module for: and returning the target scanning item and the manual processing result corresponding to the target scanning item to the updating module so as to update each scanning algorithm in the updating module according to the manual processing result.
In one embodiment, the code scanning device further comprises an accuracy estimation module for: acquiring historical scanning records of each scanning algorithm on each scanning item;
Determining each scanning dimension corresponding to each scanning item and the scanning accuracy of each scanning algorithm to each scanning dimension according to the historical scanning record;
and acquiring the scanning accuracy of each scanning algorithm on the target scanning item from the scanning accuracy of each scanning algorithm on each scanning dimension.
The respective modules in the above-described code scanning apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a code scanning method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 5 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
In one embodiment, when the processor executes logic for determining a target scan result from the scan results of each scan algorithm on the target scan item according to the scan accuracy of each scan algorithm on the target scan item, the following steps are specifically implemented: determining the type of a result according to the scanning result of each scanning algorithm on the target scanning item; for any result type, determining an accuracy weighting result of the result type according to the scanning accuracy of each scanning algorithm corresponding to the result type on the target scanning item; and determining a target scanning result from the scanning results of the target scanning item by each scanning algorithm according to the accuracy weighted results corresponding to each result type.
In one embodiment, when the processor executes logic for determining a target scan result from the scan results of each scan algorithm on the target scan item according to the accuracy weighted results corresponding to each result type, the following steps are specifically implemented: determining a proportion value among accuracy weighted results corresponding to each result type; if the ratio value is larger than the first threshold value or smaller than the second threshold value, determining the result type with the highest accuracy weighted result as the target scanning result, wherein the first threshold value is larger than the second threshold value.
In one embodiment, the processor when executing the computer program further performs the steps of: if the ratio value is larger than the second threshold value and smaller than the first threshold value, returning each result type to the manual processing module; and acquiring a manual processing result corresponding to the target scanning item from the manual processing module, and taking the manual processing result as a target scanning result.
In one embodiment, the processor when executing the computer program further performs the steps of: and returning the target scanning item and the manual processing result corresponding to the target scanning item to the updating module so as to update each scanning algorithm in the updating module according to the manual processing result.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring historical scanning records of each scanning algorithm on each scanning item; determining each scanning dimension corresponding to each scanning item and the scanning accuracy of each scanning algorithm to each scanning dimension according to the historical scanning record; and acquiring the scanning accuracy of each scanning algorithm on the target scanning item from the scanning accuracy of each scanning algorithm on each scanning dimension.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
In one embodiment, the logic for determining the target scan result from the scan results of each scan algorithm on the target scan item is executed by the processor according to the scan accuracy of each scan algorithm on the target scan item, and specifically implements the steps of: determining the type of a result according to the scanning result of each scanning algorithm on the target scanning item; for any result type, determining an accuracy weighting result of the result type according to the scanning accuracy of each scanning algorithm corresponding to the result type on the target scanning item; and determining a target scanning result from the scanning results of the target scanning item by each scanning algorithm according to the accuracy weighted results corresponding to each result type.
In one embodiment, the computer program specifically implements the following steps when logic for determining a target scan result from the scan results of each scan algorithm on the target scan term is executed by the processor according to the accuracy weighted results corresponding to each result type: determining a proportion value among accuracy weighted results corresponding to each result type; if the ratio value is larger than the first threshold value or smaller than the second threshold value, determining the result type with the highest accuracy weighted result as the target scanning result, wherein the first threshold value is larger than the second threshold value.
In one embodiment, the computer program when executed by the processor further performs the steps of: if the ratio value is larger than the second threshold value and smaller than the first threshold value, returning each result type to the manual processing module; and acquiring a manual processing result corresponding to the target scanning item from the manual processing module, and taking the manual processing result as a target scanning result.
In one embodiment, the computer program when executed by the processor further performs the steps of: and returning the target scanning item and the manual processing result corresponding to the target scanning item to the updating module so as to update each scanning algorithm in the updating module according to the manual processing result.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring historical scanning records of each scanning algorithm on each scanning item; determining each scanning dimension corresponding to each scanning item and the scanning accuracy of each scanning algorithm to each scanning dimension according to the historical scanning record; and acquiring the scanning accuracy of each scanning algorithm on the target scanning item from the scanning accuracy of each scanning algorithm on each scanning dimension.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
In one embodiment, the logic for determining the target scan result from the scan results of each scan algorithm on the target scan item is executed by the processor according to the scan accuracy of each scan algorithm on the target scan item, and specifically implements the steps of: determining the type of a result according to the scanning result of each scanning algorithm on the target scanning item; for any result type, determining an accuracy weighting result of the result type according to the scanning accuracy of each scanning algorithm corresponding to the result type on the target scanning item; and determining a target scanning result from the scanning results of the target scanning item by each scanning algorithm according to the accuracy weighted results corresponding to each result type.
In one embodiment, the computer program specifically implements the following steps when logic for determining a target scan result from the scan results of each scan algorithm on the target scan term is executed by the processor according to the accuracy weighted results corresponding to each result type: determining a proportion value among accuracy weighted results corresponding to each result type; if the ratio value is larger than the first threshold value or smaller than the second threshold value, determining the result type with the highest accuracy weighted result as the target scanning result, wherein the first threshold value is larger than the second threshold value.
In one embodiment, the computer program when executed by the processor further performs the steps of: if the ratio value is larger than the second threshold value and smaller than the first threshold value, returning each result type to the manual processing module; and acquiring a manual processing result corresponding to the target scanning item from the manual processing module, and taking the manual processing result as a target scanning result.
In one embodiment, the computer program when executed by the processor further performs the steps of: and returning the target scanning item and the manual processing result corresponding to the target scanning item to the updating module so as to update each scanning algorithm in the updating module according to the manual processing result.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring historical scanning records of each scanning algorithm on each scanning item; determining each scanning dimension corresponding to each scanning item and the scanning accuracy of each scanning algorithm to each scanning dimension according to the historical scanning record; and acquiring the scanning accuracy of each scanning algorithm on the target scanning item from the scanning accuracy of each scanning algorithm on each scanning dimension.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. A code scanning method, the method comprising:
scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and determining a target scanning result from the scanning results of the target scanning items by the scanning algorithms according to the scanning accuracy of the target scanning items by the scanning algorithms.
2. The method of claim 1, wherein determining a target scan result from the scan results of each scan algorithm for the target scan term based on the scan accuracy of each scan algorithm for the target scan term, comprises:
determining a result type according to the scanning result of each scanning algorithm on the target scanning item;
for any result type, determining an accuracy weighting result of the result type according to the scanning accuracy of each scanning algorithm corresponding to the result type on the target scanning item;
and determining a target scanning result from the scanning results of the target scanning item by each scanning algorithm according to the accuracy weighted result corresponding to each result type.
3. The method according to claim 2, wherein determining the target scan result from the scan results of each scan algorithm for the target scan term according to the accuracy weighted result corresponding to each result type comprises:
determining a proportion value among accuracy weighted results corresponding to each result type;
and if the proportion value is larger than a first threshold value or smaller than a second threshold value, determining the result type with the highest accuracy weighted result as a target scanning result, wherein the first threshold value is larger than the second threshold value.
4. A method according to claim 3, characterized in that the method further comprises:
if the ratio value is larger than the second threshold value and smaller than the first threshold value, returning each result type to the manual processing module;
and acquiring a manual processing result corresponding to the target scanning item from the manual processing module, and taking the manual processing result as the target scanning result.
5. The method according to claim 4, wherein the method further comprises:
and returning the target scanning item and the manual processing result corresponding to the target scanning item to an updating module so as to update each scanning algorithm in the updating module according to the manual processing result.
6. The method according to any one of claims 1-5, further comprising:
acquiring historical scanning records of each scanning algorithm on each scanning item;
determining each scanning dimension corresponding to each scanning item and the scanning accuracy of each scanning algorithm to each scanning dimension according to the historical scanning record;
and acquiring the scanning accuracy of each scanning algorithm on the target scanning item from the scanning accuracy of each scanning algorithm on each scanning dimension.
7. A code scanning device, the device comprising:
the global scanning module is used for scanning the source codes according to different scanning algorithms to obtain global scanning results corresponding to the scanning algorithms;
the conflict recording module is used for determining target scanning items with conflicts between the scanning results according to the comparison condition between the global scanning results;
and the result determining module is used for determining a target scanning result from the scanning results of the scanning algorithms on the target scanning item according to the scanning accuracy of the scanning algorithms on the target scanning item.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202310926844.8A 2023-07-26 2023-07-26 Code scanning method, device, computer equipment and storage medium Pending CN116991718A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310926844.8A CN116991718A (en) 2023-07-26 2023-07-26 Code scanning method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310926844.8A CN116991718A (en) 2023-07-26 2023-07-26 Code scanning method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116991718A true CN116991718A (en) 2023-11-03

Family

ID=88531487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310926844.8A Pending CN116991718A (en) 2023-07-26 2023-07-26 Code scanning method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116991718A (en)

Similar Documents

Publication Publication Date Title
US8166000B2 (en) Using a data mining algorithm to generate format rules used to validate data sets
CN110471945B (en) Active data processing method, system, computer equipment and storage medium
CN116414815A (en) Data quality detection method, device, computer equipment and storage medium
CN113656797A (en) Behavior feature extraction method and behavior feature extraction device
CN114281932A (en) Method, device and equipment for training work order quality inspection model and storage medium
CN112712181A (en) Model construction optimization method, device, equipment and readable storage medium
US8935664B2 (en) Method and apparatus to determine rules implementation decision
CN109800887B (en) Generation method and device of prediction process model, storage medium and electronic equipment
CN116991718A (en) Code scanning method, device, computer equipment and storage medium
US20210342640A1 (en) Automated machine-learning dataset preparation
KR20220115859A (en) Edge table representation of the process
US20240078093A1 (en) Customizable automated machine learning systems and methods
CN116563278B (en) Detection result display method, device, computer equipment and storage medium
CN115496129B (en) Software matching method and device
US11830081B2 (en) Automated return evaluation with anomoly detection
US20240104083A1 (en) Data anomaly detection
CN117407267A (en) Conditional branch coverage rate calculation method, device, computer equipment and storage medium
CN116910038A (en) Information analysis method, apparatus, computer device and computer program product
CN118132091A (en) Service model processing method, device, computer equipment and storage medium
CN117667648A (en) Method, device, computer equipment and storage medium for detecting code branch line
CN117370160A (en) Code auditing method, apparatus, computer device, storage medium and program product
CN117555955A (en) Data conversion method, data conversion device, computer device, and storage medium
Chaikhan et al. Fast continuous streaming sort in big streaming data environment under fixed-size single storage
Srivastava et al. An Overview on Data Cleaning on Real World Data
CN118363932A (en) Unmanned aerial vehicle-based intelligent patrol method and system

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