Code quality verification method and device, equipment and storage medium

By receiving the target code file and verification context information, filtering and orchestrating the verification rule set, calling the verification execution engine for automated verification, and performing fusion processing and risk classification, the system solves the problems of insufficient reliability and efficiency in existing code quality verification technologies, and achieves more efficient code quality verification.

CN121301162APending Publication Date: 2026-01-09CHINA MERCHANTS BANK
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511498761.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-20
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

Existing code quality verification methods are insufficient in terms of reliability and verification efficiency. They cannot be effectively adjusted dynamically to suit specific business scenarios, resulting in limited detection rates of potential defects, low overall verification efficiency, and difficulty in meeting the needs of rapid iteration.

Method used

By receiving the target code file and verification context information, the system filters the verification rule set that meets the preset requirements, generates a rule set orchestration task, calls the verification execution engine to perform automated verification, and performs fusion processing and risk classification on the initial verification results to generate standardized verification results.

Benefits of technology

It improves the reliability and efficiency of code quality verification, ensures the accuracy and consistency of verification results, and supports rapid iteration and timely handling of issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121301162A_ABST
    Figure CN121301162A_ABST
Patent Text Reader

Abstract

The invention discloses a code quality verification method and device, equipment and a storage medium. The method comprises the steps that a to-be-verified target code file and verification context information corresponding to the target code file are received; based on the verification context information, screening out a verification rule set meeting a preset requirement from a rule base, and arranging the verification rule set to generate a rule set arrangement task; calling a corresponding verification execution engine to perform automatic verification on the target code file according to the characteristics of each rule in the rule set arrangement task, and generating an initial verification result; and carrying out fusion processing on the initial verification result to obtain a fusion result, and carrying out risk grading on the fusion result based on a preset priority strategy to generate a standardized verification result. According to the code quality verification method and device, the verification rule set meeting the preset requirement is screened out from the rule base based on the verification context information, the target code file is automatically verified according to the rule set arrangement task, and the reliability and the verification efficiency of code quality verification are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer software technology, and in particular to a code quality verification method, apparatus, device, and storage medium. Background Technology

[0002] As enterprises become increasingly digital, data scripts (SQL, Python, and Shell, etc.) have become the core carriers of business systems. To ensure the stable operation of these scripts in production environments, a combination of manual code review and static analysis tools is commonly used for quality control after development.

[0003] However, this model has revealed the following prominent problems in practical applications: 1. Different developers or teams maintain their own "checklists," and the quality thresholds for the same scripts vary across different scenarios; 2. When business specifications are upgraded or new verification requirements are added, manual synchronization through documents, meetings, and other means is required, resulting in long rule implementation cycles and a high risk of omissions; 3. Manual review focuses on business logic, easily overlooking coding standards, performance vulnerabilities, and semantic defects. Existing static tools only support fixed syntax rules and cannot be dynamically adjusted to fit specific business scenarios, thus limiting the detection rate of potential defects; 4. The output formats of various tools differ greatly, and there is no unified risk classification for defects. Developers need to perform secondary screening and manual sorting, resulting in long time consumption for problem localization and repair, low overall verification efficiency, and difficulty in meeting the needs of rapid iteration. As can be seen from the above, existing code quality verification has shortcomings in both reliability and verification efficiency.

[0004] Therefore, there is an urgent need for a code quality verification method that can improve the reliability and efficiency of code quality verification. Summary of the Invention

[0005] The main objective of this invention is to provide a code quality verification method, apparatus, device, and storage medium, aiming to solve the technical problems of low reliability and low verification efficiency in the prior art.

[0006] To achieve the above objectives, the present invention provides a code quality verification method, the method comprising the following steps: Receive the target code file to be verified and the verification context information corresponding to the target code file; Based on the verification context information, a set of verification rules that meet the preset requirements is selected from the rule base, and the set of verification rules is arranged to generate a rule set arrangement task. Based on the characteristics of each rule in the rule set orchestration task, the corresponding verification execution engine is invoked to automatically verify the target code file and generate initial verification results; The initial verification results are fused to obtain a fused result, and the fused result is risk-classified based on a preset priority strategy to generate a standardized verification result.

[0007] Optionally, the step of filtering a set of verification rules that meet preset requirements from the rule base based on the verification context information, and arranging the verification rule set to generate a rule set arrangement task includes: The verification context information is parsed, and the script type and business scenario attributes of the target code file are determined based on the parsing results; Multiple validation rule sets are selected from the rule base based on the script type and the business scenario attributes; The various verification rule sets are visually assembled based on a visual orchestration interface to generate a rule workflow. The rule workflow is transformed into an object model, and the object model is used as a rule set orchestration task.

[0008] Optionally, the step of converting the rule workflow into an object model and using the object model as a rule set orchestration task includes: The rule workflow is transformed into an object model, and the object model is subjected to dependency resolution to obtain the rule execution order and parallel branch information; Based on the rule execution order and the parallel branch information, execution control markers are added to the object model to obtain the rule set orchestration task.

[0009] Optionally, the step of calling the corresponding verification execution engine to automatically verify the target code file based on the characteristics of each rule in the rule set orchestration task and generating an initial verification result includes: The rule set orchestration task is type-parsed to determine the type of each rule in the rule set orchestration task; When the type of the rule is a script rule, the script rule is injected into the thread pool execution engine, and the target code file is validated by a timeout retry mechanism to obtain the first validation result; When the rule type is a model interface class rule, the large model asynchronous interface is called to perform semantic verification on the target code file and obtain a second verification result. The first verification result and the second verification result are used as the initial verification result.

[0010] Optionally, after the step of injecting the script-type rule into the thread pool execution engine when the rule type is a script-type rule, the method further includes: Monitor the resource utilization rate of the thread pool. When the resource utilization rate exceeds a preset utilization rate threshold, adjust the retry parameters in the timeout retry mechanism. The retry parameters include the number of retries and the concurrency. The adjusted retry parameters are written into the configuration context of the thread pool execution engine.

[0011] Optionally, the step of fusing the initial verification results to obtain a fused result, and then classifying the fused result for risk based on a preset priority strategy to generate a standardized verification result includes: Based on the intermediate data format, the problem records in the initial verification results are converted to obtain the converted problem records; Based on the rule identifiers corresponding to each problem record in the initial verification result, the transformed problem records are grouped and merged to obtain the fusion result; Obtain the risk level in the rule corresponding to each problem record in the fusion result, and count the frequency of occurrence of problem records corresponding to each problem type in the fusion result; Based on the risk level and the frequency, each problem record in the fusion result is prioritized and sorted to obtain a standardized verification result.

[0012] Optionally, after the step of performing risk classification on the fusion result based on a preset priority strategy and generating standardized verification results, the method further includes: Based on the person in charge information corresponding to the target code file, the standardized verification result is pushed to the corresponding person in charge in real time through a message notification mechanism. Receive feedback information from the person in charge, and determine the person in charge's processing status for each issue in the standardized verification results based on the feedback information.

[0013] Furthermore, to achieve the above objectives, the present invention also proposes a code quality verification device, the device comprising: The data receiving module is used to receive the target code file to be verified and the verification context information corresponding to the target code file; The rule orchestration module is used to filter out a set of verification rules that meet preset requirements from the rule base based on the verification context information, and to orchestrate the set of verification rules to generate a rule orchestration task. The code verification module is used to call the corresponding verification execution engine to automatically verify the target code file according to the characteristics of each rule in the rule set orchestration task, and generate initial verification results; The result processing module is used to perform fusion processing on the initial verification results to obtain fusion results, and to perform risk classification on the fusion results based on a preset priority strategy to generate standardized verification results.

[0014] Furthermore, to achieve the above objectives, the present invention also proposes a code quality verification device, the device comprising: a memory, a processor, and a code quality verification program stored in the memory and executable on the processor, the code quality verification program being configured to implement the steps of the code quality verification method as described above.

[0015] In addition, to achieve the above objectives, the present invention also proposes a storage medium storing a code quality verification program, wherein the code quality verification program, when executed by a processor, implements the steps of the code quality verification method as described above.

[0016] This invention discloses a method for receiving a target code file to be verified and corresponding verification context information; selecting a set of verification rules that meet preset requirements from a rule base based on the verification context information, and orchestrating the set of rules to generate a rule set orchestration task; calling the corresponding verification execution engine to automatically verify the target code file according to the characteristics of each rule in the rule set orchestration task, generating an initial verification result; fusing the initial verification result to obtain a fused result, and classifying the fused result according to a preset priority strategy to generate a standardized verification result. Because this invention selects a set of verification rules that meet preset requirements from a rule base based on verification context information, orchestrates the set of rules to generate a rule set orchestration task, and then calls the corresponding verification execution engine to automatically verify the target code file according to the characteristics of each rule in the rule set orchestration task, compared with existing technologies, this invention improves the reliability and efficiency of code quality verification. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the first embodiment of the code quality verification method of the present invention; Figure 2 This is a flowchart of the rule configuration process in the code quality verification method of this invention; Figure 3 This is a flowchart illustrating the second embodiment of the code quality verification method of the present invention; Figure 4 This is a flowchart of the rule execution process in the code quality verification method of this invention; Figure 5 This is a flowchart illustrating the third embodiment of the code quality verification method of the present invention; Figure 6 This is a structural block diagram of the first embodiment of the code quality verification device of the present invention; Figure 7 This is a schematic diagram of the structure of the code quality verification device for the hardware operating environment involved in the embodiments of the present invention.

[0018] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0019] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0020] This invention provides a code quality verification method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the code quality verification method of the present invention.

[0021] In this embodiment, the code quality verification method includes steps S10 to S40: Step S10: Receive the target code file to be verified and the verification context information corresponding to the target code file.

[0022] It should be noted that the executing entity in this embodiment can be a computer server device with data processing, network communication, and program execution functions applied in code quality verification scenarios, such as a server, tablet computer, or personal computer, or an electronic device capable of performing the above functions (such as a code quality verification device). The following uses a system containing a code quality verification device (hereinafter referred to as the system) as an example to illustrate this embodiment and the following embodiments.

[0023] It should be understood that the target code file to be verified can refer to a data-type script entity that needs to be quality verified, such as SQL, Python, Shell, etc. The target code file can serve as a carrier of script content and does not contain dynamic data generated during business operations or compiled binary files.

[0024] Understandably, the aforementioned verification context information can be a set of necessary static attributes used to filter matching rules in the rule base, which may include script type (such as SQL, Python, Shell, etc.), business scenario attributes (such as offline data warehouse, real-time risk control, report calculation, etc.) and syntax version or runtime platform identifier.

[0025] Step S20: Based on the verification context information, select a set of verification rules that meet the preset requirements from the rule base, and arrange the set of verification rules to generate a rule set arrangement task.

[0026] Understandably, a rule base is a database or knowledge base that centrally stores, manages, and shares all code quality verification rules. It is a standardized, reusable, and flexibly callable set of rule resources for automated verification processes. A verification rule set can be a collection consisting of at least one verification rule. It should be noted that a rule set orchestration task can be a task object formed by organizing verification rule sets sequentially, in parallel, or through branches, which can be directly called by the subsequent verification execution engine.

[0027] In a specific implementation, the verification context information can be parsed, and the script type and business scenario attributes of the target code file can be determined based on the parsing results. Multiple verification rule sets can be selected from the rule base based on the script type and the business scenario attributes. The verification rule sets can be visually assembled based on the visual orchestration interface to generate a rule workflow. The rule workflow can be converted into an object model, and the object model can be used as a rule set orchestration task.

[0028] It's important to clarify that a visual orchestration interface can be a user interface that allows users to select, combine, and configure different validation rules through graphical methods (such as drag-and-drop and click operations). Users can intuitively see the relationships between rules and their execution order on the interface, making it easier to design validation processes that meet specific needs. This type of interface typically provides a simplified and user-friendly way to handle complex rule configuration tasks.

[0029] Understandably, a rule workflow can refer to a process in which a series of validation rules are combined according to a specific logical order and conditions. In this workflow, each rule may depend on the output of other rules or be executed in parallel with other rules. The rule workflow defines the execution logic of the validation task, including the execution order of rules, conditional branches, and parallel processing.

[0030] It's important to note that the object model is the result of structuring and objectifying the logic and data in a rule workflow. In this model, each element in the rule workflow (such as rules, conditions, and data flows) is represented as an object. These objects have attributes and methods, and can be understood and manipulated by the program. The object model is the internal representation of the rule workflow, providing the foundation for subsequent rule parsing, execution control, and data transfer. Within the system, the object model can be used to generate executable verification tasks, which can be understood and executed by the verification execution engine.

[0031] In a specific implementation, the rule workflow can be transformed into an object model, and the object model can be used to resolve dependencies to obtain the rule execution order and parallel branch information. Based on the rule execution order and the parallel branch information, execution control flags can be added to the object model to obtain the rule set orchestration task.

[0032] It should be understood that execution control tags refer to the tagging information added to the object model to guide and control the logic of rule execution order, conditional branches, and parallel execution. Execution control tags include, but are not limited to, execution order tags, parallel branch tags, conditional branch tags, and loop control tags. Adding execution control tags ensures the accuracy, efficiency, and flexibility of the validation process in rule set orchestration tasks.

[0033] Furthermore, the visual orchestration interface is a tool for users to design rule workflows, which are user-defined validation logics, while the object model is used to convert these logics into a form that can be executed by the computer system.

[0034] For example, refer to Figure 2 The diagram illustrates the flexibility and automation of rule configuration in this embodiment, as well as how rule base management and version control improve the efficiency and accuracy of the verification process. The rule base supports users adding verification rules through various configuration methods (e.g., templated Prompt configuration, custom Prompt configuration, large model interface configuration, and Python interface configuration) to meet verification needs of varying complexity and technical backgrounds. Rule saving and version management: After users configure rules, these rules are saved and version-managed for subsequent rule traceability and management. Whether to open to the public rule set: Users need to decide whether to store these rules in the public rule base for other users to subscribe to and use. If open, they enter the public rule base; if closed, they are stored privately. Rule orchestration interface: Regardless of whether a rule is open, users can access the rule orchestration interface, where they can visually assemble multiple rules according to business needs. Drag and drop rule components: In the rule orchestration interface, users can select and combine different rule components by dragging and dropping. Connecting rule nodes: Users need to connect the selected rule components to form a complete verification process. Configure condition selectors: Users can configure condition selectors to dynamically adapt different validation rules based on different script types and business scenarios. Generate complete branch chain: Generate a complete validation process, which can be a complex rule workflow used to automate the execution of different validation chains.

[0035] Step S30: Based on the characteristics of each rule in the rule set orchestration task, call the corresponding verification execution engine to automatically verify the target code file and generate initial verification results.

[0036] It should be explained that the characteristics of a rule can refer to the attributes or features of the rule itself. These characteristics determine the rule's type, execution method, and its role in the overall validation process. Rule characteristics can include at least one of the following: rule type (e.g., script-based rule, model interface-based rule, template-based rule, or specification-based rule), execution environment (the environment in which the rule needs to be executed, such as whether it requires specific software or library support), input / output (what kind of input data the rule needs and what kind of output it will produce), dependencies (whether the rule depends on the output of other rules, or whether other rules depend on its output), and execution conditions (under what conditions the rule will be executed, such as whether it needs to meet specific business logic or code characteristics).

[0037] Understandably, a validation execution engine can be a software component or service used to execute specific types of rules, performing corresponding validation tasks based on the characteristics of the rules. Examples include thread pool execution engines (used to execute script-based rules, such as Python scripts, which may include timeout retry mechanisms and concurrency control) and large model asynchronous interface call engines (used to execute model interface-based rules, performing semantic validation by calling the asynchronous interface of an external large model).

[0038] It should be noted that the initial verification result can be a preliminary result generated after the verification execution engine completes the automated verification of the target code file. The initial verification result may include: a list of issues, rule application results, detailed information, and metadata.

[0039] The problem list can list potential problems or rule violations found in the target code file; the rule application result can be the result after each rule is executed, which may include statuses such as pass, failure, or warning; the detailed information can be specific information about each problem, such as location, cause, and suggested remedial measures; the metadata can be additional information about the verification process, such as execution time and rule version used.

[0040] In a specific implementation, the rule set orchestration task can be type-parsed to determine the type of each rule in the rule set orchestration task; when the type of the rule is a script rule, the script rule is injected into the thread pool execution engine to perform script verification on the target code file and obtain a first verification result; when the type of the rule is a model interface rule, the large model asynchronous interface is called to perform semantic verification on the target code file and obtain a second verification result; the first verification result and the second verification result are used as the initial verification result.

[0041] It should be noted that the types of rules mentioned above can include script-type rules, model interface-type rules, template-type rules, and specification-type rules.

[0042] It should be explained that script-based rules can be rules written by users in the form of Python scripts that can be directly loaded and run by the thread pool execution engine; model interface-based rules are rules that can perform semantic verification on target code files by calling the asynchronous interface of external large models; template-based rules can be executable rules generated by users filling in specific verification parameters using a pre-set Prompt template; and specification-based rules can be general scanning rules generated according to established coding specifications, used to perform format or syntax consistency checks on target code files.

[0043] Understandably, template-based rules can be instantiated into script-based rules or model interface-based rules by filling in specific parameters, and then executed by the thread pool execution engine or the large model asynchronous interface call engine; canonical rules can be parsed into standardized scanning scripts and then executed by the thread pool execution engine.

[0044] Step S40: Perform fusion processing on the initial verification results to obtain fusion results, and perform risk classification on the fusion results based on a preset priority strategy to generate standardized verification results.

[0045] It should be understood that the fusion result can be a data set that integrates the initial verification results generated by multiple verification execution engines. The fusion process involves converting verification data from different sources and in different formats into a unified format and merging similar or related results to facilitate subsequent analysis and processing. The goal of the fusion result is to provide a comprehensive view that can include all verification information from the target code file, regardless of the original data source or format.

[0046] Understandably, a pre-defined priority strategy can be a rule or method used to determine the importance of different issues in the validation results. This strategy assigns a priority to each issue based on a set of criteria (such as issue type, scope of impact, historical data, etc.). Pre-defined priority strategies can help developers identify and handle the most serious or critical issues, thereby improving code quality and maintenance efficiency.

[0047] It should be noted that risk grading of the fusion results based on a preset priority strategy can be a process of classifying issues in the fusion results according to a preset priority strategy. This process involves assessing the potential impact of each issue and assigning it to different risk levels (such as high, medium, and low). Risk grading helps developers and quality management personnel quickly identify issues in the target code files that require immediate attention and resolution, while also providing direction for long-term quality improvement.

[0048] It should be understood that standardized verification results can be verification results presented in a unified format and standard after fusion processing and risk classification.

[0049] In practical implementation, to help developers and quality management personnel quickly grasp the code quality status and take corresponding improvement measures, after step S40, the method further includes: based on the person in charge information corresponding to the target code file, pushing the standardized verification results to the corresponding person in charge in real time through a message notification mechanism; receiving feedback information from the person in charge, and determining the person in charge's handling status of each issue in the standardized verification results based on the feedback information.

[0050] Understandably, the responsible person information can refer to the information of the developers and quality management personnel associated with the target code file, and may include their names, email addresses, instant messaging accounts or other means of communication.

[0051] It should be understood that the message notification mechanism is a system function used to deliver information to the responsible person in real time. This can be done through email, SMS, instant messaging, mobile application push notifications, or other communication channels. The message notification mechanism can effectively ensure that the responsible person can learn about the code verification results in a timely manner.

[0052] It should be noted that feedback information can be the person in charge's response to the standardized verification results. This can include confirmation of the problem record, opinions on suggested remedial measures, adjustment of the problem's priority, or rejection of the problem. Feedback information helps the system understand the person in charge's intentions and progress in handling the problem.

[0053] Accordingly, the processing status refers to the progress and results of the responsible person's handling of each issue in the standardized verification results. By tracking the processing status, the system can understand the progress of code quality improvement and ensure that all critical issues receive appropriate attention and resolution, which helps to improve code quality, reduce defects, and ultimately improve the overall quality and reliability of the software.

[0054] Furthermore, the issues in the standardized verification results can be connected to the issue management platform to display the handling status of user code quality issues in real time, forming a closed-loop mechanism for quality issue handling.

[0055] This embodiment discloses receiving a target code file to be verified and corresponding verification context information; selecting a set of verification rules that meet preset requirements from a rule base based on the verification context information, and orchestrating the verification rule set to generate a rule set orchestration task; calling the corresponding verification execution engine to automatically verify the target code file according to the characteristics of each rule in the rule set orchestration task, generating an initial verification result; fusing the initial verification result to obtain a fused result, and classifying the fused result for risk based on a preset priority strategy to generate a standardized verification result. Because this embodiment selects a set of verification rules that meet preset requirements from a rule base based on the verification context information, orchestrates the verification rule set to generate a rule set orchestration task, and then calls the corresponding verification execution engine to automatically verify the target code file according to the characteristics of each rule in the rule set orchestration task, compared to existing technologies, this embodiment improves the reliability and efficiency of code quality verification.

[0056] refer to Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the code quality verification method of the present invention.

[0057] Based on the first embodiment described above, in this embodiment, step S30 includes steps S301 to S304: Step S301: Perform type parsing on the rule set orchestration task to determine the type of each rule in the rule set orchestration task.

[0058] Step S302: When the type of the rule is a script rule, the script rule is injected into the thread pool execution engine, and the target code file is verified by a timeout retry mechanism to obtain the first verification result.

[0059] Step S303: When the type of the rule is a model interface class rule, call the large model asynchronous interface to perform semantic verification on the target code file and obtain the second verification result.

[0060] Step S304: Use the first verification result and the second verification result as the initial verification result.

[0061] It's important to explain that a thread pool execution engine is a software component that uses thread pool technology to manage and execute concurrent tasks. A thread pool is a set of pre-created threads that can be reused to execute multiple tasks, thus avoiding the overhead of frequently creating and destroying threads. In the context of code quality verification, a thread pool execution engine can be used to execute multiple verification tasks in parallel, such as running multiple Python script rules. This parallel processing can improve the efficiency of the verification process, especially when dealing with large amounts of code or when multiple independent verification rules need to be executed.

[0062] Furthermore, to improve the robustness of the verification process and ensure that verification tasks can be completed even when encountering temporary problems, a timeout retry mechanism is introduced into the thread pool execution engine. The timeout retry mechanism is an error handling strategy used to automatically re-execute tasks when they fail or time out. In code quality verification, if a verification task fails to complete within the scheduled time for some reason (timeout), or an error occurs during execution, the timeout retry mechanism will attempt to re-execute the task. This typically involves setting a maximum number of retries and a retry interval to avoid infinite retries and resource exhaustion. The timeout retry mechanism ensures that verification tasks can still be completed when encountering temporary problems (such as network latency, service unavailability, etc.), thus improving the system's robustness.

[0063] In a specific implementation, the resource utilization rate of the thread pool can be monitored. When the resource utilization rate exceeds a preset utilization rate threshold, the retry parameters in the timeout retry mechanism are adjusted. The retry parameters include the number of retries and the concurrency. The adjusted retry parameters are then written into the configuration context of the thread pool execution engine.

[0064] It should be understood that the configuration context of the thread pool execution engine contains the configuration information required for the thread pool execution engine to run. The configuration context ensures that the thread pool can execute tasks according to predetermined parameters and rules. The configuration context can include: the number of threads, timeout settings, and retry policies, etc.

[0065] It's important to note that calling the large model asynchronous interface to perform semantic verification on the target code file means calling the engine through the large model asynchronous interface to perform semantic verification on the target code file. The large model asynchronous interface refers to an interface for interacting with large machine learning models (typically complex artificial intelligence models with numerous parameters). This interaction is asynchronous; a request can be sent to the model, and the sender can continue performing other tasks while the model processes the request in the background and notifies the sender when the result is ready. In the context of code quality verification, the large model asynchronous interface might be used to perform complex semantic analysis or pattern recognition tasks, which may require significant computational resources and time. Through the asynchronous interface, the capabilities of large models can be leveraged to improve the accuracy and depth of verification without blocking the main verification process.

[0066] Furthermore, to address high load conditions on large model interfaces, concurrent execution resources are managed, allocating resources to the thread pool execution engine to improve validation efficiency and achieve high performance goals. In the specific implementation, when the load on the large model interface rules is detected to be too high, the resource allocation strategy can be dynamically adjusted to prioritize the execution efficiency of script-type rules. Asynchronous processing of large model interfaces is supported, including task pause, resumption, and retries. Rule execution timeouts are handled with corresponding timeout policies, triggering degradation mechanisms, etc.

[0067] For example, refer to Figure 4 , Figure 4 This is a flowchart of the rule execution process in the code quality verification method of this invention. In the specific implementation, the system first processes the input verification rules through a rule parser, which involves understanding and transforming the rules so that they can be executed by the system. Rule validity verification: The parsed rules need to undergo validity verification to ensure they meet preset requirements and standards; if a rule fails verification, the process will enter the exception handling stage and eventually end; if the rule passes verification, the process continues. Generating execution strategy: Once a rule is verified as valid, the system will generate an execution strategy, which may involve determining the execution order of rules, the possibility of parallel execution, etc. Analyzing rule dependencies: The system analyzes the dependencies between rules to determine which rules can be executed in parallel and which need to be executed sequentially. Dynamic orchestration engine: Based on the analysis results, the system uses a dynamic orchestration engine to organize and optimize the rule execution process. Task distribution: The orchestrated tasks are distributed to different execution engines. Python script processing and large model API calls: Tasks are asynchronously assigned to Python script processing (i.e., thread pool execution engine) or large model API calls (i.e., large model asynchronous interface call engine) according to their type. These engines work in parallel to improve verification efficiency. Resource waiting retry: If a large model API call encounters resource limitations or needs to wait, the system will retry until it executes successfully or the retry limit is reached.

[0068] This embodiment discloses a method for type parsing of the rule set orchestration task to determine the type of each rule in the task. When the rule type is a script rule, it is injected into a thread pool execution engine, and the target code file is validated using a timeout retry mechanism to obtain a first validation result. When the rule type is a model interface rule, the target code file is semantically validated by calling a large model asynchronous interface to obtain a second validation result. The first and second validation results are used as the initial validation results. Because this embodiment uses a thread pool execution engine to execute script rules in parallel and asynchronously calls the large model interface for semantic validation, compared to existing technologies, this embodiment not only improves the efficiency and accuracy of code quality validation but also enhances the robustness of the system.

[0069] refer to Figure 5 , Figure 5 This is a flowchart illustrating the third embodiment of the code quality verification method of the present invention.

[0070] Based on the above embodiments, in this embodiment, step S40 includes steps S401 to S404: Step S401: Based on the intermediate data format, convert the format of each problem record in the initial verification result to obtain the converted problem record.

[0071] Step S402: Group and merge the transformed problem records according to the rule identifiers corresponding to each problem record in the initial verification result to obtain the fusion result.

[0072] Step S403: Obtain the risk level in the rule corresponding to each problem record in the fusion result, and count the frequency of occurrence of problem records corresponding to each problem type in the fusion result.

[0073] Step S404: Prioritize each problem record in the fusion result according to the risk level and the frequency to obtain a standardized verification result.

[0074] Understandably, in order to transform the diverse initial verification results generated by different verification engines into a unified intermediate data format, the problem records in the initial verification results are converted based on the intermediate data format. By converting the initial verification results into a unified intermediate data format, data consistency is ensured. This allows data from different sources and in different formats to be processed and analyzed uniformly, thereby improving the accuracy and reliability of data processing.

[0075] It should be understood that an intermediate data format can be a unified data structure or standard used for transmitting and storing data between different verification engines or system components. This intermediate data format can be understood and processed by various different systems. It enables data from different sources to be processed and analyzed uniformly.

[0076] Understandably, a rule identifier can be an identifier used to uniquely identify each validation rule. It can be an ID, a name, or other unique identifier. Rule identifiers are used to track the association between each issue record and a specific rule, thereby enabling issue categorization and attribution.

[0077] It should be noted that grouping and merging refers to the process of classifying and integrating the transformed problem records according to rule identifiers. Identical or similar problem records (e.g., problems discovered by the same or similar rules) are merged into the same group. This reduces duplicate problems, simplifies result presentation, and helps to more clearly identify and analyze problem patterns.

[0078] It should be understood that grouping and merging issue records based on rule identifiers allows for clearer identification and analysis of issue patterns. This helps to quickly locate problematic areas in the code, thereby accelerating problem resolution.

[0079] It's important to explain that prioritization is the process of sorting issue records based on their risk level and frequency of occurrence. All issue records are sorted according to preset priority rules. This sorting can be automatic or allow for manual intervention to adjust the priority of specific issues. Risk level reflects the severity of the issue, while frequency reflects its prevalence. Prioritization helps determine which issues require the highest priority for resolution, thus guiding the work focus of developers and quality management personnel.

[0080] In practical implementation, all issue records are sorted according to a preset priority rule. First, they are sorted by risk level, with high-risk issues taking precedence over medium-risk issues, and medium-risk issues taking precedence over low-risk issues. Then, if the risk levels are the same, they are sorted by frequency of occurrence, with more frequent issues taking precedence. For example, according to the above sorting rules, the priority order of issue records is as follows: memory leak (high risk, frequency 5), potential SQL injection (high risk, frequency 2), lack of unit tests (medium risk, frequency 8), performance bottleneck (medium risk, frequency 3), inconsistent coding style (low risk, frequency 10). This sorting method ensures that developers and quality management personnel can prioritize addressing the issues that have the greatest impact on the system or occur most frequently, thereby effectively improving code quality and system stability.

[0081] This embodiment discloses a method for converting the format of each problem record in the initial verification result based on an intermediate data format to obtain converted problem records; grouping and merging the converted problem records according to the rule identifiers corresponding to each problem record in the initial verification result to obtain a fusion result; obtaining the risk level in the rule corresponding to each problem record in the fusion result, and counting the frequency of occurrence of problem records corresponding to each problem type in the fusion result; prioritizing each problem record in the fusion result according to the risk level and the frequency to obtain a standardized verification result. Because this invention converts the initial verification result into a unified intermediate data format, groups and merges problem records according to rule identifiers, and prioritizes them according to risk level and problem frequency, compared to existing technologies, this invention not only improves the efficiency and accuracy of subsequent code improvement processing, but also helps optimize resource allocation and ensures that critical issues are handled in a timely manner.

[0082] Furthermore, embodiments of the present invention also propose a storage medium storing a code quality verification program, wherein the code quality verification program, when executed by a processor, implements the steps of the code quality verification method described above.

[0083] Reference Figure 6 , Figure 6 This is a structural block diagram of the first embodiment of the code quality verification device of the present invention.

[0084] like Figure 6 As shown, the code quality verification device proposed in this embodiment of the invention includes: a data receiving module 601, a rule arrangement module 602, a code verification module 603, and a result processing module 604.

[0085] The data receiving module 601 is used to receive the target code file to be verified and the verification context information corresponding to the target code file.

[0086] The rule orchestration module 602 is used to filter out a set of verification rules that meet preset requirements from the rule base based on the verification context information, and to orchestrate the set of verification rules to generate a rule orchestration task.

[0087] The code verification module 603 is used to call the corresponding verification execution engine to automatically verify the target code file according to the characteristics of each rule in the rule set orchestration task, and generate an initial verification result.

[0088] The result processing module 604 is used to perform fusion processing on the initial verification result to obtain a fusion result, and to perform risk classification on the fusion result based on a preset priority strategy to generate a standardized verification result.

[0089] The rule orchestration module 602 is further configured to parse the verification context information, determine the script type and business scenario attributes of the target code file based on the parsing result; select multiple verification rule sets from the rule base based on the script type and the business scenario attributes; visually assemble each verification rule set based on the visual orchestration interface to generate a rule workflow; convert the rule workflow into an object model, and use the object model as a rule set orchestration task.

[0090] The rule orchestration module 602 is further configured to convert the rule workflow into an object model, and perform dependency parsing on the object model to obtain the rule execution order and parallel branch information; and add execution control flags to the object model according to the rule execution order and the parallel branch information to obtain the rule set orchestration task.

[0091] The result processing module 604 is further configured to push the standardized verification result to the corresponding responsible person in real time through a message notification mechanism based on the responsible person information corresponding to the target code file; receive feedback information from the responsible person; and determine the responsible person's processing status for each issue in the standardized verification result based on the feedback information.

[0092] This device embodiment discloses receiving a target code file to be verified and corresponding verification context information; selecting a set of verification rules that meet preset requirements from a rule base based on the verification context information, and orchestrating the verification rule set to generate a rule set orchestration task; calling the corresponding verification execution engine to automatically verify the target code file according to the characteristics of each rule in the rule set orchestration task, generating an initial verification result; fusing the initial verification result to obtain a fused result, and performing risk classification on the fused result based on a preset priority strategy to generate a standardized verification result. Because this device embodiment selects a set of verification rules that meet preset requirements from a rule base based on the verification context information, orchestrates the verification rule set to generate a rule set orchestration task, and then calls the corresponding verification execution engine to automatically verify the target code file according to the characteristics of each rule in the rule set orchestration task, compared with the prior art, this device embodiment improves the reliability and efficiency of code quality verification.

[0093] Based on the first embodiment of the code quality verification device of the present invention described above, a second embodiment of the code quality verification device of the present invention is proposed.

[0094] In this embodiment, the code verification module 603 is further configured to perform type parsing on the rule set orchestration task to determine the type of each rule in the rule set orchestration task; when the type of the rule is a script rule, the script rule is injected into the thread pool execution engine, and the target code file is verified by a timeout retry mechanism to obtain a first verification result; when the type of the rule is a model interface rule, the large model asynchronous interface is called to perform semantic verification on the target code file to obtain a second verification result; the first verification result and the second verification result are used as the initial verification result.

[0095] The code verification module 603 is also used to monitor the resource utilization rate of the thread pool. When the resource utilization rate exceeds a preset utilization rate threshold, the retry parameters in the timeout retry mechanism are adjusted. The retry parameters include the number of retries and the concurrency. The adjusted retry parameters are written into the configuration context of the thread pool execution engine.

[0096] Other embodiments or specific implementations of the code quality verification device of the present invention can be found in the above-described method embodiments, and will not be repeated here.

[0097] This application provides a code quality verification device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the code quality verification method in Embodiment 1 above.

[0098] The following is for reference. Figure 7 The diagram illustrates a structural schematic of a code quality verification device suitable for implementing embodiments of this application. The code quality verification device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The code quality verification device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0099] like Figure 7 As shown, the code quality verification device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the code quality verification device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the code quality verification device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows code quality verification devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0100] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0101] The code quality verification device provided in this application, employing the code quality verification method described in the above embodiments, can solve the technical problems of low reliability and low verification efficiency in existing code quality verification technologies. Compared with existing technologies, the beneficial effects of the code quality verification device provided in this application are the same as those of the code quality verification method described in the above embodiments, and other technical features of this code quality verification device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0102] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0103] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0104] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0105] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0106] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0107] The above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the protection scope of the present invention.

Claims

1. A code quality verification method, characterized in that, The method includes: Receive the target code file to be verified and the verification context information corresponding to the target code file; Based on the verification context information, a set of verification rules that meet the preset requirements is selected from the rule base, and the set of verification rules is arranged to generate a rule set arrangement task. Based on the characteristics of each rule in the rule set orchestration task, the corresponding verification execution engine is invoked to automatically verify the target code file and generate initial verification results; The initial verification results are fused to obtain a fused result, and the fused result is risk-classified based on a preset priority strategy to generate a standardized verification result.

2. The code quality verification method as described in claim 1, characterized in that, The step of selecting a set of verification rules that meet preset requirements from the rule base based on the verification context information, and arranging the set of verification rules to generate a rule set arrangement task includes: The verification context information is parsed, and the script type and business scenario attributes of the target code file are determined based on the parsing results; Multiple validation rule sets are selected from the rule base based on the script type and the business scenario attributes; The various verification rule sets are visually assembled based on a visual orchestration interface to generate a rule workflow. The rule workflow is transformed into an object model, and the object model is used as a rule set orchestration task.

3. The code quality verification method as described in claim 2, characterized in that, The step of converting the rule workflow into an object model and using the object model as a rule set orchestration task includes: The rule workflow is transformed into an object model, and the object model is subjected to dependency resolution to obtain the rule execution order and parallel branch information; Based on the rule execution order and the parallel branch information, execution control markers are added to the object model to obtain the rule set orchestration task.

4. The code quality verification method as described in claim 1, characterized in that, The step of calling the corresponding verification execution engine to automatically verify the target code file based on the characteristics of each rule in the rule set orchestration task, and generating initial verification results, includes: The rule set orchestration task is type-parsed to determine the type of each rule in the rule set orchestration task; When the rule type is a script rule, the script rule is injected into the thread pool execution engine, and the target code file is validated by a timeout retry mechanism to obtain the first validation result; When the rule type is a model interface class rule, the large model asynchronous interface is called to perform semantic verification on the target code file and obtain a second verification result. The first verification result and the second verification result are used as the initial verification result.

5. The code quality verification method as described in claim 4, characterized in that, After the step of injecting the script-type rule into the thread pool execution engine when the rule type is a script-type rule, the method further includes: Monitor the resource utilization rate of the thread pool. When the resource utilization rate exceeds a preset utilization rate threshold, adjust the retry parameters in the timeout retry mechanism. The retry parameters include the number of retries and the concurrency. The adjusted retry parameters are written into the configuration context of the thread pool execution engine.

6. The code quality verification method as described in claim 1, characterized in that, The steps of fusing the initial verification results to obtain a fused result, and then classifying the fused result for risk based on a preset priority strategy to generate a standardized verification result include: Based on the intermediate data format, the problem records in the initial verification results are converted to obtain the converted problem records; Based on the rule identifiers corresponding to each problem record in the initial verification result, the transformed problem records are grouped and merged to obtain the fusion result; Obtain the risk level in the rule corresponding to each problem record in the fusion result, and count the frequency of occurrence of problem records corresponding to each problem type in the fusion result; Based on the risk level and the frequency, each problem record in the fusion result is prioritized and sorted to obtain a standardized verification result.

7. The code quality verification method as described in claim 1, characterized in that, After the step of performing risk classification on the fusion result based on a preset priority strategy and generating standardized verification results, the method further includes: Based on the person in charge information corresponding to the target code file, the standardized verification result is pushed to the corresponding person in charge in real time through a message notification mechanism. Receive feedback information from the person in charge, and determine the person in charge's processing status for each issue in the standardized verification results based on the feedback information.

8. A code quality verification device, characterized in that, The device includes: The data receiving module is used to receive the target code file to be verified and the verification context information corresponding to the target code file; The rule orchestration module is used to filter out a set of verification rules that meet preset requirements from the rule base based on the verification context information, and to orchestrate the set of verification rules to generate a rule orchestration task. The code verification module is used to call the corresponding verification execution engine to automatically verify the target code file according to the characteristics of each rule in the rule set orchestration task, and generate initial verification results; The result processing module is used to perform fusion processing on the initial verification results to obtain fusion results, and to perform risk classification on the fusion results based on a preset priority strategy to generate standardized verification results.

9. A code quality verification device, characterized in that, The device includes: a memory, a processor, and a code quality verification program stored in the memory and executable on the processor, the code quality verification program being configured to implement the steps of the code quality verification method as described in any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium stores a code quality verification program, which, when executed by a processor, implements the steps of the code quality verification method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Task deployment and control method, system and device based on artificial intelligence and storage medium

    CN122285228A