Code review method and device and related equipment
By acquiring the associated information of modified code snippets and performing multi-dimensional analysis, and combining this with a knowledge base to generate targeted review suggestions, the problem of insufficient accuracy in code review in existing technologies is solved, achieving more efficient and accurate code review.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING QIYI CENTURY SCI & TECH CO LTD
- Filing Date
- 2025-12-17
- Publication Date
- 2026-04-17
AI Technical Summary
Existing code review methods lack a holistic perspective, resulting in poor accuracy of review results.
Obtain modified code snippets and their associated information, perform multi-dimensional analysis using preset coding standards, including coding standards, logical errors, performance analysis, and code smell identification, and generate targeted review suggestions based on a knowledge base.
It improves the accuracy and efficiency of code review, reduces subjective bias in manual review, and lowers subsequent maintenance costs and logical vulnerability risks caused by non-standard coding.
Smart Images

Figure CN121880155A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software development technology, and in particular to a code review method, apparatus, and related equipment. Background Technology
[0002] In the software development process, code review is an essential step to ensure software quality, identify potential defects, and improve code maintainability. Currently, code review is typically tightly integrated with the merge request (or pull request) workflow in version control systems, allowing code changes submitted by developers to trigger a review request, which is then reviewed by other team members or automated tools.
[0003] However, the current code review method only reviews the text of the differences (Diff) in code changes, lacking a global perspective, resulting in poor accuracy of the review results. Summary of the Invention
[0004] The purpose of this invention is to provide a code review method, apparatus, and related equipment to solve the problem of poor accuracy in code review results in the prior art. The specific technical solution is as follows:
[0005] In a first aspect of the present invention, a code review method is provided, applied to a code review system, the method comprising:
[0006] Obtain the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet. The associated information is used to provide data support for the review of the modified code.
[0007] The modified code snippet and the associated information are parsed using a preset coding standard to determine the analysis result of the modified code snippet. The analysis result is used to indicate whether the modified code snippet is compliant.
[0008] If the analysis results indicate that the modified code snippet contains non-compliant segments, the system matches the suggestion information corresponding to the analysis results from the first knowledge base within the code review system to obtain a first review suggestion for the modified code snippet. The first review suggestion is used to guide the compliant modification of the modified code snippet.
[0009] Optionally, obtaining the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet includes:
[0010] Parse the Document Object Model (DOM) of the first page to determine the metadata content of the modified code snippet. The metadata content includes the file path, and the first page is the page where the modified code snippet is located.
[0011] Parse the DOM of the second page to extract the text content containing all lines and obtain the full-text code. The second page is the page determined according to the file path, and the full-text code is the complete code corresponding to the modified code fragment.
[0012] The full-text code is analyzed to obtain call chain information, which is the call relationship chain corresponding to the modified code fragment;
[0013] The dependency configuration file of the modified code snippet is parsed in the root directory of the project containing the modified code snippet to obtain the dependency information, which is the resource that the modified code snippet depends on to run.
[0014] Optionally, the step of parsing the modified code fragment and the associated information using a preset encoding standard to determine the analysis result of the modified code fragment includes at least one of the following:
[0015] The structured elements in the full-text code are extracted and compared with the preset coding standard to obtain the coding standard analysis result. The structured elements are used to indicate the structure and logic of the code, and the coding standard analysis result is used to evaluate the format specification of the modified code fragment.
[0016] Based on the structured elements, the call chain information, and the dependency information, logical operation deduction is performed to obtain logical error analysis results. The logical error analysis results are used to evaluate the logical specifications of the modified code segment.
[0017] Based on the complexity of the structured elements, the call frequency of the call chain information, and the resource consumption characteristics of the dependency information, performance analysis results are obtained, and the performance analysis results are used to evaluate the running performance of the modified code snippet.
[0018] Based on the full-text code, the call chain information, and the preset code odor identification rules, code odor analysis results are obtained. The code odor analysis results are used to evaluate the non-functional defect characteristics of the modified code fragment, and the preset code odor identification rules are used to indicate the characteristics of the code odor.
[0019] Optionally, after obtaining the first review suggestion for the modified code snippet, the method further includes:
[0020] If the first review suggestion is evaluated and it is determined that the first review suggestion includes preset suggestion information to be verified, a second knowledge base associated with the code review system is invoked to obtain extended information of the target content in the second knowledge base. The target content is keywords extracted based on the preset suggestion information, and the extended information is used to supplement the preset suggestion information.
[0021] The extended information is fused with the preset suggestion information to generate a second review suggestion for the modified code fragment.
[0022] Optionally, the preset suggestion information includes first preset suggestion information, second preset suggestion information, and third preset suggestion information;
[0023] When evaluating the first review suggestion and determining that it includes preset suggestion information to be verified, the step of invoking a second knowledge base associated with the code review system to obtain extended information about the target content from the second knowledge base includes:
[0024] Calculate the matching degree between the first review suggestion and each preset suggestion in the first knowledge base. If the matching degree is less than a preset threshold, determine that the first review suggestion includes first preset suggestion information, where the first preset suggestion information is a suggestion to be further explained.
[0025] A completeness check is performed on the first review suggestion. If the first review suggestion lacks explanation or example, it is determined that the first review suggestion includes second preset suggestion information, and the second preset suggestion information is a suggestion with insufficient completeness.
[0026] The first review suggestion is subjected to a content to be verified detection. If the first review suggestion contains content to be verified, it is determined that the first review suggestion includes third preset suggestion information, and the third preset suggestion information is a suggestion to be verified.
[0027] Based on the target content determined from the preset suggestion information, extended information of the target content is extracted from the second knowledge base.
[0028] Optionally, after fusing the extended information with the preset suggestion information to generate the second review suggestion for the modified code snippet, the method further includes:
[0029] The second review recommendation will be displayed on the page where the modified code snippet is located. The second review recommendation is used to guide the compliant modification of the modified code snippet.
[0030] In a second aspect of the invention, a code review apparatus is provided for use in a code review system, the apparatus comprising:
[0031] The acquisition module is used to acquire the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet. The associated information is used to provide data support for the review of the modified code.
[0032] The determination module is used to parse the modified code fragment and the associated information using a preset coding standard, and determine the analysis result of the modified code fragment. The analysis result is used to indicate whether the modified code fragment is compliant.
[0033] A generation module is used to, when the analysis results indicate that the modified code snippet contains non-compliant segments, match the suggestion information corresponding to the analysis results from the first knowledge base within the code review system to obtain a first review suggestion for the modified code snippet. The first review suggestion is used to guide the compliant modification of the modified code snippet.
[0034] In a third aspect of the present invention, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.
[0035] Memory, used to store programs;
[0036] When a processor executes a program stored in memory, it implements the method described in the first aspect.
[0037] In a fourth aspect of the invention, a readable storage medium is provided having a program stored thereon that, when executed by a processor, implements the method described in the first aspect.
[0038] In a fifth aspect of the invention, a computer program product is provided, including computer instructions that, when executed by a processor, implement the method described in the first aspect.
[0039] In this embodiment of the invention, not only are modified code snippets acquired, but also corresponding related information is supplemented, reducing the limitations of lacking a global perspective and avoiding misjudgments due to incomplete information. Then, based on preset coding standards, multi-dimensional analysis is performed on the modified code snippets and related information, improving the comprehensiveness of the analysis results, reducing blind spots in single-dimensional reviews, minimizing the omission of potential code problems, and improving the accuracy of the analysis results. For non-compliant snippets identified in the analysis results, corresponding suggestion information is matched from the first knowledge base, making the generated first review suggestion highly targeted and directly guiding the compliant modification of the modified code snippets. This improves the efficiency of code review, reduces subjective bias in manual review, enhances the comprehensiveness and accuracy of review results, and effectively reduces subsequent maintenance costs and logical vulnerability risks caused by non-standard coding. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0041] Figure 1 This is one of the flowcharts illustrating a code review method in an embodiment of the present invention;
[0042] Figure 2 This is a second flowchart illustrating a code review method in an embodiment of the present invention;
[0043] Figure 3 This is a schematic diagram of the structure of a code review device according to an embodiment of the present invention;
[0044] Figure 4 This is a structural diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0046] Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. A process can be terminated when its operation is complete, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0047] Furthermore, the terms "first," "second," etc., may be used herein to describe various directions, actions, steps, or elements, but these directions, actions, steps, or elements are not limited by these terms. These terms are used only to distinguish one direction, action, step, or element from another. The terms "first," "second," etc., should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0048] This invention provides a code review method, applied to a code review system, such as... Figure 1 As shown, the steps of this method include:
[0049] Step 101: Obtain the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet. The associated information is used to provide data support for the review of the modified code.
[0050] In this step, the code review method can be applied to a code review system, which can implement code review based on the browser-use capability of a general-purpose intelligent agent. First, the intelligent agent can simulate a user logging into a code hosting platform such as GitLab or GitHub in a browser and navigating to the Merge Request or Pull Request page to be reviewed. The intelligent agent can parse the page's Document Object Model (DOM) structure to identify and extract the modified code snippets (i.e., Diff snippets) to be reviewed in the Merge Request or Pull Request, along with the corresponding related information. This related information provides data support for the review of Diff snippets, reducing limitations caused by a lack of a global perspective and providing more information for subsequent review and analysis of Diff snippets, avoiding misjudgments due to incomplete information. This related information can include the full code, call chain information, and dependency information.
[0051] For example, an agent can access and download, or directly read, the entire source file involved in the modification in a browser to obtain the full-text code. The full-text code is the complete code of the file to which the modified code snippet belongs (not just the Diff snippet). For instance, if the Diff only shows the modification of lines 10-15 of a function, the full-text code contains all lines of the file containing that function (such as lines 1-200), clearly indicating the position of the modification in the overall file logic.
[0052] The agent can also analyze the project structure and code reference relationships to attempt to construct or obtain call chain information corresponding to the modified code snippet. This call chain information can be a chain of function / method calls involved in the modified code, for example, modified funcA() → calls funcB() → calls funcC(). By analyzing code reference relationships and generating cross-file tracing data, this information can be used to determine whether the modification affects other related logic.
[0053] In addition, the agent can also identify and obtain the dependency information corresponding to the modified code snippet. The dependency information can be the resources required for the modified code to run, including internal modules within the project (such as .. / utils / tool.js) and external third-party libraries (such as axios and React). It is obtained by parsing the code import statements and the project dependency configuration files (package.json, requirements.txt), and can be used to troubleshoot code problems such as missing dependencies and version conflicts.
[0054] Step 102: Analyze the modified code fragment and the associated information using a preset coding standard to determine the analysis result of the modified code fragment. The analysis result is used to indicate whether the modified code fragment is compliant.
[0055] In this step, a pre-defined coding standard is used as a unified judgment criterion. The modified code snippets to be reviewed, along with their corresponding related information, are systematically analyzed to determine the analysis results. These results indicate whether the modified code snippets are compliant. The analysis not only checks whether the syntax and writing style of the modified code snippets conform to the pre-defined coding standards (such as naming rules, indentation format, and comment requirements), but also identifies coding standard issues such as non-standard naming, inconsistent indentation, and lack of comments for critical functions. This results in a coding standard analysis that indicates the compliance of the modified code with coding standards.
[0056] At the same time, it combines call chain information (such as function / module call relationships, parameter passing logic, etc.) and dependency information (such as the completeness and compatibility of runtime dependencies), and according to the logic error judgment rules, it identifies problems such as missing boundary conditions, parameter mismatch, dependency conflicts, and missing logical flow loops in the modified code, so as to obtain logic error analysis results. The logic error analysis results indicate whether there are defects in the modified code that can cause abnormal operation or logical failure.
[0057] Furthermore, based on the full code, call chain information (such as call level and frequency), and dependency information (such as dependency loading method and resource consumption), combined with preset performance evaluation rules (such as loop nesting level threshold, resource consumption benchmark, and upper limit of interface call frequency), the execution efficiency, resource consumption, and response time of the modified code are analyzed to identify performance bottlenecks (such as excessive loop nesting, frequent creation of large objects, and redundant dependency loading) in order to obtain performance analysis results. The performance analysis results indicate the performance loss and optimization space of the modified code.
[0058] In addition, based on preset code smell identification rules (such as duplicate code similarity threshold, function line count limit, class dependency number threshold, etc.), modified code snippets and full-text code can be analyzed to detect features such as duplicate code, excessively long functions / classes, excessive coupling, ambiguous naming, and mismatch between comments and logic, so as to obtain code smell analysis results. The code smell analysis results indicate potential problems in the maintainability, readability, and extensibility of the modified code.
[0059] In this way, the results of coding standard analysis, logical error analysis, performance analysis, and code smell analysis together constitute the analysis results of the modified code snippets. This covers the compliance of the modified code in multiple dimensions, including compliance, logical correctness, performance, and long-term maintainability, reducing the omission of code issues during the review process and improving the accuracy of the analysis results.
[0060] Step 103: If the analysis result indicates that the modified code segment contains non-compliant segments, match the suggestion information corresponding to the analysis result from the first knowledge base in the code review system to obtain the first review suggestion for the modified code segment. The first review suggestion is used to guide the compliant modification of the modified code segment.
[0061] In this step, the first knowledge base can be a knowledge base deployed within the code review system. For example, the first knowledge base can include project-customized coding standards (such as using underscores for variable names in Python projects), review rules (such as interface functions must include parameter validation), a general code defect solution library (such as common fixes for null pointer exceptions, standard methods for performance optimization, etc.), and historical review cases for the project (such as suggestions for handling past code issues). Thus, for coding standardization issues, such as the variable name "userName" not conforming to the project's underscore naming convention, it can be suggested to change it to "user_name"; for logical errors, such as when funcA() calls funcB() with a string parameter type, while funcB() requires an integer, it can be suggested to add type conversion logic, such as Number(param); for performance issues, such as creating a new Object() every time in a loop wastes resources, it can be suggested to move object creation outside the loop. By matching the problem type and specific characteristics in the analysis results with the preset mapping rules of the first knowledge base, the corresponding suggestion information is extracted and integrated, ultimately generating the first review suggestion for the modified code snippet. The first review recommendations are used to guide the compliant modification of the modified code snippets. For example, the first review recommendations include coding style suggestions (such as naming conventions, indentation, and comment requirements), potential logical errors or missing boundary conditions, performance optimization suggestions, readability or maintainability improvement suggestions, security vulnerability warnings, etc. They provide compliant modifications to the modified code snippets from multiple dimensions, are highly targeted and implementable, and can directly guide developers to make precise compliant modifications to non-compliant segments in the modified code.
[0062] In this embodiment of the invention, not only are modified code snippets acquired, but also corresponding related information is supplemented, reducing the limitations of lacking a global perspective and avoiding misjudgments due to incomplete information. Then, based on preset coding standards, multi-dimensional analysis is performed on the modified code snippets and related information, improving the comprehensiveness of the analysis results, reducing blind spots in single-dimensional reviews, minimizing the omission of potential code problems, and enhancing the accuracy of the analysis results. For non-compliant snippets identified in the analysis results, corresponding suggestion information is matched from a first knowledge base, making the generated first review suggestion highly targeted and directly guiding the compliant modification of the modified code snippets. This improves the efficiency of code review, reduces subjective bias in manual review, enhances the comprehensiveness and accuracy of review results, and effectively reduces subsequent maintenance costs and logical vulnerability risks caused by non-standard coding.
[0063] Optionally, step 101, obtaining the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet, includes:
[0064] Parse the Document Object Model (DOM) of the first page to determine the metadata content of the modified code snippet. The metadata content includes the file path, and the first page is the page where the modified code snippet is located.
[0065] Parse the DOM of the second page to extract the text content containing all lines and obtain the full-text code. The second page is the page determined according to the file path, and the full-text code is the complete code corresponding to the modified code fragment.
[0066] The full-text code is analyzed to obtain call chain information, which is the call relationship chain corresponding to the modified code fragment;
[0067] The dependency configuration file of the modified code snippet is parsed in the root directory of the project containing the modified code snippet to obtain the dependency information, which is the resource that the modified code snippet depends on to run.
[0068] In this embodiment, the intelligent agent parses the DOM structure of the first page using browser automation tools (such as Playwright) and locates the core container of the Diff area (such as GitLab's div.diff-file, GitHub's div.FileDiff, etc.). It can extract metadata such as file paths from the container. For example, it can directly read the path from the DOM attribute data-file-path, avoiding errors caused by manual searching.
[0069] Then, based on the extracted file paths, the agent locates the "View Full File" link on the first page (such as GitLab's `a[href*=" / blob / "]` or GitHub's "View file" button). The agent can simulate human actions by clicking the link to navigate to the second page. It then parses the DOM of the second page, such as GitLab's `div.blob-contentpre` or GitHub's `table.file-code td.blob-code`, to extract the text content containing all lines. After concatenation, the full code is obtained. Each code file has a unique path corresponding to an independent page, used to fully present the latest or specified version of the file's code.
[0070] After obtaining the full-text code, an Abstract Syntax Tree (AST) analysis can be performed. For example, the agent inputs the full-text code into an AST parsing tool (such as `@babel / parser` for JavaScript or the `ast` module for Python), converting the code text into a structured syntax tree. The syntax tree clearly marks core elements such as function definitions, function calls, and variable references; it locates the functions / methods involved in the code modifications; and it traces the call statements within those functions—for example, `handleSubmit` calls `validateForm`—thus identifying the name and location of the called function and forming a preliminary call relationship. If the called function is defined in the full-text code, its internal calls are recursively traced, ultimately constructing a complete call chain. This avoids omissions from manually reading the code to find call relationships and provides a basis for subsequent judgments on whether modifications trigger cascading logical problems.
[0071] Furthermore, the agent can simulate navigation to the root directory page of the project containing the modified code (such as GitLab's / tree / [branch name] page) based on project association information; locate dependency configuration files in the root directory, for example, matching them according to the project's technology stack, such as package.json for front-end projects, requirements.txt for Python projects, and pom.xml for Java projects; clicking on the configuration file jumps to its display page, parses the file content DOM, and extracts dependency information. This dependency information can include external and internal dependencies, which are integrated to form dependency information, clearly identifying the internal and external resources that the modified code depends on. Dependency information can identify version incompatibility issues in advance, avoiding errors after code merging.
[0072] Optionally, step 102, parsing the modified code fragment and the associated information using a preset encoding standard to determine the analysis result of the modified code fragment, includes at least one of the following:
[0073] The structured elements in the full-text code are extracted and compared with the preset coding standard to obtain the coding standard analysis result. The structured elements are used to indicate the structure and logic of the code, and the coding standard analysis result is used to evaluate the format specification of the modified code fragment.
[0074] Based on the structured elements, the call chain information, and the dependency information, logical operation deduction is performed to obtain logical error analysis results. The logical error analysis results are used to evaluate the logical specifications of the modified code segment.
[0075] Based on the complexity of the structured elements, the call frequency of the call chain information, and the resource consumption characteristics of the dependency information, performance analysis results are obtained, and the performance analysis results are used to evaluate the running performance of the modified code snippet.
[0076] Based on the full-text code, the call chain information, and the preset code odor identification rules, code odor analysis results are obtained. The code odor analysis results are used to evaluate the non-functional defect characteristics of the modified code fragment, and the preset code odor identification rules are used to indicate the characteristics of the code odor.
[0077] In one embodiment, structured elements are extracted from the full-text code. These structured elements can include function information, variable information, control flow information, and data structure information. These structured elements directly reflect the underlying structure and execution logic of the code. By comparing these structured elements with preset coding standards dimension by dimension, a coding standard analysis result is generated, including naming, formatting, and commenting issues, ensuring that the modified code snippets meet the formatting standards. For example, if the extracted "variable information" shows that a variable is named "u_name," but the preset coding standard requires the front-end code to use camelCase naming, the coding standard analysis result will mark "Variable naming violates regulations and needs to be adjusted to userName."
[0078] In one embodiment, the structured elements extracted from the full-text code are used as the core, combined with the call chain information and dependency information in the associated information, to simulate and deduce the execution logic of the modified code. For example, this involves verifying whether parameter passing matches, whether boundary conditions are covered, whether dependent resource calls are complete, and whether control flow execution is closed-loop. A logic error analysis result is generated to evaluate the logical compliance of the modified code fragment and identify logical defects such as missing boundary conditions, parameter mismatches, dependency conflicts, and control flow anomalies. For example, if the call chain information shows that function A needs to receive three parameters (a, b, and c), but the modified code only passes two parameters (b and c) to function A, after logical deduction, the logic error analysis result will mark "parameter mismatch, function A needs to call the missing parameter a".
[0079] In one embodiment, a quantitative evaluation is conducted by comprehensively considering the complexity of structured elements, the call frequency of call chain information, and the resource consumption characteristics of dependency information. The complexity of structured elements can be the number of nested functions, data structure complexity, or number of loops; the call frequency of call chain information can be the number of times a function is called or the level of cross-module calls; and the resource consumption characteristics of dependency information can be the memory usage of dependency packages, the time consumption of third-party interface calls, or the query efficiency of database dependencies. Based on the complexity of functions and variables, call frequency, and dependency resource consumption characteristics, performance risks such as inefficient loops are identified, and performance analysis results are obtained to evaluate the runtime performance of modified code snippets and locate performance degradation issues such as excessive nested loops, high-frequency invalid calls, and the use of high-cost dependencies. For example, if the structured elements show that a function has a nested level of 5 (taking a preset threshold of 3 levels as an example), and the call chain information shows that the function is called frequently (100 times per second), the performance analysis result will indicate "High function nesting complexity, high-frequency calls, performance degradation risk, it is recommended to split the function."
[0080] In one embodiment, the full-text code and call chain information in the associated information are the main analysis objects. Combined with preset code smell identification rules, such as predefined quantifiable rules indicating code smell characteristics (e.g., duplicate code similarity threshold, excessively long function line count threshold, class dependency count threshold), non-functional defects in the modified code are detected. These defects include duplicate code, excessively long functions, over-coupling, and ambiguous naming. While non-functional defects do not directly cause runtime errors, they reduce code readability and maintainability. For example, if the text similarity between two function logic segments in the full-text code reaches 90% (taking the preset threshold of 80% as an example), the code smell analysis result will indicate "Duplicate code smell exists; it is recommended to encapsulate it as a common function."
[0081] In this way, by parsing the modified code snippets and related information, the analysis results of the modified code snippets are determined. This covers a full range of evaluations of the code, from basic formatting to logical correctness, runtime performance, and long-term maintainability. It comprehensively uncovers code problems from multiple dimensions, reduces the omission of code problems during the review process, improves the accuracy of the analysis results, and lays the foundation for generating accurate review suggestions in the future.
[0082] Optionally, after step 103, obtaining the first review suggestion for the modified code snippet, the method further includes:
[0083] If the first review suggestion is evaluated and it is determined that the first review suggestion includes preset suggestion information to be verified, a second knowledge base associated with the code review system is invoked to obtain extended information of the target content in the second knowledge base. The target content is keywords extracted based on the preset suggestion information, and the extended information is used to supplement the preset suggestion information.
[0084] The extended information is fused with the preset suggestion information to generate a second review suggestion for the modified code fragment.
[0085] In this embodiment, after generating the first review suggestion, it is evaluated to determine whether it contains preset suggestion information to be verified. If such information exists, the first review suggestion is considered to contain content with insufficient confidence, incomplete information, or requiring external verification. Based on this, keywords can be extracted from the preset suggestion information as target content, and relevant extended information can be obtained by calling an online second knowledge base. Finally, the extended information is integrated with the preset suggestion information to generate a more comprehensive and accurate second review suggestion, thereby making up for the information gaps that may exist in the first review suggestion and improving the reliability and richness of the code review suggestions.
[0086] In some optional embodiments, the preset suggestion information includes a first preset suggestion information, a second preset suggestion information, and a third preset suggestion information;
[0087] When evaluating the first review suggestion and determining that it includes preset suggestion information to be verified, the step of invoking a second knowledge base associated with the code review system to obtain extended information about the target content from the second knowledge base includes:
[0088] Calculate the matching degree between the first review suggestion and each preset suggestion in the first knowledge base. If the matching degree is less than a preset threshold, determine that the first review suggestion includes first preset suggestion information, where the first preset suggestion information is a suggestion to be further explained.
[0089] A completeness check is performed on the first review suggestion. If the first review suggestion lacks explanation or example, it is determined that the first review suggestion includes second preset suggestion information, and the second preset suggestion information is a suggestion with insufficient completeness.
[0090] The first review suggestion is subjected to a content to be verified detection. If the first review suggestion contains content to be verified, it is determined that the first review suggestion includes third preset suggestion information, and the third preset suggestion information is a suggestion to be verified.
[0091] Based on the target content determined from the preset suggestion information, extended information of the target content is extracted from the second knowledge base.
[0092] In one example, a text similarity algorithm can be used to compare each suggestion in the first review proposal with preset suggestions for the same question in the first knowledge base, calculating the matching degree. If the matching degree is below a threshold, it indicates that the suggestion lacks local knowledge support, and thus the suggestion can be determined as the first preset suggestion information, meaning it is a suggestion that needs further explanation, and its confidence level is currently insufficient. For example, the first preset suggestion information might be "axios requests need to set the timeout parameter," but the first knowledge base only records the basic usage of axios and does not include the specific setting specifications for timeout. If the matching degree is at the threshold (e.g., 60%), then the suggestion is marked as a suggestion that needs further explanation.
[0093] In one example, each suggestion in the first review recommendation can be checked for completeness. For instance, it might only point out poor loop performance without specifying optimization methods; or it might suggest modifying parameter validation logic without specifying which validation conditions should be added; or it might mention the need to follow RESTful specifications without providing examples of correct interface naming formats. If the first review recommendation lacks explanation or examples, then that recommendation is identified as the second preset recommendation, meaning the second preset recommendation is considered incomplete.
[0094] In one example, the pre-defined content to be updated in the first knowledge base may include: temporary business logic within the project (such as new rules not being promptly entered into the local library), new version features of third-party libraries / frameworks, and new industry standards (such as the latest standards for API security certification not being included). The suggestions in the first review recommendations can be compared with the pre-defined content to be updated in the first knowledge base. If a suggestion involves these marked contents, it is identified as the third pre-defined recommendation information, meaning the third pre-defined recommendation information is a suggestion requiring verification. For example, if the third pre-defined recommendation information is "use Vue 3's setup syntactic sugar to simplify component logic," but the Vue-related knowledge in the first knowledge base is still based on Vue 2, then this suggestion is considered a suggestion requiring verification.
[0095] Then, based on the target content determined from the preset suggestion information, extended information about the target content is extracted from the second knowledge base. See the following description for details:
[0096] The agent determines the target content from pre-defined suggestions, which can be search terms. For example, if the agent is unfamiliar with a library function, it generates search terms for the function name and its library; if it is unsure about a business logic, it generates relevant business terms and code snippets as search terms. The agent then uses external search tools (such as Google Search, Stack Overflow, official documentation, etc.) to retrieve information from a second knowledge base using these generated search terms, extracting extended information about the target content. This extended information can include correct usage and examples of specific APIs, solutions to common problems, best practices and design patterns, relevant technical documents, or forum discussions. Furthermore, to improve efficiency, the web page crawling and summarizing module can search multiple web pages in parallel. Thus, the extended information obtained from the second knowledge base can accurately supplement the gaps in the pre-defined suggestions (e.g., increasing confidence, improving examples, and corroborating new content), providing reliable external support for the subsequent fusion and generation of second review suggestions, thereby further improving the accuracy of the generated review suggestions.
[0097] Optionally, after fusing the extended information with the preset suggestion information to generate the second review suggestion for the modified code snippet, the method further includes:
[0098] The second review recommendation will be displayed on the page where the modified code snippet is located. The second review recommendation is used to guide the compliant modification of the modified code snippet.
[0099] In this embodiment, by displaying the integrated second review suggestion as a line-level comment on the page where the modified code snippet is located, the review suggestion and the code modification are accurately linked, allowing developers to directly obtain complete and traceable compliance modification guidance while viewing the code.
[0100] Specifically, the intelligent agent can simulate a user's action of making line-level comments in a browser, attaching the second review suggestion as the comment content directly to the corresponding line of code. This achieves:
[0101] Precise location: Review suggestions are displayed directly next to the problematic line of code, eliminating the need for developers to search manually.
[0102] High interactivity: Review comments are presented in the platform's native comment format, allowing developers to directly reply, discuss, or mark as resolved on the page.
[0103] Zero intrusion: No plugins or platform code need to be installed; the system behavior completely simulates human operation.
[0104] Furthermore, the agent can utilize its browser-use capability to return to the MergeRequest page of development platforms such as GitLab. By analyzing the page's DOM structure and line numbers, the agent can precisely locate the specific line of code that needs to be commented.
[0105] like Figure 2 As shown, the code review method provided in this embodiment of the invention can be applied to a code review system, which may include:
[0106] Code analysis module: This includes a static structure and semantic analyzer, used for deep code analysis to identify code structure and semantic information. The static structure and semantic analyzer performs preliminary analysis on code obtained from the development platform, identifying key elements such as functions, classes, variables, structures, and exceptions.
[0107] The review suggestion generation module includes a preliminary code review suggestion generation module and an uncertainty analyzer, used to generate preliminary suggestions and identify uncertainties. Specifically, the preliminary code review suggestion generation module generates preliminary code review suggestions (i.e., first review suggestions) based on the results of the static structure and semantic analyzer, combined with a local knowledge base (i.e., the first knowledge base). The uncertainty analyzer evaluates the quality and confidence level of the preliminary code review suggestions, identifying ambiguous suggestions, knowledge gaps, or lack of understanding of internally referenced methods or classes.
[0108] The external information retrieval module includes a search tool invocation module and a webpage content crawling and summarizing module, used for external information retrieval and content summarization when needed. The search tool invocation module is used to generate search terms as needed when the uncertainty analyzer identifies uncertainty, and then invoke external search tools (such as web search engines) to retrieve information from a second knowledge base. The webpage content crawling and summarizing module is used to search multiple webpages in parallel, crawl relevant webpage content, and summarize the crawled content to obtain extended information.
[0109] The results integration and output module includes a summary and integration module, which integrates all information and generates the final review output. Specifically, the summary and integration module summarizes and integrates the initial code review recommendations, uncertainty analysis results, and extended information obtained from search tools (including correction suggestions, external citations, and source linking) to generate a complete code review (i.e., second review recommendation) output.
[0110] Browser Control and Interaction Module: Utilizing the browser-use capability of a general intelligent agent, it allows direct control of development platform pages such as GitLab through the browser, enabling code extraction, attaching review suggestions to specific lines of change, and adding comments.
[0111] Interactive Annotation Module: Working in conjunction with the General Intelligent Agent Module, this module is responsible for presenting review suggestions directly on the development platform page as line-level comments. The General Intelligent Agent Module, in particular, possesses browser-use capabilities, simulating human user actions in a browser, including but not limited to page navigation, DOM parsing, element clicking, text input, and content fetching. This module is fundamental to achieving zero intrusion and strong interactivity.
[0112] In this embodiment, the static structure of the code analysis module and the semantic analyzer deeply analyze key code elements, providing a data foundation for code review. The review suggestion generation module generates preliminary review suggestions and accurately identifies uncertain scenarios, avoiding review biases caused by vague suggestions or knowledge gaps. Furthermore, the external information retrieval module supplements the second knowledge base with authoritative extended information, compensating for the limitations of the local knowledge base and improving the credibility and feasibility of the review suggestions. The result integration and output module fuses multi-source information to generate complete second review suggestions, ensuring the comprehensiveness and accuracy of the review results. Finally, combined with the browser-use capability of the general intelligent agent module, the browser control and interaction module, and the interactive annotation module, automatic code extraction and precise attachment of line-level comments are achieved in a zero-intrusion manner, allowing developers to obtain relevant suggestions without switching tools, thus improving review efficiency.
[0113] like Figure 3 As shown, this embodiment of the invention also provides a code review device 300, applied to a code review system, the device comprising:
[0114] The acquisition module 301 is used to acquire the modified code fragment to be reviewed and the associated information corresponding to the modified code fragment, wherein the associated information is used to provide data support for the review of the modified code;
[0115] The determination module 302 is used to parse the modified code fragment and the associated information using a preset coding standard, and determine the analysis result of the modified code fragment. The analysis result is used to indicate whether the modified code fragment is compliant.
[0116] The generation module 303 is used to match the suggestion information corresponding to the analysis result from the first knowledge base in the code review system when the analysis result indicates that the modified code segment contains non-compliant segments, and obtain the first review suggestion for the modified code segment. The first review suggestion is used to guide the compliant modification of the modified code segment.
[0117] Optionally, module 301 is used specifically for:
[0118] Parse the Document Object Model (DOM) of the first page to determine the metadata content of the modified code snippet. The metadata content includes the file path, and the first page is the page where the modified code snippet is located.
[0119] Parse the DOM of the second page to extract the text content containing all lines and obtain the full-text code. The second page is the page determined according to the file path, and the full-text code is the complete code corresponding to the modified code fragment.
[0120] The full-text code is analyzed to obtain call chain information, which is the call relationship chain corresponding to the modified code fragment;
[0121] The dependency configuration file of the modified code snippet is parsed in the root directory of the project containing the modified code snippet to obtain the dependency information, which is the resource that the modified code snippet depends on to run.
[0122] Optionally, module 302 is specifically used for:
[0123] The structured elements in the full-text code are extracted and compared with the preset coding standard to obtain the coding standard analysis result. The structured elements are used to indicate the structure and logic of the code, and the coding standard analysis result is used to evaluate the format specification of the modified code fragment.
[0124] Based on the structured elements, the call chain information, and the dependency information, logical operation deduction is performed to obtain logical error analysis results. The logical error analysis results are used to evaluate the logical specifications of the modified code segment.
[0125] Based on the complexity of the structured elements, the call frequency of the call chain information, and the resource consumption characteristics of the dependency information, performance analysis results are obtained, and the performance analysis results are used to evaluate the running performance of the modified code snippet.
[0126] Based on the full-text code, the call chain information, and the preset code odor identification rules, code odor analysis results are obtained. The code odor analysis results are used to evaluate the non-functional defect characteristics of the modified code fragment, and the preset code odor identification rules are used to indicate the characteristics of the code odor.
[0127] Optionally, the device further includes:
[0128] The calling module is used to, when evaluating the first review suggestion and determining that the first review suggestion includes preset suggestion information to be verified, call a second knowledge base associated with the code review system to obtain extended information of the target content in the second knowledge base. The target content is keywords extracted based on the preset suggestion information, and the extended information is used to supplement the preset suggestion information.
[0129] The fusion module is used to fuse the extended information with the preset suggestion information to generate a second review suggestion for the modified code fragment.
[0130] Optionally, the preset suggestion information includes first preset suggestion information, second preset suggestion information, and third preset suggestion information;
[0131] Calling the module, specifically used for:
[0132] Calculate the matching degree between the first review suggestion and each preset suggestion in the first knowledge base. If the matching degree is less than a preset threshold, determine that the first review suggestion includes first preset suggestion information, where the first preset suggestion information is a suggestion to be further explained.
[0133] A completeness check is performed on the first review suggestion. If the first review suggestion lacks explanation or example, it is determined that the first review suggestion includes second preset suggestion information, and the second preset suggestion information is a suggestion with insufficient completeness.
[0134] The first review suggestion is subjected to a content to be verified detection. If the first review suggestion contains content to be verified, it is determined that the first review suggestion includes third preset suggestion information, and the third preset suggestion information is a suggestion to be verified.
[0135] Based on the target content determined from the preset suggestion information, extended information of the target content is extracted from the second knowledge base.
[0136] Optionally, the device further includes:
[0137] The display module is used to display the second review suggestion on the page where the modified code snippet is located. The second review suggestion is used to guide the compliant modification of the modified code snippet.
[0138] The code review device 300 provided in this embodiment of the invention can achieve Figure 1 The various processes implemented in the method embodiments shown are capable of achieving the same beneficial effects, and will not be described again here to avoid repetition.
[0139] This invention also provides an electronic device, such as... Figure 4As shown, it includes a processor 401, a communication interface 402, a memory 403, and a communication bus 404, wherein the processor 401, the communication interface 402, and the memory 403 communicate with each other through the communication bus 404.
[0140] The memory 403 is used to store computer programs; the processor 401, when executing the program stored in the memory 403, performs the following steps:
[0141] Obtain the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet. The associated information is used to provide data support for the review of the modified code.
[0142] The modified code snippet and the associated information are parsed using a preset coding standard to determine the analysis result of the modified code snippet. The analysis result is used to indicate whether the modified code snippet is compliant.
[0143] If the analysis results indicate that the modified code snippet contains non-compliant segments, the system matches the suggestion information corresponding to the analysis results from the first knowledge base within the code review system to obtain a first review suggestion for the modified code snippet. The first review suggestion is used to guide the compliant modification of the modified code snippet.
[0144] Optionally, obtaining the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet includes:
[0145] Parse the Document Object Model (DOM) of the first page to determine the metadata content of the modified code snippet. The metadata content includes the file path, and the first page is the page where the modified code snippet is located.
[0146] Parse the DOM of the second page to extract the text content containing all lines and obtain the full-text code. The second page is the page determined according to the file path, and the full-text code is the complete code corresponding to the modified code fragment.
[0147] The full-text code is analyzed to obtain call chain information, which is the call relationship chain corresponding to the modified code fragment;
[0148] The dependency configuration file of the modified code snippet is parsed in the root directory of the project containing the modified code snippet to obtain the dependency information, which is the resource that the modified code snippet depends on to run.
[0149] Optionally, the step of parsing the modified code fragment and the associated information using a preset encoding standard to determine the analysis result of the modified code fragment includes at least one of the following:
[0150] The structured elements in the full-text code are extracted and compared with the preset coding standard to obtain the coding standard analysis result. The structured elements are used to indicate the structure and logic of the code, and the coding standard analysis result is used to evaluate the format specification of the modified code fragment.
[0151] Based on the structured elements, the call chain information, and the dependency information, logical operation deduction is performed to obtain logical error analysis results. The logical error analysis results are used to evaluate the logical specifications of the modified code segment.
[0152] Based on the complexity of the structured elements, the call frequency of the call chain information, and the resource consumption characteristics of the dependency information, performance analysis results are obtained, and the performance analysis results are used to evaluate the running performance of the modified code snippet.
[0153] Based on the full-text code, the call chain information, and the preset code odor identification rules, code odor analysis results are obtained. The code odor analysis results are used to evaluate the non-functional defect characteristics of the modified code fragment, and the preset code odor identification rules are used to indicate the characteristics of the code odor.
[0154] Optionally, when executing a program stored in memory 403, processor 401 may also perform the following steps:
[0155] If the first review suggestion is evaluated and it is determined that the first review suggestion includes preset suggestion information to be verified, a second knowledge base associated with the code review system is invoked to obtain extended information of the target content in the second knowledge base. The target content is keywords extracted based on the preset suggestion information, and the extended information is used to supplement the preset suggestion information.
[0156] The extended information is fused with the preset suggestion information to generate a second review suggestion for the modified code fragment.
[0157] Optionally, the preset suggestion information includes first preset suggestion information, second preset suggestion information, and third preset suggestion information;
[0158] When evaluating the first review suggestion and determining that it includes preset suggestion information to be verified, the step of invoking a second knowledge base associated with the code review system to obtain extended information about the target content from the second knowledge base includes:
[0159] Calculate the matching degree between the first review suggestion and each preset suggestion in the first knowledge base. If the matching degree is less than a preset threshold, determine that the first review suggestion includes first preset suggestion information, where the first preset suggestion information is a suggestion to be further explained.
[0160] A completeness check is performed on the first review suggestion. If the first review suggestion lacks explanation or example, it is determined that the first review suggestion includes second preset suggestion information, and the second preset suggestion information is a suggestion with insufficient completeness.
[0161] The first review suggestion is subjected to a content to be verified detection. If the first review suggestion contains content to be verified, it is determined that the first review suggestion includes third preset suggestion information, and the third preset suggestion information is a suggestion to be verified.
[0162] Based on the target content determined from the preset suggestion information, extended information of the target content is extracted from the second knowledge base.
[0163] Optionally, when executing a program stored in memory 403, processor 401 may also perform the following steps:
[0164] The second review recommendation will be displayed on the page where the modified code snippet is located. The second review recommendation is used to guide the compliant modification of the modified code snippet.
[0165] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not indicate that there is only one bus or one type of bus.
[0166] The communication interface is used for communication between the aforementioned terminal and other devices.
[0167] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0168] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0169] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the code review methods described in the above embodiments.
[0170] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the code review methods described in the above embodiments.
[0171] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0172] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0173] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0174] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A code review method characterized by, The method, applied to a code review system, includes: Obtain the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet. The associated information is used to provide data support for the review of the modified code. The modified code snippet and the associated information are parsed using a preset coding standard to determine the analysis result of the modified code snippet. The analysis result is used to indicate whether the modified code snippet is compliant. If the analysis results indicate that the modified code snippet contains non-compliant segments, the system matches the suggestion information corresponding to the analysis results from the first knowledge base within the code review system to obtain a first review suggestion for the modified code snippet. The first review suggestion is used to guide the compliant modification of the modified code snippet.
2. The method of claim 1, wherein, The step of obtaining the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet includes: Parse the Document Object Model (DOM) of the first page to determine the metadata content of the modified code snippet. The metadata content includes the file path, and the first page is the page where the modified code snippet is located. Parse the DOM of the second page to extract the text content containing all lines and obtain the full-text code. The second page is the page determined according to the file path, and the full-text code is the complete code corresponding to the modified code fragment. The full-text code is analyzed to obtain call chain information, which is the call relationship chain corresponding to the modified code fragment; The dependency configuration file of the modified code snippet is parsed in the root directory of the project containing the modified code snippet to obtain the dependency information, which is the resource that the modified code snippet depends on to run.
3. The method of claim 2, wherein, The step of parsing the modified code fragment and the associated information using a preset encoding standard to determine the analysis result of the modified code fragment includes at least one of the following: The structured elements in the full-text code are extracted and compared with the preset coding standard to obtain the coding standard analysis result. The structured elements are used to indicate the structure and logic of the code, and the coding standard analysis result is used to evaluate the format specification of the modified code fragment. Based on the structured elements, the call chain information, and the dependency information, logical operation deduction is performed to obtain logical error analysis results. The logical error analysis results are used to evaluate the logical specifications of the modified code segment. Based on the complexity of the structured elements, the call frequency of the call chain information, and the resource consumption characteristics of the dependency information, performance analysis results are obtained, and the performance analysis results are used to evaluate the running performance of the modified code snippet. Based on the full-text code, the call chain information, and the preset code odor identification rules, code odor analysis results are obtained. The code odor analysis results are used to evaluate the non-functional defect characteristics of the modified code fragment, and the preset code odor identification rules are used to indicate the characteristics of the code odor.
4. The method according to any one of claims 1 to 3, characterized in that, After obtaining the first review suggestion for the modified code snippet, the method further includes: If the first review suggestion is evaluated and it is determined that the first review suggestion includes preset suggestion information to be verified, a second knowledge base associated with the code review system is invoked to obtain extended information of the target content in the second knowledge base. The target content is keywords extracted based on the preset suggestion information, and the extended information is used to supplement the preset suggestion information. The extended information is fused with the preset suggestion information to generate a second review suggestion for the modified code fragment.
5. The method according to claim 4, characterized in that, The preset suggestion information includes first preset suggestion information, second preset suggestion information, and third preset suggestion information; When evaluating the first review suggestion and determining that it includes preset suggestion information to be verified, the step of invoking a second knowledge base associated with the code review system to obtain extended information about the target content from the second knowledge base includes: Calculate the matching degree between the first review suggestion and each preset suggestion in the first knowledge base. If the matching degree is less than a preset threshold, determine that the first review suggestion includes first preset suggestion information, where the first preset suggestion information is a suggestion to be further explained. A completeness check is performed on the first review suggestion. If the first review suggestion lacks explanation or example, it is determined that the first review suggestion includes second preset suggestion information, and the second preset suggestion information is a suggestion with insufficient completeness. The first review suggestion is subjected to a content to be verified detection. If the first review suggestion contains content to be verified, it is determined that the first review suggestion includes third preset suggestion information, and the third preset suggestion information is a suggestion to be verified. Based on the target content determined from the preset suggestion information, extended information of the target content is extracted from the second knowledge base.
6. The method according to claim 4, characterized in that, After fusing the extended information with the preset suggestion information to generate the second review suggestion for the modified code snippet, the method further includes: The second review recommendation will be displayed on the page where the modified code snippet is located. The second review recommendation is used to guide the compliant modification of the modified code snippet.
7. A code review device, characterized in that, The device, used in a code review system, includes: The acquisition module is used to acquire the modified code snippet to be reviewed and the associated information corresponding to the modified code snippet. The associated information is used to provide data support for the review of the modified code. The determination module is used to parse the modified code fragment and the associated information using a preset coding standard, and determine the analysis result of the modified code fragment. The analysis result is used to indicate whether the modified code fragment is compliant. A generation module is used to, when the analysis results indicate that the modified code snippet contains non-compliant segments, match the suggestion information corresponding to the analysis results from the first knowledge base within the code review system to obtain a first review suggestion for the modified code snippet. The first review suggestion is used to guide the compliant modification of the modified code snippet.
8. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store programs; A processor, when executing a program stored in memory, implements the method as described in any one of claims 1-6.
9. A readable storage medium having a program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.
10. A computer program product, characterized in that, Includes computer instructions that, when executed by a processor, implement the method as described in any one of claims 1-6.