Software development code review system and method based on reinforcement learning

Through a code review system based on reinforcement learning, real-time acquisition and analysis of code features is solved, and the problems of insufficient context understanding and poor dynamic adaptability of the code review system in the existing technology are achieved, efficient and accurate code review and quality monitoring are achieved to adapt to rapidly changing technology stacks and complex scenarios.

CN120560618AInactive Publication Date: 2025-08-29SHENZHEN XINHUA TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510702061.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2025-08-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing code review systems have insufficient context understanding, poor dynamic adaptability and weak complex logic processing, resulting in inaccurate and inefficient code review results, making it difficult to adapt to rapidly changing technology stacks and complex scenarios.

Method used

A software development code review system based on reinforcement learning is adopted, including historical code feature collection, code operation parameter collection, feature matching optimization and review result output modules. Through real-time acquisition and analysis of code features, reinforcement learning technology is used to continuously optimize review standards to adapt to software development projects of different scales and complexities.

Benefits of technology

Improve the accuracy and efficiency of code review, reduce the workload and time cost of manual review, and achieve continuous monitoring and optimization of code quality and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120560618A_ABST
    Figure CN120560618A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software engineering, and discloses a software development code review system and method based on reinforcement learning, and the system comprises a historical code feature collection module, a software development code operation parameter collection module, a code feature matching optimization module, a code feature optimization analysis module, and a code review result output module. The method comprises the following steps: extracting code features in a historical code library according to a time sequence, collecting code operation parameters in a software development process in real time, completing evaluation on software development code operation, performing feature matching optimization on the code operation parameters based on an evaluation result, obtaining an evaluation result of a to-be-evaluated operation code after matching optimization, and performing evaluation on the to-be-evaluated operation code according to the evaluation result. Based on the initial evaluation result and the feature optimization analysis result of the software development code, a code review result is output, early warning information is provided for the client through initial evaluation and matching optimization evaluation, and the code quality and safety in the software development process are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software engineering, and more particularly to a software development code review system and method based on reinforcement learning. Background Art

[0002] Code review is a critical step in the software development process. Its core purpose is to check code quality, identify potential defects, and ensure compliance with specifications through manual or automated means. As software scale and complexity increase, the limitations of traditional manual review are becoming increasingly prominent. Manual review relies on developers to read the code line by line, which is time-consuming and difficult to cover large code bases. Different reviewers' experience, standards, and even emotions can influence the results, resulting in different evaluations for the same code snippet. Furthermore, manual review is difficult to detect all potential issues, especially logical errors across modules or implicit dependencies. To address these challenges, code review systems are gradually incorporating automated technologies.

[0003] Static analysis tools and machine learning models are gradually being applied to code review. These tools can detect syntax errors, coding style violations, and some logical defects, and detect coding style and simple defects through predefined rules. However, existing technical solutions still have obvious intelligent bottlenecks: Insufficient context understanding: Tools find it difficult to accurately capture the semantic information of business logic, resulting in frequent misjudgments about the true intent of the code; Lack of dynamic adaptability: Predefined rule systems are difficult to cover rapidly evolving technology stacks and emerging programming paradigms, requiring continuous manual maintenance of the rule base; Weak processing of complex logic: Faced with complex scenarios such as distributed transaction consistency and implicit contracts between microservices, the diagnostic suggestions provided by existing tools are often superficial. Summary of the Invention

[0004] In order to overcome the above-mentioned defects of the prior art, the present invention provides a software development code review system based on reinforcement learning to solve the problems existing in the above-mentioned background technology.

[0005] The present invention provides the following technical solution: a software development code review system based on reinforcement learning, comprising: a historical code feature acquisition module, a software development code operation parameter acquisition module, a code feature matching optimization module, a code feature optimization analysis module, and a code review result output module; The historical code feature acquisition module includes a historical code library storage unit and a time series code feature extraction unit, which extracts code features from the historical code library based on the time series. The code features include grammatical features, logical features, and dependency features. The software development code running parameter acquisition module includes a software development first environment acquisition unit and a software development dynamic environment acquisition unit, which is used to collect code running parameters in the software development process in real time and complete the evaluation of the software development code operation based on the code running parameters; The code feature matching optimization module performs feature matching optimization on the code and generates a running code to be evaluated when the initial assessment result of the software development first environment acquisition unit is safe operation and the initial assessment result of the running code is qualified; when the initial assessment result of the software development first environment acquisition unit is risky operation, the code is optimized; The code feature optimization and analysis module transmits the running code to be evaluated to the software development dynamic environment acquisition unit, obtains the evaluation results of the running code to be evaluated, and completes the feature optimization analysis of the software development code; The code review result output module outputs the code review result based on the initial evaluation result and feature optimization analysis result of the software development code.

[0006] Preferably, the historical code feature acquisition module includes a historical code library storage unit and a time series code feature extraction unit. The specific contents are as follows: The historical code library storage unit is used to store historical code data and establish a time series, and to correspond the time series to the historical code data one by one; The time series code feature extraction unit extracts code features from a historical code library according to the time series and establishes a feature library of historical codes. The code features include grammatical features, logical features, and dependency features.

[0007] Preferably, the grammatical features, logical features and dependency features are obtained as follows: Syntax features: Generate an abstract syntax tree for each historical code base in the time series, traverse the abstract syntax tree nodes, and extract syntax features based on control flow complexity; Logical features: Generate an abstract syntax tree for each historical code base in the time series, traverse the abstract syntax tree nodes, and extract logical features based on the average branch depth; Dependency features: Divide each historical code base in the time series into n sub-code modules, and extract dependency features based on the dependencies between modules.

[0008] Preferably, the software development code running parameter acquisition module includes a software development first environment acquisition unit and a software development dynamic environment acquisition unit. The specific contents are as follows: The software development first environment collection unit collects data on code running parameters during the software development process, and performs an initial evaluation of the software development code running based on the collected code running parameters, wherein the evaluation result represents the initial evaluation result of the software development first environment collection unit; The software development dynamic environment collection unit collects code running parameters of the running code to be evaluated after feature optimization, and performs software development code running evaluation based on the collected code running parameters. The evaluation result represents the evaluation result of the software development dynamic environment collection unit.

[0009] Preferably, the first environment collection unit and the software development dynamic environment collection unit use a unified environment assessment model to perform software development code operation assessment, and the construction content of the environment assessment model is as follows: Constructing a trend graph of a code execution node tree according to the code data, wherein the trend graph includes a starting position and an end position; Run the code that passes the test case in a preset benchmark environment, and record the trend graph of the code running node tree to generate a standard tree structure trend graph, wherein the trend graph includes the starting position and the end position; A node tree is constructed for the code running parameters collected by the first environment collection unit of software development, and an environment assessment is performed based on the starting position and the end position of the node tree: when the starting position and the end position of the node tree coincide with the starting position and the end position of the standard tree structure trend chart, the software development code running assessment result is safe running; when the starting position and the end position of the node tree do not coincide with the starting position and the end position of the standard tree structure trend chart, the software development code running assessment result is risky running.

[0010] Preferably, the specific contents of the code feature matching optimization module are as follows: Receive an evaluation result of the software development first environment acquisition unit in the software development code operation parameter acquisition module, mark the code as qualified when the evaluation result of the software development first environment acquisition unit is safe operation, and transmit the result to the code review result output module; When the evaluation result of the software development first environment acquisition unit is risky operation, the code operation parameters are feature optimized to form the operation code to be evaluated, and the operation code to be evaluated is transmitted to the software development dynamic environment acquisition unit for evaluation of the software development code operation.

[0011] Preferably, when the evaluation result of the software development first environment acquisition unit is risky operation, the code operation parameters are subjected to feature optimization processing in three dimensions: syntax, logic, and dependency, to form the specific content of the operation code to be evaluated as follows: Based on the grammatical features extracted by the time series code feature extraction unit in the historical code feature acquisition module according to the control flow complexity, grammatical features are extracted from the code execution parameters, and similarity analysis is performed between the extracted grammatical features and the grammatical feature library of the historical code. If the similarity is higher than a preset first threshold, a grammatical feature replacement instruction is sent to the code execution parameters. Conversely, if the similarity is lower than or equal to the preset first threshold, it indicates that the feature library does not match; Based on the logical features extracted by the time series code feature extraction unit in the historical code feature acquisition module according to the average branch depth, logical features are extracted from the code running parameters, and similarity analysis is performed between the extracted logical features and the logical features of the historical code library. If the similarity is higher than a preset second threshold, a logical feature replacement instruction is sent to the code running parameters. Conversely, if the similarity is lower than or equal to the preset second threshold, it indicates that the feature library does not match; Based on the dependency features extracted by the time series code feature extraction unit in the historical code feature acquisition module according to the dependencies between modules, dependency features are extracted for the code running parameters, and similarity analysis is performed between the extracted dependency features and the dependency features of the historical code library. If the similarity is higher than a preset third threshold, a dependency feature replacement instruction is sent to the code running parameters. Conversely, if the similarity is lower than or equal to a preset second threshold, it indicates that the feature library does not match; When the code feature matching and optimization module receives the replacement instruction, it performs feature optimization on the code running parameters to form the running code to be evaluated.

[0012] Preferably, the specific contents of the code feature optimization analysis module are as follows: The running code to be evaluated is transmitted to the software development dynamic environment acquisition unit, and the evaluation result of the running code to be evaluated is obtained based on the environment evaluation model; When the evaluation result of the running code to be evaluated is safe operation, the review result of the running code to be evaluated is qualified review; when the evaluation result of the running code to be evaluated is risky operation, the review result of the running code to be evaluated is unqualified review.

[0013] Preferably, the code review result output module outputs the code review result based on the evaluation results of the code feature matching optimization module and the code feature optimization analysis module. When the code review result is qualified, the code running result is output to the client, and the code is stored in the historical code library. When the code review result is unqualified, an early warning message is sent to the client.

[0014] The software development code review method based on reinforcement learning includes the following steps: Step S01: extracting code features from a historical code base based on a time series, wherein the code features include grammatical features, logical features, and dependency features; Step S02: collecting code running parameters in the software development process in real time, and completing the evaluation of the software development code running according to the code running parameters; Step S03: When the evaluation result is safe operation, the review result of the running code is qualified. When the evaluation result is risky operation, feature matching optimization is performed on the code to form the running code to be evaluated; Step S04: Obtain the evaluation results of the running code to be evaluated and complete the feature optimization analysis of the software development code; Step S05: Based on the initial evaluation results and feature optimization analysis results of the software development code, output the code review results.

[0015] Technical effects and advantages of the present invention: The present invention provides early warning information to the client by providing a historical code feature collection module, a software development code operation parameter collection module, a code feature matching optimization module, a code feature optimization analysis module, and a code review result output module, thereby improving the code quality and security during the software development process. Extract code features from historical code bases based on time series, collect code operation parameters in real time during the software development process, complete the evaluation of software development code operation, and achieve continuous monitoring of code review; Based on the evaluation results, feature matching optimization is performed on the code running parameters to obtain the evaluation results of the running code to be evaluated after matching optimization. Based on the initial evaluation results and feature optimization analysis results of the software development code, the code review results are output. By using reinforcement learning technology, the code review standards are continuously learned from the historical code base and optimized to adapt to software development projects of different scales and complexities, and to improve the accuracy and efficiency of code review. In addition, it also has a high degree of automation, which can significantly reduce the workload and time cost of manual review and improve the overall efficiency of software development. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 Schematic diagram of the structure of the code review system for software development based on reinforcement learning.

[0017] Figure 2 Flowchart of a code review approach for reinforcement learning-based software development. DETAILED DESCRIPTION

[0018] The technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the present invention. In addition, the forms of the various structures described in the following embodiments are merely examples. The reinforcement learning-based software development code review system and method involved in the present invention are not limited to the various structures described in the following embodiments. All other implementations obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0019] like Figure 1 As shown, the present invention provides a software development code review system based on reinforcement learning, including: a historical code feature acquisition module, a software development code operation parameter acquisition module, a code feature matching optimization module, a code feature optimization analysis module and a code review result output module; The historical code feature acquisition module includes a historical code library storage unit and a time series code feature extraction unit, which extracts code features from the historical code library based on the time series. The code features include grammatical features, logical features, and dependency features. The software development code running parameter acquisition module includes a software development first environment acquisition unit and a software development dynamic environment acquisition unit, which is used to collect code running parameters in the software development process in real time and complete the evaluation of the software development code operation based on the code running parameters; The code feature matching optimization module performs feature matching optimization on the code and generates a running code to be evaluated when the initial assessment result of the software development first environment acquisition unit is safe operation and the initial assessment result of the running code is qualified; when the initial assessment result of the software development first environment acquisition unit is risky operation, the code is optimized; The code feature optimization and analysis module transmits the running code to be evaluated to the software development dynamic environment acquisition unit, obtains the evaluation results of the running code to be evaluated, and completes the feature optimization analysis of the software development code; The code review result output module outputs the code review result based on the initial evaluation result and feature optimization analysis result of the software development code.

[0020] In this embodiment, it should be specifically explained that the historical code feature acquisition module includes a historical code library storage unit and a time series code feature extraction unit. The specific contents are as follows: The historical code library storage unit is used to store historical code data and establish a time series, and to correspond the time series to the historical code data one by one; The time series code feature extraction unit extracts code features from a historical code library according to the time series and establishes a feature library of historical codes. The code features include grammatical features, logical features, and dependency features.

[0021] In this embodiment, it should be specifically explained that the grammatical features, logical features, and dependency features are obtained in the following manner: Syntactic features: Generate an abstract syntax tree for each historical code base in the time series, traverse the abstract syntax tree nodes, and extract syntactic features based on control flow complexity: Use the general tool srcML to convert the code in the historical code base into an abstract syntax tree in XML format. Convert the abstract syntax tree into a traversable structure, recursively visit all nodes using the depth-first traversal method, extract key syntactic structures, and obtain node control flow through static analysis tools. Extract syntactic features based on control flow complexity; Logical features: Generate an abstract syntax tree for each historical code base in the time series, traverse the abstract syntax tree nodes, and extract logical features based on the average branch depth: recursively visit all nodes using the depth-first traversal method, identify control flow nodes, and recursively calculate the branch depth. The average branch depth represents the logic complexity of the code, the maximum branch depth represents the most complex logic path, the branch node ratio represents the density of conditions or loops in the code, and the branch depth variance represents the volatility of the logic path; Dependency features: Divide each historical code base in the time series into n sub-code modules, and extract dependency features based on the dependencies between modules: static call dependency analysis is performed on the n sub-code modules through the import statement in Python, and dynamic dependency analysis is imported using sys.modules to track runtime, obtain the dependencies between modules, and extract dependency features, where the dependency out-degree represents the number of other modules that the current module depends on, the dependency in-degree represents the number of other modules that depend on the current module, the dependency density represents the ratio of the actual number of dependencies to the maximum possible number of dependencies, and the circular dependency number represents the number of modules that meet the strong connectivity component, where the strong connectivity component is a preset threshold.

[0022] In this embodiment, it should be specifically explained that the software development code running parameter acquisition module includes the software development first environment acquisition unit and the software development dynamic environment acquisition unit. The specific contents are as follows: The software development first environment collection unit collects data on code running parameters during the software development process, and performs an initial evaluation of the software development code running based on the collected code running parameters, wherein the evaluation result represents the initial evaluation result of the software development first environment collection unit; The software development dynamic environment collection unit collects code running parameters of the running code to be evaluated after feature optimization, and performs software development code running evaluation based on the collected code running parameters. The evaluation result represents the evaluation result of the software development dynamic environment collection unit.

[0023] In this embodiment, it should be specifically explained that the first environment collection unit and the software development dynamic environment collection unit use a unified environment assessment model to perform software development code operation assessment. The construction content of the environment assessment model is as follows: Constructing a trend graph of a code execution node tree according to the code data, wherein the trend graph includes a starting position and an end position; Run the code that passes the test case in a preset benchmark environment, and record the trend graph of the code running node tree to generate a standard tree structure trend graph, wherein the trend graph includes the starting position and the end position; A node tree is constructed for the code running parameters collected by the first environment collection unit of software development, and an environment assessment is performed based on the starting position and the end position of the node tree: when the starting position and the end position of the node tree coincide with the starting position and the end position of the standard tree structure trend chart, the software development code running assessment result is safe running; when the starting position and the end position of the node tree do not coincide with the starting position and the end position of the standard tree structure trend chart, the software development code running assessment result is risky running.

[0024] In this embodiment, it should be specifically explained that the specific contents of the code feature matching optimization module are as follows: Receive an evaluation result of a software development first environment acquisition unit in a software development code operation parameter acquisition module, and when the evaluation result of the software development first environment acquisition unit is safe operation, mark the code as qualified, and transmit the code review result to a code review result output module; When the evaluation result of the software development first environment acquisition unit is risky operation, the code operation parameters are feature optimized to form the operation code to be evaluated, and the operation code to be evaluated is transmitted to the software development dynamic environment acquisition unit for evaluation of the software development code operation.

[0025] In this embodiment, it should be specifically explained that when the assessment result of the software development first environment acquisition unit is risky operation, the code operation parameters are subjected to feature optimization processing in three dimensions: syntax, logic, and dependency, to form the specific content of the running code to be evaluated as follows: Based on the grammatical features extracted by the time series code feature extraction unit in the historical code feature acquisition module according to the control flow complexity, grammatical features are extracted from the code execution parameters, and similarity analysis is performed between the extracted grammatical features and the grammatical feature library of the historical code. If the similarity is higher than a preset first threshold, a grammatical feature replacement instruction is sent to the code execution parameters. Conversely, if the similarity is lower than or equal to the preset first threshold, it indicates that the feature library does not match; Based on the logical features extracted by the time series code feature extraction unit in the historical code feature acquisition module according to the average branch depth, logical features are extracted from the code running parameters, and similarity analysis is performed between the extracted logical features and the logical features of the historical code library. If the similarity is higher than a preset second threshold, a logical feature replacement instruction is sent to the code running parameters. Conversely, if the similarity is lower than or equal to the preset second threshold, it indicates that the feature library does not match; Based on the dependency features extracted by the time series code feature extraction unit in the historical code feature acquisition module according to the dependencies between modules, dependency features are extracted for the code running parameters, and similarity analysis is performed between the extracted dependency features and the dependency features of the historical code library. If the similarity is higher than a preset third threshold, a dependency feature replacement instruction is sent to the code running parameters. Conversely, if the similarity is lower than or equal to a preset second threshold, it indicates that the feature library does not match; The specific analysis content of the similarity analysis is: constructing a feature vector by comparing the historical code base and the running code and ,in Represents the feature vector sequence constructed by the historical code base based on the time series, i represents the number of the time series, and the feature vector constructed by running the code Feature vectors constructed with historical code bases Perform cosine similarity analysis to obtain similarity analysis results; The first threshold is a judgment threshold preset based on grammatical features in the historical code base, the second threshold is a judgment threshold preset based on logical features in the historical code base, and the third threshold is a judgment threshold preset based on dependency features in the historical code base; When the code feature matching optimization module receives the replacement instruction, it performs feature optimization on the code running parameters to form the running code to be evaluated. The feature optimization means replacing the original code with the corresponding matching code in the historical code library when judging the match.

[0026] In this embodiment, it should be specifically explained that the specific contents of the code feature optimization and analysis module are as follows: The running code to be evaluated is transmitted to the software development dynamic environment acquisition unit, and the evaluation result of the running code to be evaluated is obtained based on the environment evaluation model; When the evaluation result of the running code to be evaluated is safe operation, the review result of the running code to be evaluated is qualified review; when the evaluation result of the running code to be evaluated is risky operation, the review result of the running code to be evaluated is unqualified review.

[0027] In this embodiment, it should be specifically explained that the code review result output module outputs the code review result based on the evaluation results of the code feature matching optimization module and the code feature optimization analysis module. When the code review result is qualified, the code running result is output to the client, and the code is stored in the historical code library. When the code review result is unqualified, an early warning message is sent to the client.

[0028] like Figure 2 As shown, in this embodiment, it should be specifically explained that the software development code review method based on reinforcement learning includes the following steps: Step S01: extracting code features from a historical code base based on a time series, wherein the code features include grammatical features, logical features, and dependency features; Step S02: collecting code running parameters in the software development process in real time, and completing the evaluation of the software development code running according to the code running parameters; Step S03: When the evaluation result is safe operation, the review result of the running code is qualified. When the evaluation result is risky operation, feature matching optimization is performed on the code to form the running code to be evaluated; Step S04: Obtain the evaluation results of the running code to be evaluated and complete the feature optimization analysis of the software development code; Step S05: Based on the initial evaluation results and feature optimization analysis results of the software development code, output the code review results.

[0029] In this embodiment, it should be specifically noted that the main difference between this embodiment and the prior art is that this embodiment provides early warning information to the client by providing a historical code feature collection module, a software development code operation parameter collection module, a code feature matching optimization module, a code feature optimization analysis module, and a code review result output module, thereby improving the code quality and security during the software development process; Extract code features from historical code bases based on time series, collect code operation parameters in real time during the software development process, complete the evaluation of software development code operation, and achieve continuous monitoring of code review; Based on the evaluation results, feature matching optimization is performed on the code running parameters to obtain the evaluation results of the running code to be evaluated after matching optimization. Based on the initial evaluation results and feature optimization analysis results of the software development code, the code review results are output. By using reinforcement learning technology, the code review standards are continuously learned from the historical code base and optimized to adapt to software development projects of different scales and complexities, and to improve the accuracy and efficiency of code review. In addition, it also has a high degree of automation, which can significantly reduce the workload and time cost of manual review and improve the overall efficiency of software development.

[0030] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

[0031] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A software development code review system based on reinforcement learning, characterized by: include: Historical code feature collection module, software development code operation parameter collection module, code feature matching optimization module, code feature optimization analysis module, and code review result output module; The historical code feature acquisition module includes a historical code library storage unit and a time series code feature extraction unit, which extracts code features from the historical code library based on the time series. The code features include grammatical features, logical features, and dependency features. The software development code running parameter acquisition module includes a software development first environment acquisition unit and a software development dynamic environment acquisition unit, which is used to collect code running parameters in the software development process in real time and complete the evaluation of the software development code operation based on the code running parameters; The code feature matching optimization module performs feature matching optimization on the code and generates a running code to be evaluated when the initial assessment result of the software development first environment acquisition unit is safe operation and the initial assessment result of the running code is qualified; when the initial assessment result of the software development first environment acquisition unit is risky operation, the code is optimized; The code feature optimization and analysis module transmits the running code to be evaluated to the software development dynamic environment acquisition unit, obtains the evaluation results of the running code to be evaluated, and completes the feature optimization analysis of the software development code; The code review result output module outputs the code review result based on the initial evaluation result and feature optimization analysis result of the software development code.

2. The software development code review system based on reinforcement learning according to claim 1, characterized in that: The historical code feature acquisition module includes a historical code library storage unit and a time series code feature extraction unit. The specific contents are as follows: The historical code library storage unit is used to store historical code data and establish a time series, and to correspond the time series to the historical code data one by one; The time series code feature extraction unit extracts code features from a historical code library according to the time series and establishes a feature library of historical codes. The code features include grammatical features, logical features, and dependency features.

3. The software development code review system based on reinforcement learning according to claim 2, characterized in that: The grammatical features, logical features and dependency features are obtained as follows: Syntax features: Generate an abstract syntax tree for each historical code base in the time series, traverse the abstract syntax tree nodes, and extract syntax features based on control flow complexity; Logical features: Generate an abstract syntax tree for each historical code base in the time series, traverse the abstract syntax tree nodes, and extract logical features based on the average branch depth; Dependency features: Divide each historical code base in the time series into n sub-code modules, and extract dependency features based on the dependencies between modules.

4. The software development code review system based on reinforcement learning according to claim 1, characterized in that: The software development code running parameter acquisition module includes the software development first environment acquisition unit and the software development dynamic environment acquisition unit. The specific contents are as follows: The software development first environment collection unit collects data on code running parameters during the software development process, and performs an initial evaluation of the software development code running based on the collected code running parameters, wherein the evaluation result represents the initial evaluation result of the software development first environment collection unit; The software development dynamic environment collection unit collects code running parameters of the running code to be evaluated after feature optimization, and performs software development code running evaluation based on the collected code running parameters. The evaluation result represents the evaluation result of the software development dynamic environment collection unit.

5. The software development code review system based on reinforcement learning according to claim 4, characterized in that: The first environment collection unit and the software development dynamic environment collection unit use a unified environment assessment model to perform software development code operation assessment. The construction content of the environment assessment model is as follows: Constructing a trend graph of a code execution node tree according to the code data, wherein the trend graph includes a starting position and an end position; Run the code that passes the test case in a preset benchmark environment, and record the trend graph of the code running node tree to generate a standard tree structure trend graph, wherein the trend graph includes the starting position and the end position; A node tree is constructed for the code running parameters collected by the first environment collection unit of software development, and an environment assessment is performed based on the starting position and the end position of the node tree: when the starting position and the end position of the node tree coincide with the starting position and the end position of the standard tree structure trend chart, the software development code running assessment result is safe running; when the starting position and the end position of the node tree do not coincide with the starting position and the end position of the standard tree structure trend chart, the software development code running assessment result is risky running.

6. The software development code review system based on reinforcement learning according to claim 1, characterized in that: The specific contents of the code feature matching optimization module are as follows: Receive an evaluation result of the software development first environment acquisition unit in the software development code operation parameter acquisition module, mark the code as qualified when the evaluation result of the software development first environment acquisition unit is safe operation, and transmit the result to the code review result output module; When the evaluation result of the software development first environment acquisition unit is risky operation, the code operation parameters are feature optimized to form the operation code to be evaluated, and the operation code to be evaluated is transmitted to the software development dynamic environment acquisition unit for evaluation of the software development code operation.

7. The software development code review system based on reinforcement learning according to claim 6, characterized in that: When the evaluation result of the software development first environment collection unit is risky operation, the code operation parameters are optimized in three dimensions: syntax, logic, and dependency. The specific content of the operation code to be evaluated is as follows: Based on the grammatical features extracted by the time series code feature extraction unit in the historical code feature acquisition module according to the control flow complexity, grammatical features are extracted from the code execution parameters, and similarity analysis is performed between the extracted grammatical features and the grammatical feature library of the historical code. If the similarity is higher than a preset first threshold, a grammatical feature replacement instruction is sent to the code execution parameters. Conversely, if the similarity is lower than or equal to the preset first threshold, it indicates that the feature library does not match; Based on the logical features extracted by the time series code feature extraction unit in the historical code feature acquisition module according to the average branch depth, logical features are extracted from the code running parameters, and similarity analysis is performed between the extracted logical features and the logical features of the historical code library. If the similarity is higher than a preset second threshold, a logical feature replacement instruction is sent to the code running parameters. Conversely, if the similarity is lower than or equal to the preset second threshold, it indicates that the feature library does not match; Based on the dependency features extracted by the time series code feature extraction unit in the historical code feature acquisition module according to the dependencies between modules, dependency features are extracted for the code running parameters, and similarity analysis is performed between the extracted dependency features and the dependency features of the historical code library. If the similarity is higher than a preset third threshold, a dependency feature replacement instruction is sent to the code running parameters. Conversely, if the similarity is lower than or equal to a preset second threshold, it indicates that the feature library does not match; When the code feature matching and optimization module receives the replacement instruction, it performs feature optimization on the code running parameters to form the running code to be evaluated.

8. The software development code review system based on reinforcement learning according to claim 1, characterized in that: The specific contents of the code feature optimization and analysis module are as follows: The running code to be evaluated is transmitted to the software development dynamic environment acquisition unit, and the evaluation result of the running code to be evaluated is obtained based on the environment evaluation model; When the evaluation result of the running code to be evaluated is safe operation, the review result of the running code to be evaluated is qualified review; when the evaluation result of the running code to be evaluated is risky operation, the review result of the running code to be evaluated is unqualified review.

9. The software development code review system based on reinforcement learning according to claim 1, characterized in that: The code review result output module outputs the code review result based on the evaluation results of the code feature matching optimization module and the code feature optimization analysis module. When the code review result is qualified, the code running result is output to the client and the code is stored in the historical code library. When the code review result is unqualified, an early warning message is sent to the client.

10. A software development code review method based on reinforcement learning, for use with the software development code review system based on reinforcement learning according to any one of claims 1 to 9, characterized in that: The following steps are involved: Step S01: extracting code features from a historical code base based on a time series, wherein the code features include grammatical features, logical features, and dependency features; Step S02: collecting code running parameters in the software development process in real time, and completing the evaluation of the software development code running according to the code running parameters; Step S03: When the evaluation result is safe operation, the review result of the running code is qualified. When the evaluation result is risky operation, feature matching optimization is performed on the code to form the running code to be evaluated; Step S04: Obtain the evaluation results of the running code to be evaluated and complete the feature optimization analysis of the software development code; Step S05: Based on the initial evaluation results and feature optimization analysis results of the software development code, output the code review results.

Citation Information

Cited By

  • Power terminal dynamic code immunization method based on genetic map

    CN120803427A

  • Online jar package operation intelligent identification method and system based on AI

    CN120995468A