Code quality detection method and device, computer device and readable storage medium
By classifying source code files and using whitelist filtering, the problem of high update costs for code quality inspection tools and rule bases is solved, achieving efficient and low-cost code quality inspection, suitable for various project sizes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GF SECURITIES CO LTD
- Filing Date
- 2022-10-21
- Publication Date
- 2026-06-26
AI Technical Summary
Current code quality inspection tools and rule bases are costly to update, resulting in high human and time costs and low execution and integration efficiency, which is especially evident when the project scales up.
By reading and categorizing source code files, a list of categorized files is generated using whitelist filtering and caching strategies. This list is then used to detect the files using appropriate code detection tools, generating a quality inspection report that includes lists of normal and abnormal files. Files that pass the detection are filtered using a pre-generated whitelist and cached.
It enables the rapid introduction of the latest version of code inspection tools and rules at any time, reducing manpower and time costs, efficiently executing multiple quality inspection tasks in parallel, and improving inspection efficiency.
Smart Images

Figure CN115525565B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a code quality inspection method, apparatus, computer equipment, and readable storage medium. Background Technology
[0002] Code quality can reflect product quality to some extent, and high-quality coding is a fundamental requirement for the long-term, sustainable, and efficient iteration of large projects. Reviewing project code quality through static analysis tools is a simple and effective way to ensure code quality. Currently, there are many tools and methods for code quality inspection. The basic logic is to select or develop a corresponding inspection tool, set quality inspection rules, then scan the code of a specified project, apply the inspection rules, and output a quality inspection report. Typically, multiple code quality inspection tools are used for different purposes, and they are executed when code is committed and when quality inspection tasks are triggered by the continuous integration platform.
[0003] Taking the currently popular web front-end development model as an example, tools such as ESLint are typically used to check the coding style of JavaScript and TypeScript, tools such as Prettier are used to check the coding style, tools such as StyleLint are used to check the coding style of CSS / SCSS / LESS, tools such as commitlint are used to check the code submission style, and tools such as Jest and Cypress are used to execute unit tests. Additionally, independent tools may be developed to handle customized code style checking needs. Taking Java back-end development as another example, static code analysis tools such as SonarQube, DeepSource, SpotBugs, PMD, EclEmma, JUnit, and CheckStyle are typically used to scan for coding style, execute unit tests, and calculate test coverage.
[0004] Employing multiple quality inspection tools and methods in projects, based on different perspectives and objectives, can effectively detect and manage project code quality to a certain extent. However, the following problems may arise during implementation: Introducing new quality inspection tools into historical projects can lead to a large number of exceptions, often requiring extensive code refactoring or a reduction in specification constraints, resulting in high manpower and time costs; As quality inspection tools are updated and rule sets are added or modified, historical code will report a large number of new exceptions, leading to high update costs for tools and rule bases, making it difficult to apply the latest quality inspection solutions; When using a variety of inspection tools with complex inspection rules, execution time efficiency is low; As the project scale increases, continuous integration time becomes increasingly longer. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to overcome the shortcomings of the prior art and provide a code quality inspection method, apparatus, computer equipment and readable storage medium, aiming to solve the problems of high manpower and time costs in current code quality inspection, resulting in high costs for updating tools and rule bases, and low efficiency in execution and integration time.
[0006] This invention provides the following technical solution:
[0007] In a first aspect, this disclosure provides a code quality detection method, the method comprising:
[0008] Read the source code files and perform a file scan to obtain the corresponding list of source code files;
[0009] The files in the source code file list are categorized to generate corresponding categorized file lists;
[0010] The corresponding code detection tools are used to detect the processable files in the corresponding categorized file lists. When a processable file is found, the corresponding quality detection task is started and executed to obtain a code detection file list, which includes a normal file list and an abnormal file list.
[0011] Obtain a pre-generated whitelist, determine the quality inspection report of the processable files in the code inspection file list based on the whitelist, and cache the source code files that pass the inspection.
[0012] Furthermore, the source code file list includes a list of modified files and a list of all files. The process of reading the source code files and performing a file scan to obtain the corresponding source code file list includes:
[0013] Read the source code file and determine whether to only detect the modified source code file;
[0014] If so, the list of changed files is obtained by reading the cached results of the last code quality check;
[0015] If not, a full scan of the source code files is performed to obtain the full file list.
[0016] Further, the step of classifying the files in the source code file list to generate a corresponding classified file list includes:
[0017] The files in the source code file list are categorized by file type;
[0018] Determine whether the whitelist needs to be generated. If not, read the corresponding whitelist and the most recently passed source file cache list according to file type. Filter out source code files that do not need to be detected from the source code file list based on the whitelist and the source file cache list, and generate the corresponding category file list that needs to be detected.
[0019] Further, the step of obtaining a pre-generated whitelist and determining a quality inspection report for processable files in the code detection file list based on the whitelist includes:
[0020] Obtain the list of abnormal files and determine whether to add them to the whitelist;
[0021] If an execution exception source code file exists in the list of exception files, then the execution exception source code file is written into the corresponding whitelist according to its file type, the detection ends, and a quality detection pass report is output.
[0022] Furthermore, after obtaining the list of abnormal code detection files and determining whether to add them to the whitelist, the process also includes:
[0023] If not, then iterate through the list of code detection files for the anomaly and filter the list of code detection files for the anomaly using the whitelist;
[0024] Determine whether the source code file causing the execution exception exists in the filtered list of abnormal code detection files. If yes, end the detection and output a quality detection exception report; otherwise, end the detection and output a quality detection pass report.
[0025] Furthermore, the step of obtaining a pre-generated whitelist and determining a quality inspection report for processable files in the code detection file list based on the whitelist also includes:
[0026] Get a list of normal files, iterate through the list of normal files, and check if they are in the whitelist;
[0027] If so, remove the normal files from the whitelist in the normal file list. After all quality inspection tasks are completed, end the inspection and output a quality inspection pass report.
[0028] Furthermore, after removing normal files from the normal file list from the whitelist, the process further includes:
[0029] Write the list of normal files by type into the corresponding whitelist cache file, and update the whitelist cache file.
[0030] Secondly, this disclosure provides a code quality detection device, the device comprising:
[0031] The first generation module is used to read source code files and perform file scanning to obtain a list of corresponding source code files.
[0032] The second generation module is used to classify the files in the source code file list and generate a corresponding classified file list.
[0033] The third generation module is used to use the corresponding code detection tools to perform processable file detection on the corresponding classified file list, and start and execute the corresponding quality detection task when there are processable files to obtain a code detection file list, which includes a normal file list and an abnormal file list.
[0034] The result generation module is used to obtain a pre-generated whitelist, determine the quality detection report of the processable files in the code detection file list based on the whitelist, and cache the source code files that pass the detection.
[0035] Thirdly, this disclosure provides a computer device to solve the current problem. The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the code quality detection method described in the first aspect.
[0036] Fourthly, this disclosure provides a computer-readable storage medium to address the current problem, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the code quality detection method described in the first aspect.
[0037] The embodiments of this application have the following advantages:
[0038] The code quality inspection method provided in this application includes: reading source code files and scanning them to obtain a corresponding list of source code files; classifying the files in the source code file list to generate a corresponding list of classified files; using appropriate code inspection tools to inspect the classified file lists for processable files, and starting and executing the corresponding quality inspection task when processable files are found, to obtain a list of code inspection files, which includes a list of normal files and a list of abnormal files; obtaining a pre-generated whitelist and further filtering based on the whitelist to determine a quality inspection report for processable files in the code inspection file list. Through preset whitelist modes, caching strategies, and other processing rules and logic, the latest version of the quality inspection tool or new quality inspection rules can be quickly introduced at any time with low manpower and time costs, and multiple quality inspection tasks can be uniformly managed and executed in parallel efficiently.
[0039] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0040] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. In the various drawings, similar components are numbered similarly.
[0041] Figure 1 A flowchart of a code quality detection method provided in an embodiment of this application is shown;
[0042] Figure 2 A flowchart illustrating the file list provided in an embodiment of this application is shown;
[0043] Figure 3 A flowchart illustrating the categorized file list provided in an embodiment of this application is shown;
[0044] Figure 4 A schematic diagram of the structure of a code quality detection device provided in an embodiment of this application is shown. Detailed Implementation
[0045] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0046] It should be noted that when an element is said to be "fixed" to another element, it can be directly on the other element or there may be an intervening element. When an element is said to be "connected" to another element, it can be directly connected to the other element or there may be an intervening element. Conversely, when an element is said to be "directly" on another element, there is no intervening element. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.
[0047] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0048] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the template description is for the purpose of describing particular embodiments only and is not intended to limit the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0050] Example 1
[0051] like Figure 1 The diagram shown is a flowchart of a code quality detection method according to an embodiment of this application. The code quality detection method provided in this embodiment includes the following steps:
[0052] Step S110: Read the source code file and perform a file scan to obtain the corresponding source code file list.
[0053] In this embodiment, the task begins by launching the code quality inspection program. Basic information such as the required code quality inspection tools, the scope of file scanning, and the storage path for whitelisted files are predetermined. The program then reads the necessary source code files for the specific project and generates a corresponding file list.
[0054] In one implementation, such as Figure 2 As shown, step S110 includes:
[0055] Step S111: Read the source code file and determine whether to detect only the modified source code file;
[0056] Step S112: If yes, then obtain the list of changed files by reading the cached result of the last code quality check;
[0057] Step S113: If not, perform a full scan of the source code files to obtain the full file list.
[0058] Specifically, after reading the required source code files for a specific project, it is determined whether to only check the changed source code files. If so, the cached results of the last code quality check are read, and the changed source code files are scanned to obtain the changed file list; otherwise, a full scan of the source code files is performed to obtain the full file list. The source code file list is composed of the changed file list and the full file list.
[0059] Based on the comparison of cached results, only the changed source code files are detected, which greatly saves task execution time and masks the differences between different tool types.
[0060] Step S120: Classify the files in the source code file list to generate a corresponding classified file list.
[0061] Furthermore, the files in the source code file list are categorized for matching with corresponding code analysis tools. For example, JavaScript files of type ".ts / .tsx / .js / .jsx" are processed using the interfaces of tools such as ESLint and tsc; style files of type ".css / .less / .scss" are processed using the interfaces of tools such as StyleLint; and unit test files of type ".spec.js / .test.js" are processed using the interfaces of unit testing tools such as Jest. It is understood that the specific code analysis tools called can be set according to actual circumstances, and this embodiment does not limit this.
[0062] In one implementation, such as Figure 3 As shown, step S120 includes:
[0063] Step S121: Classify the files in the source code file list according to file type;
[0064] Step S122: Determine whether the whitelist needs to be generated. If not, read the corresponding whitelist and the most recently detected source file cache list according to file type. Filter out source code files that do not need to be detected from the source code file list based on the whitelist and the source file cache list, and generate a corresponding category file list that needs to be detected.
[0065] Specifically, after classifying the files in the source code file list by file type, it is determined whether the whitelist needs to be generated. If not, the corresponding whitelist and the most recently detected cached list of source files are read by file type. Based on the whitelist and the cached list of source files, source code files that do not need to be detected in the source code file list are filtered out, and a filtered list of classified files that need to be detected is generated.
[0066] By using a whitelist filter, new versions of code inspection tools and new code inspection rules can be accessed at any time, thereby enabling unified management and efficient parallel execution of multiple quality inspection tasks.
[0067] Step S130: Use the corresponding code detection tools to perform processable file detection on the corresponding category file list, and start and execute the corresponding quality detection task when there are processable files to obtain the code detection file list, which includes a normal file list and an abnormal file list.
[0068] Furthermore, based on the obtained list of categorized files, it is determined whether there are any processable files for the tasks corresponding to each code inspection tool. If so, the corresponding quality inspection tasks are started according to the list of categorized files and executed in parallel to obtain a list of code inspection files, which includes a list of normal files and a list of abnormal files.
[0069] By using multiple code inspection tools simultaneously, code quality can be measured from various perspectives. Customizing the inspection execution logic by calling the APIs of each tool allows for parallel execution of quality inspection tasks, effectively avoiding duplicate inspections. Even with caching during secondary execution, large-scale projects requiring long-term development can complete quality inspection tasks quickly within a short time, further improving execution efficiency.
[0070] Step S140: Obtain the pre-generated whitelist, determine the quality detection report of the processable files in the code detection file list based on the whitelist, and cache the source code files that pass the detection.
[0071] Specifically, the process involves obtaining a list of abnormal files after code inspection and determining whether they need to be added to the whitelist. If so, and the list contains source code files with execution errors, the abnormal source code files are written to the corresponding whitelists based on their file types. The inspection ends, a quality inspection pass report is output, and the passed source code files are cached. If not, the list of abnormal code inspection files is iterated. Since the code inspection task has already been filtered once by the whitelist, but indirectly dependent source code files may also appear in the abnormal file list, a second inspection is required. Therefore, the list of abnormal code inspection files needs to be filtered again by the whitelist, and it is determined whether there are source code files with execution errors in the filtered list. If so, a quality inspection error report is output based on the abnormal file list and inspection result details, and a notification alarm task is triggered to immediately end the inspection process. If not, the inspection ends and a quality inspection pass report is output after all code inspection tasks have passed, and the passed source code files are cached. The abnormal information in the whitelist is also reported as a reference for problem remediation.
[0072] Further, a list of normal files is obtained, and the list is iterated through to check if any file is in the whitelist. If so, the normal file in the list is removed from the whitelist, and the whitelist cache file is updated. The list of normal files is then written to the corresponding whitelist cache file according to their type, and the whitelist cache file is updated. Once all code detection tasks have passed, the detection ends, a quality detection pass report is output, and any abnormal information in the whitelist is also reported.
[0073] By scanning for abnormal files and adding them to a whitelist, code inspection alerts will not be triggered, but anomaly reports will still be output. Therefore, remediation plans can be gradually scheduled. Once historical files in the whitelist have been modified or refactored and all anomalies have been fixed, the code inspection task will be automatically triggered via task hooks upon code submission, automatically removing them from the whitelist. This allows for a gradual transformation of existing project development standards. It enables the integration of new code inspection solutions into projects at any time with low manpower and time costs, or the performance of version updates and rule modifications to existing code inspection solutions.
[0074] The code quality inspection method provided in this application involves reading source code files and scanning them to obtain a corresponding list of source code files; classifying the files in the source code file list to generate a corresponding list of categorized files; using appropriate code inspection tools to inspect the categorized file lists for processable files, and initiating and executing corresponding quality inspection tasks when processable files are found, resulting in a code inspection file list, which includes a normal file list and an abnormal file list; obtaining a pre-generated whitelist and further filtering based on the whitelist to determine the quality inspection report for processable files in the code inspection file list. Through preset whitelist modes, caching strategies, and other processing rules and logic, the latest version of the quality inspection tool or new quality inspection rules can be quickly introduced at any time with low manpower and time costs, and multiple quality inspection tasks can be uniformly managed and executed in parallel efficiently.
[0075] Example 2
[0076] like Figure 4 The diagram shown is a structural schematic of a code quality inspection device 400 according to an embodiment of this application. The device includes:
[0077] The first generation module 410 is used to read source code files and perform file scanning to obtain a corresponding list of source code files.
[0078] The second generation module 420 is used to classify the files in the source code file list and generate a corresponding classified file list.
[0079] The third generation module 430 is used to perform processable file detection on the corresponding classified file list using the corresponding code detection tools, and start and execute the corresponding quality detection task when there are processable files to obtain a code detection file list, which includes a normal file list and an abnormal file list.
[0080] The result generation module 440 is used to obtain a pre-generated whitelist, determine the quality detection report of the processable files in the code detection file list based on the whitelist, and cache the source code files that pass the detection.
[0081] Optionally, the above-mentioned code quality inspection device further includes:
[0082] The first determination module is used to read the source code file and determine whether to detect only the changed source code file;
[0083] The changed file list generation module is used to obtain the changed file list by reading the cached result of the last code quality inspection if the condition is met.
[0084] The full file list generation module is used to perform a full scan of the source code files if no, and obtain the full file list.
[0085] Optionally, the above-mentioned code quality inspection device further includes:
[0086] The classification module is used to classify the files in the source code file list according to file type;
[0087] The categorized file list generation module is used to determine whether the whitelist needs to be generated. If not, it reads the corresponding whitelist and the most recently detected cached list of source files according to file type, filters out source code files that do not need to be detected from the source code file list based on the whitelist and the source file cache list, and generates the corresponding categorized file list that needs to be detected.
[0088] Optionally, the above-mentioned code quality inspection device further includes:
[0089] The second determination module is used to obtain a list of abnormal files and determine whether to add them to the whitelist.
[0090] The first detection pass report generation module is used to write the source code file with execution exception into the corresponding whitelist according to the file type if and only if there is a source code file with execution exception in the exception file list, then end the detection and output a quality detection pass report.
[0091] Optionally, the above-mentioned code quality inspection device further includes:
[0092] The filtering module is used to, if not, traverse the list of abnormal code detection files and filter the list of abnormal code detection files using the whitelist;
[0093] The detection report generation module is used to determine whether the source code file of the execution exception exists in the filtered list of abnormal code detection files. If yes, the detection ends and a quality detection exception report is output; otherwise, the detection ends and a quality detection pass report is output.
[0094] Optionally, the above-mentioned code quality inspection device further includes:
[0095] The detection module is used to obtain a list of normal files, traverse the list of normal files, and detect whether they are in the whitelist.
[0096] The second detection pass report generation module is used to remove normal files from the whitelist if the condition is met. After all quality detection tasks are completed, the detection ends and a quality detection pass report is output.
[0097] Optionally, the above-mentioned code quality inspection device further includes:
[0098] The whitelist cache file update module is used to write the list of normal files by type into the corresponding whitelist cache file and update the whitelist cache file.
[0099] The code quality inspection device provided in this application embodiment, through pre-generated whitelist patterns, caching strategies and other processing rules and logic, enables the rapid introduction of the latest version of the quality inspection tool or the addition of new quality inspection rules at any time with low manpower and time costs, and unifies the management and efficiently executes multiple quality inspection tasks in parallel.
[0100] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, as an alternative implementation, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0101] In addition, the functional modules or units in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0102] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0103] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A code quality detection method, characterized in that, The method includes: Read the source code files and perform a file scan to obtain the corresponding list of source code files; The files in the source code file list are categorized to generate corresponding categorized file lists; The corresponding code detection tools are used to detect the processable files in the corresponding categorized file lists. When a processable file is found, the corresponding quality detection task is started and executed to obtain a code detection file list, which includes a normal file list and an abnormal file list. Obtain a pre-generated whitelist, determine the quality inspection report of the processable files in the code inspection file list based on the whitelist, and cache the source code files that pass the inspection; The step of determining the quality inspection report for the processable files in the code inspection file list based on the whitelist includes: Obtain the list of abnormal files and determine whether they need to be added to the whitelist. If an execution exception source code file exists in the list of exception files, then the execution exception source code file is written into the whitelist of the corresponding type according to the file type, the detection ends and a quality detection pass report is output. After obtaining the list of abnormal files and determining whether they need to be added to the whitelist, the process also includes: If not, then iterate through the list of abnormal files and filter the list of abnormal files using the whitelist; Determine whether the source code file of the execution exception exists in the filtered list of exception files. If yes, end the detection and output a quality detection exception report; otherwise, end the detection and output a quality detection pass report. The step of obtaining a pre-generated whitelist and determining a quality inspection report for the processable files in the code inspection file list based on the whitelist further includes: Get a list of normal files, iterate through the list of normal files, and check if they are in the whitelist; If so, remove the normal files from the whitelist in the normal file list. After all quality inspection tasks are completed, end the inspection and output a quality inspection pass report. After removing normal files from the normal file list from the whitelist, the process further includes: Write the list of normal files by type into the corresponding whitelist cache file, and update the whitelist cache file.
2. The code quality detection method according to claim 1, characterized in that, The source code file list includes a list of modified files and a list of all files. The process of reading source code files and performing a file scan to obtain the corresponding source code file list includes: Read the source code file and determine whether to only detect the modified source code file; If so, the list of changed files is obtained by reading the cached results of the last code quality check; If not, a full scan of the source code files is performed to obtain the full file list.
3. The code quality detection method according to claim 2, characterized in that, The step of classifying the files in the source code file list to generate a corresponding categorized file list includes: The files in the source code file list are categorized by file type; Determine whether the whitelist needs to be generated. If not, read the corresponding whitelist and the most recently passed source file cache list according to file type. Filter out source code files that do not need to be detected from the source code file list based on the whitelist and the source file cache list, and generate the corresponding category file list that needs to be detected.
4. A code quality inspection device, characterized in that, The device includes: The first generation module is used to read source code files and perform file scanning to obtain a list of corresponding source code files. The second generation module is used to classify the files in the source code file list and generate a corresponding classified file list. The third generation module is used to use the corresponding code detection tools to perform processable file detection on the corresponding classified file list, and start and execute the corresponding quality detection task when there are processable files to obtain a code detection file list, which includes a normal file list and an abnormal file list. The result generation module is used to obtain a pre-generated whitelist, determine the quality detection report of the processable files in the code detection file list based on the whitelist, and cache the source code files that pass the detection. The step of determining the quality inspection report for the processable files in the code inspection file list based on the whitelist includes: Obtain the list of abnormal files and determine whether they need to be added to the whitelist. If an execution exception source code file exists in the list of exception files, then the execution exception source code file is written into the whitelist of the corresponding type according to the file type, the detection ends and a quality detection pass report is output. After obtaining the list of abnormal files and determining whether they need to be added to the whitelist, the process also includes: If not, then iterate through the list of abnormal files and filter the list of abnormal files using the whitelist; Determine whether the source code file of the execution exception exists in the filtered list of exception files. If yes, end the detection and output a quality detection exception report; otherwise, end the detection and output a quality detection pass report. The step of obtaining a pre-generated whitelist and determining a quality inspection report for the processable files in the code inspection file list based on the whitelist further includes: Get a list of normal files, iterate through the list of normal files, and check if they are in the whitelist; If so, remove the normal files from the whitelist in the normal file list. After all quality inspection tasks are completed, end the inspection and output a quality inspection pass report. After removing normal files from the normal file list from the whitelist, the process further includes: Write the list of normal files by type into the corresponding whitelist cache file, and update the whitelist cache file.
5. A computer device, characterized in that, The method includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the code quality detection method according to any one of claims 1-3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the code quality detection method according to any one of claims 1-3.