Code review method and device, electronic equipment and program product
By acquiring the code repository and agent configuration, constructing code review requests, and calling the agent to generate reports, the shortcomings of existing code review solutions in terms of intelligence and automation are addressed. This achieves intelligent and automated code review, adapts to the development needs of multiple teams and scenarios, and generates customized review reports.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BAIRONG ZHIXIN (BEIJING) TECH CO LTD
- Filing Date
- 2026-05-26
- Publication Date
- 2026-07-21
AI Technical Summary
Existing code review solutions still need improvement in terms of intelligence and efficiency. They struggle to understand the business semantics and logical context of the code, as well as existing technical issues. Existing code review solutions also lack flexibility and adaptability to multi-team and multi-scenario development environments. Furthermore, existing code review methods still need improvement in terms of intelligence and automation, making it difficult to meet the development needs of multiple teams and multiple scenarios. Additionally, the customization capabilities of review reports are limited.
By acquiring review configurations, including code repository configurations and agent configurations, the code differences are determined, a code review request is constructed, and an agent is invoked to generate a report. A priority management mechanism with multiple configuration sources is adopted to identify the project type, invoke the corresponding agent, and generate a customized review report.
It achieves intelligent and automated code review, improves review efficiency, can identify potential logical defects and provide optimization suggestions, adapts to the development needs of multiple teams and multiple scenarios, and generates targeted review reports.
Smart Images

Figure CN122432016A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, specifically to a code review method, apparatus, electronic device, and program product. Background Technology
[0002] In the software development process, code review is a crucial step in ensuring code quality and promoting team collaboration. After completing their code, developers typically need to inspect and analyze code changes to identify potential problems or areas for improvement.
[0003] Currently, some known code analysis solutions can perform code inspections to a certain extent. However, the level of intelligence and review efficiency of these solutions in practical applications still needs improvement.
[0004] Therefore, we hope to provide a solution that can conduct code reviews more efficiently and intelligently.
[0005] The background description is provided for the purpose of understanding the relevant technologies in this field and is not intended as an admission of prior art. Summary of the Invention
[0006] Therefore, the present disclosure aims to provide a code review method that can realize the intelligence and automation of code review and improve the efficiency of code review.
[0007] In a first aspect, embodiments of this disclosure provide a code review method, comprising:
[0008] Obtain the review configuration, which includes the code repository configuration and agent configuration of the code to be reviewed, and the code repository configuration includes the baseline branch information of the code to be reviewed;
[0009] Obtain the current branch information of the code to be reviewed, and determine the code differences between the current branch and the baseline branch of the code to be reviewed;
[0010] Based on the code differences and the preset analysis template, a code review request for the code to be reviewed is constructed.
[0011] The corresponding agent is invoked according to the agent configuration, and the code review request is sent to the corresponding agent to obtain the code review report generated by the corresponding agent.
[0012] In some embodiments, obtaining the review configuration includes:
[0013] Configuration data is obtained from multiple configuration sources, and the multiple configuration sources and / or configuration data have preset priorities;
[0014] Based on the preset priority, the configuration values of each configuration item in the review configuration are determined by the configuration data.
[0015] In some embodiments, determining the configuration values of each configuration item in the review configuration based on the preset priority using the configuration data includes:
[0016] The configuration data from the multiple configuration sources are merged to obtain the value of each configuration item. In the case where the same configuration item corresponds to multiple configuration sources, the configuration value from the configuration source with higher priority overwrites the configuration value from the configuration source with lower priority to obtain the configuration value of the configuration item.
[0017] In some embodiments, the plurality of configuration sources, in descending order of priority, include: command-line arguments, private environment files, project configuration files, system environment variables, and default values.
[0018] In some embodiments, determining the configuration values of each configuration item of the review configuration based on the configuration data according to the preset priority further includes:
[0019] In the case where the same configuration item corresponds to multiple configuration data in the higher-priority configuration source, it is determined whether the multiple configuration data adopt a nested structure;
[0020] The configuration value of this configuration item is determined based on the configuration data that uses a nested structure.
[0021] In some embodiments, constructing a code review request for the code to be reviewed based on the code difference content and a preset analysis template includes:
[0022] Obtain multiple template variables of the preset analysis template;
[0023] The variable values corresponding to each of the multiple template variables are determined based on the code repository configuration and the code differences.
[0024] The variable values are filled into the corresponding template variable positions in the analysis template to generate the code review request.
[0025] In some embodiments, the step of invoking the corresponding agent according to the agent configuration includes:
[0026] Based on the intelligent agent configuration, identify the project type corresponding to the code to be reviewed;
[0027] Based on the project type of the code to be reviewed, the target agent is called from multiple preset agents.
[0028] In some embodiments, the step of calling the target agent from multiple preset agents according to the project type of the code to be reviewed includes:
[0029] In the case that the project type is a front-end project, a first target agent is invoked, wherein the first target agent is configured with compatibility detection; and / or
[0030] In the case where the project type is a backend project, a second target agent is invoked, wherein the second target agent is configured with security detection.
[0031] In a second aspect, embodiments of this disclosure provide a code review apparatus, comprising:
[0032] A configuration acquisition module is used to acquire review configuration, which includes the code repository configuration and agent configuration of the code to be reviewed, and the code repository configuration includes the baseline branch information of the code to be reviewed.
[0033] The difference determination module is used to obtain the current branch information of the code to be reviewed and determine the code difference content between the current branch of the code to be reviewed and the baseline branch.
[0034] The request building module is used to build a code review request for the code to be reviewed based on the code difference content and a preset analysis template.
[0035] The agent invocation module is used to invoke the corresponding agent according to the agent configuration, and send the code review request to the corresponding agent to obtain the code review report generated by the corresponding agent.
[0036] In a third aspect, an electronic device is provided, comprising: a processor and a memory storing a computer program, the processor being configured to implement the method as described in the first aspect when the computer program is executed.
[0037] In a fourth aspect, a program product is provided, comprising a computer program, wherein the computer program, when executed by a processor, implements the method as described in the first aspect.
[0038] The code review method of this disclosure acquires a review configuration, which includes a code repository configuration and an agent configuration for the code to be reviewed. The code repository configuration includes baseline branch information for the code to be reviewed. It acquires the current branch information of the code to be reviewed and determines the code differences between the current branch and the baseline branch. Based on the code differences and a preset analysis template, it constructs a code review request for the code to be reviewed. According to the agent configuration, it calls the corresponding agent and sends the code review request to the corresponding agent to obtain a code review report generated by the corresponding agent. This code review method constructs an end-to-end automated code review process, transforming the traditional manual code review process into an intelligent and automated end-to-end processing flow, solving the technical problem of low efficiency caused by traditional code review relying on manual line-by-line comparison. Meanwhile, the code review method of this disclosure, by leveraging the semantic understanding capabilities of an intelligent agent, can automatically analyze the business logic and contextual relationships of the code. On the one hand, it significantly improves the efficiency of code review compared to manual review. On the other hand, compared to known static code review methods, the code review method of this disclosure can also discover potential logical defects or provide optimization suggestions based on code differences, thereby enhancing the intelligence level of code review.
[0039] Other optional features and technical effects of the embodiments of this disclosure are described in part below, and in part will be apparent from reading this document. Attached Figure Description
[0040] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings. The elements shown are not limited to the scale shown in the drawings, and the same or similar reference numerals in the drawings denote the same or similar elements, wherein:
[0041] Figure 1 A first exemplary flowchart of a code review method according to an embodiment of this disclosure is shown;
[0042] Figure 2 A second exemplary flowchart of a code review method according to an embodiment of this disclosure is shown;
[0043] Figure 3 A third exemplary flowchart of a code review method according to an embodiment of this disclosure is shown;
[0044] Figure 4 A fourth exemplary flowchart of a code review method according to an embodiment of this disclosure is shown;
[0045] Figure 5 A fifth exemplary flowchart of a code review method according to an embodiment of this disclosure is shown;
[0046] Figure 6A sixth exemplary flowchart of a code review method according to an embodiment of this disclosure is shown;
[0047] Figure 7 An exemplary system architecture diagram is shown for a system that can implement the code review method according to embodiments of this disclosure;
[0048] Figure 8 An exemplary interaction timing diagram is shown for a system that can implement the code review method according to embodiments of the present disclosure;
[0049] Figure 9 An exemplary block diagram of a code review apparatus according to embodiments of the present disclosure is shown; and
[0050] Figure 10 An exemplary structural diagram of an electronic device that can implement the methods according to embodiments of the present disclosure is shown. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of this disclosure clearer, the disclosure will be further described in detail below with reference to specific embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this disclosure are used to explain this disclosure, but are not intended to limit this disclosure.
[0052] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0053] In this embodiment of the disclosure, a code repository refers to a system used to store and manage code versions. The code repository can be used to record historical changes to the code during the software development process and support collaborative development.
[0054] In this embodiment of the disclosure, an intelligent agent refers to an artificial intelligence service entity that can understand the business logic and contextual relationships of code. The intelligent agent includes, but is not limited to, a custom intelligent agent created on an artificial intelligence platform.
[0055] The user data, data acquisition, and / or use involved in the embodiments of this disclosure strictly comply with the laws, regulations, and industry standards of relevant countries and regions. The collection and acquisition of data involved in the embodiments of this disclosure are all done in advance by actively prompting or prominently displaying information to inform users and obtaining authorization, or by obtaining full authorization from all parties. The processing, manipulation, forwarding, and use of data involved in the embodiments of this disclosure are all carried out on the premise that the user or relevant party is fully informed and authorized. When implementing the embodiments of this disclosure, the types of data or information, scope of use, and usage scenarios that may be involved are informed to users or relevant parties and authorization is obtained through appropriate means. The specific methods of notification and authorization may vary according to actual circumstances, and this disclosure is not limited in this regard. The processing of personal information involved in the embodiments of this disclosure is carried out under the premise of having a legal basis (such as obtaining the consent of the personal information subject or being necessary for the performance of a contract), and is only processed within the prescribed or agreed scope. Sensitive personal information such as biometric information, medical and health information, financial account information, and precise location information involved in the embodiments of this disclosure are all processed under the premise of having a specific purpose and sufficient necessity, and with the separate authorization and consent of the user or relevant party. In some embodiments of this disclosure, if a user or related party refuses to process personal information other than the information necessary for the basic functions, it will not affect the use of the basic functions of the embodiments of this disclosure.
[0056] As mentioned earlier, code review is a crucial step in ensuring code quality during software development. Specifically, in real-world development scenarios, development teams typically employ a branching development model. After completing a feature, developers need to compare and review the code on their current development branch with the baseline branch.
[0057] To address this, known code analysis solutions typically employ static code analysis tools or manual reviews to compare and review the code. However, these solutions still have certain limitations in practical applications. For the purposes of explanation, not limitation, static code analysis tools primarily detect syntactic issues and struggle to understand the business semantics and contextual logic of the code; while manual reviews can perform semantic-level analysis, they are less efficient and their quality relies heavily on individual experience, making it difficult to guarantee consistency.
[0058] Meanwhile, known solutions offer limited flexibility in configuration management. To explain rather than limit this, different teams may use different code repositories, different review standards, and different notification channels. Known solutions struggle to flexibly manage configuration variables at runtime across different dimensions, such as individuals, projects, and teams, thus failing to adapt to the development needs of multiple teams and scenarios.
[0059] Furthermore, known solutions also have limitations in terms of customizing review reports. For the sake of explanation, and not limitation, different types of projects typically require different review focuses; for example, front-end projects emphasize compatibility checks, while back-end projects emphasize security checks. Known solutions struggle to generate tailored review reports based on project type.
[0060] To address this issue, this disclosure provides a code review method applicable to code quality management scenarios in software development, including but not limited to enterprise software development, agile development, and continuous integration / continuous deployment (CI / CD). This method can be run via, but is not limited to, servers, development terminals, cloud-deployed computing nodes, command-line tools, or continuous integration plugins. The code review method of this disclosure enables end-to-end automation of code review, effectively mitigating or overcoming the aforementioned problems.
[0061] The code review method of this disclosure will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0062] In this disclosure embodiment, reference is made to Figure 1 A code review method is provided, which may include the following steps 110, 120, 130 and 140.
[0063] 110: Get the review configuration.
[0064] In this embodiment of the disclosure, the review configuration may include basic configuration information for executing the code review method. For explanation, the review configuration can be used to guide subsequent steps such as code difference acquisition, review request construction, and agent invocation.
[0065] In some embodiments, the review configuration may include, but is not limited to, the code repository configuration and agent configuration of the code to be reviewed.
[0066] In some embodiments, code repository configuration may include configuration information related to the code repository where the code to be reviewed resides. In this embodiment, code repository configuration may include the code repository's interface address, access token, project identifier, base branch information, etc.
[0067] In some embodiments, the interface address of the code repository can be used to specify the network access address of the code repository service; the access token can be used to verify the identity and permissions of the caller; the project identifier can be used to uniquely identify a specific project in the code repository. For explanation, the project identifier can be used to accurately locate the project to which the code to be reviewed belongs in a multi-project environment, which will be described in detail below.
[0068] In some embodiments, baseline branch information can be used to specify the reference branch for comparing the differences in the code to be reviewed. By way of explanation and not limitation, a branched development model is commonly used in software development, where developers write code on their respective development branches and then merge the code into the main branch or a specific integration branch. In a specific example, the baseline branch is configured as the master branch, the current development branch is the feature-login branch, and the code review method will compare the code changes on the feature-login branch relative to the master branch.
[0069] In some embodiments, the review configuration may further include a notification service configuration. In this embodiment, the notification service configuration can be used to configure the push method and recipient information for code review reports.
[0070] In some embodiments, the agent configuration may include the interface address, access credentials, agent identifier, etc. of the agent service. In this embodiment, the interface address can be used to specify the network access address of the agent service; the access credentials may include key information for authentication; and the agent identifier can be used to uniquely identify a specified agent instance so as to invoke the target agent in a multi-agent environment.
[0071] In some embodiments, the agent configuration may further include the agent's review direction configuration. In this embodiment, the review direction configuration can be used, for example, to customize the focus and output format of code reviews.
[0072] As an explanation, and not a limitation, different types of projects can be configured with different review directions. In some embodiments, for front-end projects of user-end products, the agent information can be configured to focus on pointing out potential problems or boundary scenarios that may be introduced by the changes, including but not limited to compatibility issues and differences in behavior across multiple platforms, thereby avoiding compatibility issues with different devices / browser versions, etc.; for back-end projects of the server side, the agent information can be configured to focus on checking whether all external inputs have been strictly validated, thereby identifying potential security risks. Thus, the agent configuration mechanism of this disclosure can support the personalized review needs of different teams and different scenarios, achieving complete customization of review reports.
[0073] In some embodiments, the review configuration can be obtained from multiple configuration sources, and different configuration sources can have different priorities to achieve flexible configuration management. The following will combine... Figure 2 The detailed implementation method for obtaining the review configuration is described.
[0074] In some embodiments, reference Figure 2 Step 110 may include the following steps 111 and 112:
[0075] 111: Obtain configuration data from multiple configuration sources.
[0076] In this disclosure, a configuration source refers to a source that provides configuration data. In some embodiments, different configuration sources may correspond to configuration data of different dimensions. As an explanation and not a limitation, different levels in the complete software development process, such as individuals, projects, and teams, often have different configuration needs, and using multiple configuration sources can effectively meet the needs of different levels.
[0077] In some embodiments, such as in step 111 above, the multiple configuration sources may have preset priorities. In some embodiments, configuration values from configuration sources with higher priorities may be preferentially adopted in subsequent processing.
[0078] In some embodiments, multiple configuration sources, ranked from highest to lowest priority, may include: command-line arguments, private environment files, project configuration files, system environment variables, and default values. By way of explanation and not limitation, this multi-level (five-level) configuration priority management mechanism enables configuration variables to be managed at runtime according to different dimensions such as individual, project, team, and default values.
[0079] In some embodiments, command-line arguments may include configuration parameters specified via the command line when running the code review method. In some embodiments, command-line arguments may have the highest priority, meaning they can override configurations with the same name from other configuration sources. By way of explanation and not limitation, command-line arguments can be used when a user needs to temporarily override certain configurations in a specific execution scenario.
[0080] In some embodiments, a private environment file may include a file storing private configurations for team members. For explanation, a private environment file can be used to provide private configurations for team members, and its priority may be lower than command-line arguments. In some embodiments, the private environment file may store, but is not limited to, access tokens for team members.
[0081] In some embodiments, a project configuration file may include a file storing project-level configurations. For explanation, a project configuration file can be used to provide project-level configurations, which have a lower priority than, for example, private environment files. In some embodiments, the project configuration file may store project identification information, such as the project's identifier in the code repository. Therefore, by providing project-level configuration files, it is possible to ensure that team members use consistent project configurations.
[0082] In some embodiments, system environment variables may include operating system-level environment variables. For explanation, system environment variables can be used to provide team-wide configurations, with a priority lower than, for example, project configuration files. In some embodiments, system environment variables may store team-wide configuration information, such as team-wide main branch configurations.
[0083] In some embodiments, default values may include system-preset default configuration values. For explanation, default values can be used to provide a basic configuration when no configuration values are provided by other configuration sources. In some embodiments, default values may include default configurations of agent service providers, etc. In one example, the system may use a default agent service provider if the user does not specify one.
[0084] 112: Based on preset priorities, the configuration values of each configuration item in the review configuration are determined by the configuration data.
[0085] In this embodiment of the disclosure, when or after multiple configuration sources acquire configuration data, the configuration value of each configuration item can be determined based on a preset priority. For explanation, a configuration item being reviewed may have corresponding configuration values in multiple configuration sources; in this case, a priority mechanism can be used to determine which configuration value will ultimately be adopted for that item.
[0086] In some embodiments, step 112 may include merging configuration data from multiple configuration sources to obtain the value of each configuration item.
[0087] In some embodiments, when the same configuration item corresponds to multiple configuration sources, the configuration value in the configuration source with higher priority can be overwritten by the configuration value in the configuration source with lower priority to obtain the configuration value of the configuration item.
[0088] As an explanation, and not a limitation, the merging process includes the integration of configuration data from different configuration sources into a unified configuration object. During the merging process, the system can process the configuration data from each configuration source sequentially according to a preset priority order. Where the same configuration item has configuration values in multiple configuration sources, the configuration value from the higher-priority configuration source can be used to override the configuration value from the lower-priority configuration source.
[0089] In one specific example, the command-line arguments specify the base branch as `develop`, the project configuration file specifies the base branch as `master`, and the system environment variables also specify the base branch as `master`. In this case, the command-line arguments take precedence over the project configuration file and system environment variables. Therefore, the base branch `develop` specified in the command-line arguments will override the base branch specified in both the project configuration file and the system environment variables, and the final base branch configuration value will be `develop`. In another specific example, the user configures a project identifier in the project configuration file but not in the command-line arguments or the private environment file. In this case, the project identifier configuration value from the project configuration file will be used.
[0090] In some embodiments, step 112 above may further include: A1: when multiple configuration data in a configuration source with higher priority correspond to the same configuration item, determine whether the multiple configuration data adopt a nested structure; A2: determine the configuration value of the configuration item based on the configuration data that adopts a nested structure.
[0091] In some embodiments, configuration data can adopt a nested or flat structure. For explanation, a nested structure refers to organizing configuration data in a hierarchical manner, grouping related configuration items under the same configuration object; a flat structure refers to organizing configuration data in a flat manner, directly using a single configuration item name. In a specific example, for code repository-related configurations, a nested structure can be used, for example, organizing the main branch configuration and API address configuration of the code repository under a GitLab configuration object: `gitlab: { mainBranch: 'master', apiUrl: 'https: / / gitlab.example.com'}`. A flat structure can also be used, for example, directly using `gitlabMainBranch` and `gitlabApiUrl` as configuration item names.
[0092] As an explanation, and not a limitation, when both nested and flat configuration data exist in the same configuration source, the configuration data with / with a nested structure may have higher priority. Therefore, this design allows users to choose the organization method of configuration according to their actual needs: when multiple related configuration items need to be configured, a nested structure can be used for easier management; when only a single configuration item needs to be configured, a non-nested structure can be used to simplify configuration declarations.
[0093] In some embodiments, obtaining the review configuration may further include a step of verifying the review configuration. In some embodiments, this may include verifying the existence of necessary configuration items such as the interface address of the code repository and the access credentials of the agent. In this embodiment, if necessary configuration items are missing, a corresponding exception may be thrown and execution may be terminated, so that users can promptly discover and correct configuration problems.
[0094] The method described in the above embodiments of this disclosure employs a multi-configuration-source management mechanism, enabling it to obtain configuration data from multiple configuration sources and determine the final configuration value of each configuration item based on a preset priority, thus achieving flexible configuration management. Furthermore, this multi-level configuration management mechanism can adapt to configuration needs at different levels, such as runtime, individual, project, and team levels, thereby ensuring compatibility with development environments across multiple teams and scenarios.
[0095] 120: Obtain the current branch information of the code to be reviewed, and determine the code differences between the current branch and the baseline branch of the code to be reviewed.
[0096] In this embodiment of the disclosure, code difference content refers to the change information of code files between the current branch and the base branch. In some embodiments, the change information may include newly added, modified, and deleted code content.
[0097] In some embodiments, obtaining current branch information can be achieved through a code version control system. By way of explanation and not limitation, a code version control system can be used to record and manage code history changes, such as recording the content of each code commit, the time of the change, and the author of the change. In one specific embodiment, the code version control system may include a Git version control system. However, it is understood that other code version control systems may be reasonably used in other embodiments, and this disclosure does not limit this.
[0098] In some embodiments, the current branch and the baseline branch can be verified before determining the code differences. In some embodiments, if the current branch and the baseline branch are verified to be the same, i.e., no code differences are verified, the review process is terminated and a corresponding prompt message is output, thereby avoiding unnecessary processing overhead.
[0099] In some embodiments, determining code differences can be achieved by comparing the code files of the current branch and the base branch. In one specific embodiment, the `git diff` command can be used to obtain a list of difference files and the specific differences between the two branches. In this embodiment, the list of difference files can display all changed files involved in the current development, including newly added, modified, and deleted files. In another embodiment, determining code differences can also be achieved by calling a code repository interface. In this embodiment, the application programming interface provided by the code repository can be called through the interface address in the code repository configuration to obtain the code differences between the current branch and the base branch.
[0100] 130: Based on the code differences and the preset analysis template, construct a code review request for the code to be reviewed.
[0101] In this embodiment of the disclosure, the code review request may include request information for sending to the agent.
[0102] In some embodiments, the analysis template may include a predefined request structure template. In this embodiment, the analysis template may include multiple template variables, which include placeholders in the analysis template that need to be replaced with actual values at runtime.
[0103] In some embodiments, reference Figure 3 Step 130 above may include steps 131, 132 and 133 below:
[0104] 131: Obtain multiple template variables from the preset analysis template.
[0105] In some embodiments, such as step 131 above, multiple template variables can be identified and obtained from a preset analysis template. In a specific embodiment, template variables may include requirement title variables, branch information variables, committer variables, code difference variables, etc.
[0106] 132: Determine the variable values corresponding to each of the multiple template variables based on the code repository configuration and code differences.
[0107] In some embodiments, the variable values include the actual data values of the template variables in the current review scenario. In this embodiment, the variable values of the template variables may include, but are not limited to, requirement title information, comparison branch information, submitter information, and code difference content. The requirement title information can be used to identify the requirement or task name corresponding to this code change; the comparison branch information may include the base branch identifier and the current branch identifier, which can be obtained, for example, from the code repository configuration and the aforementioned step 120; the submitter information can be used to identify the submitter of the code change, which can be obtained from the code repository service or local Git configuration; the code difference content may include, for example, the code change information between the current branch and the base branch determined in the aforementioned step 120. However, it is understood that in other embodiments, the type and number of template variables can be adjusted according to actual needs, and this disclosure does not limit this.
[0108] In some embodiments, the code difference content may be preprocessed before being populated into the analysis template. In some embodiments, preprocessing may include, but is not limited to: filtering non-code files (such as configuration files, documentation files), filtering automatically generated files, truncating or splitting excessively large difference content, and adding file path and line number information.
[0109] 133: Fill the variable values into the corresponding template variable positions in the analysis template to generate a code review request.
[0110] In some embodiments, such as in step 133 above, the variable values determined in step 132 above can be filled into the template variable positions in the analysis template according to the corresponding relationship, replacing the template variable placeholders, so as to generate a complete code review request.
[0111] In a specific example, the analysis template format is: "Requirement Title: {title}; Comparison Branches: {baseBranch}...{currentBranch}; Submitter: {user}; Code Difference: {diffContent}". In this embodiment, the requirement title variable is replaced with "User Login Function Development", the base branch variable is replaced with "master", the current branch variable is replaced with "feature-login", the submitter variable is replaced with the submitter's username, and the code difference variable is replaced with the specific code difference content.
[0112] The embodiments disclosed above can automatically construct structured code review requests based on preset analysis templates and code discrepancies. By way of explanation, and not limitation, using analysis templates ensures the consistency of the code review request format and the completeness of its content, enabling the agent to understand and process the review request in the expected manner. Furthermore, the content structure of the code review request can be adjusted by modifying the analysis template to adapt to different review needs.
[0113] 140: Invoke the corresponding agent according to the agent configuration, and send the code review request to the corresponding agent to obtain the code review report generated by the corresponding agent.
[0114] In this embodiment of the disclosure, the agent configuration may include information such as the interface path of the agent service, agent identifier, and authentication key.
[0115] In an interpretive rather than restrictive sense, intelligent agents differ from traditional rule-based code analysis tools. They can understand the semantic information of code, thus identifying not only syntactic problems but also potential business logic flaws, code design issues, and security vulnerabilities. Furthermore, intelligent agents can generate structured review reports that conform to team standards, based on pre-configured review directions and specifications.
[0116] In some embodiments, a target agent can be invoked from multiple preset agents based on the project type corresponding to the code to be reviewed, thereby achieving targeted code review.
[0117] Accordingly, in some embodiments, reference is made to Figure 4 Step 140 above may include steps 141 and 142 below:
[0118] 141: Based on the agent configuration, identify the project type corresponding to the code to be reviewed.
[0119] In this embodiment of the disclosure, the project type includes the project category to which the code to be reviewed belongs. For explanation, different types of projects typically have different technical characteristics and review focuses. By identifying the project type, the system can select the most suitable agent for code review to generate a targeted review report.
[0120] In some embodiments, project types may include, but are not limited to, front-end projects, back-end projects, and full-stack projects. For explanation, front-end projects mainly involve the development of user interfaces and interaction logic, and their code typically includes HTML, CSS, JavaScript, etc.; back-end projects mainly involve the development of server-side logic and data processing, and their code typically includes server-side programming languages, database operations, and interface design, etc.
[0121] In some embodiments, project type identification can be based on explicit configuration information in the agent configuration, such as the user specifying the project type as "frontend project" or "backend project" in the configuration file. In other embodiments, project type can also be automatically identified based on the characteristics of the code repository, such as inferring the project type based on the project's file structure, dependency configuration, technology stack identifier, etc., which falls within the protection scope of the embodiments of this disclosure.
[0122] 142: Based on the project type of the code to be reviewed, call the target agent from multiple preset agents.
[0123] In this embodiment of the disclosure, when or after identifying the project type, a target intelligent agent can be invoked from multiple preset intelligent agents based on the project type. For explanation, multiple intelligent agent instances can be created and configured in advance on the intelligent agent service platform, where different preset intelligent agents can be configured with different review directions and output formats to meet the review needs of different project types. Therefore, during the intelligent agent invocation process, an intelligent agent corresponding to the identified project type can be selected from multiple preset intelligent agents as the target intelligent agent, and then the target intelligent agent is invoked for code review, thereby improving the relevance and effectiveness of the review.
[0124] In some embodiments, reference Figure 5 Step 142 above may include the following steps 1421 and 1422:
[0125] 1421: When the project type is a front-end project, call the first target agent.
[0126] In some embodiments, the first target agent includes an agent instance specifically configured for the front-end project.
[0127] In some embodiments, the first target agent may be configured with compatibility detection capabilities. By way of explanation and not limitation, compatibility detection refers to checking whether the code can function correctly in different runtime environments. In front-end development scenarios, compatibility issues are common and have a wide-ranging impact because front-end code needs to run on different browsers, operating systems, and devices.
[0128] In some embodiments, compatibility detection of the first target agent may include multi-terminal behavior difference detection. In this embodiment, "multi-terminal" includes different terminal devices, such as desktop, mobile, and tablet devices. Accordingly, multi-terminal behavior differences may include differences in the performance of front-end code on different terminals. For explanation, different terminal devices have different screen sizes, input methods, computing capabilities, and other characteristics, and the same front-end code may perform differently on different terminals.
[0129] In some embodiments, the first target agent can detect issues in the code that may lead to differences in behavior across multiple platforms, such as whether the responsive layout implementation is complete, whether the compatibility handling of touch events and mouse events is correct, and whether mobile-specific gesture operations are adapted. In a specific example, the first target agent can be configured with the following agent information: "Indicate the problems or boundary scenarios that this change may introduce, including but not limited to compatibility and differences in behavior across multiple platforms." In this embodiment, when analyzing code differences, the agent can focus on checking compatibility-related issues, helping developers avoid compatibility problems between different device / browser versions.
[0130] 1422: When the project type is a backend project, call the second target agent.
[0131] In this embodiment of the disclosure, the second target agent includes an agent instance specifically configured for the backend project. For explanation, the backend project typically involves the development of server-side logic and data processing, and its code usually includes server-side programming languages, database operations, interface design, business logic implementation, etc. Code reviews of backend projects typically focus on security, performance, data processing correctness, and the rationality of interface design.
[0132] In some embodiments, the target agent may be configured with security detection capabilities. By way of explanation and not limitation, security detection includes checking the code for security vulnerabilities or risks.
[0133] In some embodiments, the security detection of the second target agent may include validation checks on external inputs. In some embodiments, security detection may include identifying one or more of the following: SQL injection risks, cross-site scripting (XSS) risks, and command injection risks. In a specific example, the second target agent is configured with the following agent information: "Check all external inputs for strict validation to avoid SQL injection, XSS attacks, and command injection." In this embodiment, the agent can focus on checking interface design and data processing security issues when analyzing code differences, thereby helping developers ensure data security.
[0134] In some embodiments, the agent configuration may support multiple agent service providers. In this embodiment, the step of calling a target agent from multiple preset agents may include: B1: determining the target service provider from multiple service providers based on the service provider identifier in the agent configuration; B2: calling the agent through the interface corresponding to the target service provider. In this embodiment, by supporting multiple service providers, the system can select a suitable agent service based on user needs or availability, improving the system's flexibility and reliability. In some embodiments, the multiple agent services include, but are not limited to, GPT services, Claude services, and GLM services, and this disclosure does not impose limitations on this.
[0135] In some embodiments, the step of determining the target service provider from multiple service providers may further include: C1: creating an agent instance corresponding to the target service provider based on the service provider identifier; C2: calling the corresponding service interface through the agent instance.
[0136] In some embodiments, the code review method may further include 150: converting the code review report into a target message format according to the notification service configuration, and pushing the code review report in the target message format to a designated recipient.
[0137] As mentioned above, the review configuration may include notification service configuration. In this embodiment, the notification service configuration may include message format configuration, push channel configuration, and recipient configuration, wherein the message format configuration can be used to define the format when the code review report is converted into a message; the push channel configuration can be used to define which channel the message is pushed through; and the recipient configuration can be used to define the target recipient of the message push.
[0138] In some embodiments, the target message format refers to the message format converted from the code review report. For explanation, the code review report generated by the agent is typically structured text content, while different message push channels may support different message formats. Therefore, the code review report can be converted to the target message format before being pushed.
[0139] In some embodiments, the target message format may include, but is not limited to, Markdown format. In other embodiments, the target message format may also include text format, which is not a limitation herein.
[0140] In an optional embodiment, the designated recipient may include an instant messaging group. In this embodiment, the instant messaging group may include an internal instant messaging platform group within an enterprise, such as a DingTalk group or a WeChat Work group. This disclosure does not limit the specific implementation method of the instant messaging group.
[0141] In some embodiments, reference Figure 6Step 150 above may include steps 151 and 152 below:
[0142] 151: Determine the members to be notified based on the member configuration information in the notification service configuration.
[0143] In some embodiments, the notification service configuration may include member configuration information. In this embodiment, the member configuration information may include configuration information for defining members to be notified, such as member identifiers, member contact information, and member account information on the instant messaging platform. In some embodiments, members to be notified may be specified using member identifiers in the member configuration information.
[0144] In some embodiments, the members to be notified may also include the code review lead. For explanation, the code review lead is, for example, the person responsible for organizing and overseeing the code review process, who can make subsequent review decisions based on the review results.
[0145] 152: Send code review reports to members to be notified via instant messaging interface and provide targeted reminders to them.
[0146] In some embodiments, such as in step 152 above, the instant messaging interface may include an application programming interface (API) provided by the instant messaging platform for sending and receiving messages. In this embodiment, the instant messaging platform is, for example, but not limited to, enterprise-level instant messaging tools such as DingTalk and WeChat Work. Accordingly, in a specific embodiment, the instant messaging platform is DingTalk, and the instant messaging interface is the DingTalk robot interface.
[0147] In this embodiment of the disclosure, the code review report can be pushed to relevant personnel through a precise push mechanism, and targeted reminders can be used to ensure that the message is noticed, thereby achieving timely delivery of review results and improving team collaboration efficiency.
[0148] In other embodiments, the code review method may further include a step of caching code differences and code review reports. In this embodiment, caching can be used to avoid duplicate reviews of the same code differences. For explanation, when a code review request is received, the cache can first be checked to see if a review report corresponding to the code difference exists. If no corresponding review report exists in the cache, the code review process is executed, and the review report is stored in the cache after being retrieved for reuse in subsequent requests.
[0149] In other embodiments, the code review method may also include an error handling mechanism. In some embodiments, the error handling mechanism may include: capturing exception information during execution; generating an error log based on the exception information; performing exception recovery operations if the exception information is a recoverable exception; and terminating the process and outputting the error log if the exception information is an unrecoverable exception. By way of explanation and not limitation, recoverable exceptions may include exceptions that can be recovered through specific operations, such as network timeouts that can be recovered through retries; unrecoverable exceptions may include exceptions that cannot be recovered through normal operations, such as incorrect configuration file formats or missing necessary permissions. Thus, by distinguishing exception types and taking corresponding handling measures, the system can provide detailed error information while ensuring stability, facilitating problem localization and troubleshooting.
[0150] The code review method of this disclosure realizes the semantic understanding ability of the intelligent agent and the ability to generate structured review reports, which significantly improves the efficiency and quality of code review.
[0151] The code review method of this disclosure constructs an end-to-end automated code review process, transforming the traditional manual code review process into an intelligent and automated processing flow. This solves the technical problem of low efficiency caused by traditional code review relying on manual line-by-line comparison. Leveraging the semantic understanding capabilities of intelligent agents, the code review method of this disclosure can automatically analyze the business logic and contextual relationships of the code, significantly improving the efficiency of code review compared to manual review. Furthermore, compared to known static code review methods, the code review method of this disclosure can also discover potential logical defects or provide optimization suggestions based on code differences, enhancing the intelligence level of code review.
[0152] In a further embodiment of this disclosure, configuration data is obtained from multiple configuration sources, and the configuration data is merged based on a preset priority to determine the configuration value of each configuration item. This further addresses the technical problem of differentiated configuration management required by different teams and projects. Specifically, through a multi-level configuration priority mechanism, configuration variables can be flexibly managed at different dimensions such as runtime, individual, project, and team, adapting to the development needs of multiple teams and scenarios. Furthermore, when multiple configuration data correspond to the same configuration item, by determining whether the configuration data uses a nested format and prioritizing the nested format configuration data, configuration conflicts within the same configuration source are avoided, improving the determinism of configuration management.
[0153] In a further embodiment of this disclosure, a target intelligent agent can be invoked from multiple preset intelligent agents based on the project type. Specifically, an intelligent agent configured for compatibility detection is invoked for front-end projects, while an intelligent agent configured for security detection is invoked for back-end projects. This further solves the technical problem of requiring different review focuses for different types of projects: by mapping project types to intelligent agents, front-end projects can focus on checking issues such as device compatibility and browser version compatibility, while back-end projects can focus on checking security issues such as SQL injection and XSS attacks, thereby generating targeted review reports and improving the professionalism and effectiveness of the review.
[0154] The following section will further describe the overall architecture of the code review method of this disclosure embodiment and the interaction relationships between its components, in conjunction with the system architecture diagram and service interaction diagram.
[0155] In one specific embodiment, reference is made to Figure 7 An exemplary system architecture diagram is shown for a system that can implement the code review method according to embodiments of the present disclosure.
[0156] In this embodiment, the code review system adopts a layered architecture design and includes a user interaction layer, a core application layer, a business logic layer, a tool support layer, an AI service layer, and external services.
[0157] In this embodiment, the user interaction layer receives the user's execution commands and command-line parameters through the command-line interface, and provides the user with feedback on the execution results and status information.
[0158] In this embodiment, the core application layer is the system's scheduling layer, which includes the main program entry point, the configuration manager, and the logging system. Specifically, the main program entry point receives execution requests, calls various business modules according to a predetermined process, and handles global exceptions; the configuration manager implements the aforementioned multi-level configuration management mechanism, obtains configuration data from multiple configuration sources, and determines the configuration values of each configuration item based on priority; the logging system provides a unified logging interface, supporting different levels of log output such as debug, information, warning, and error.
[0159] In this embodiment, the business logic layer includes a code repository integration module, an agent service module, and a message notification module. Specifically, the code repository integration module can interact with the code version control system to obtain the code differences between the current branch and the baseline branch, supporting methods such as Git command line and code repository API; the agent service module is used to identify the project type according to the agent configuration, call the matching target agent, and obtain the code review report; the message notification module is used to convert the code review report into a target message format, push it to the designated recipient through an instant messaging interface, and provide targeted reminders.
[0160] In this embodiment, the tool support layer provides basic functional support for the business logic layer, including an error handling module, a cache management module, a parallel processing module, and a command-line parsing module. The cache management module provides a dual caching mechanism of memory caching and file caching; the parallel processing module supports multi-task parallel execution and a retry mechanism.
[0161] In this embodiment, the AI service layer includes an agent service factory and multiple agent service adaptation modules, such as AI-1, AI-2, and AI-3 in the figure. The agent service factory can create corresponding agent instances based on agent configurations, and each adaptation module interfaces with its corresponding service provider, forming a pluggable architecture.
[0162] In this embodiment, the external services include code repository services, intelligent agent services, and instant messaging services, which respectively provide code difference acquisition, code review, and message push capabilities.
[0163] exist Figure 7 The layered architecture of the code review system shown has clearly defined functions and boundaries for each component. When it is necessary to support new intelligent agent service providers, only the corresponding adaptation module needs to be added to the AI service layer, without modifying the code in the business logic layer.
[0164] In one specific embodiment, reference is made to Figure 8 An exemplary interaction timing diagram of a code review method according to an embodiment of this disclosure is shown. The following will be combined with... Figure 8 The interaction between the components is illustrated using a complete code review process as an example.
[0165] Users initiate code review requests via command line. Specifically, users enter execution commands in the command line, which may include command-line parameters such as the requirement title and agent configuration identifier. After receiving user input, the command line sends a configuration load request to the configuration manager.
[0166] The configuration manager reads configuration data from multiple sources, including command-line arguments, private environment files, project configuration files, system environment variables, and default values. It determines the configuration values of each configuration item based on priority and returns the configuration information to the command line.
[0167] After obtaining the configuration information, the command line sends a request to the code repository service to retrieve the current branch. Once the code repository service returns the current branch information, the command line continues by sending a request to the code repository service to retrieve the branch differences. The code repository service retrieves the code differences between the current branch and the base branch and returns them. Subsequently, the command line sends a request to the code repository service to retrieve user information, and the code repository service returns the current user information.
[0168] The command line constructs a code review request based on the acquired configuration information, code differences, and user information, and sends it to the AI service. The AI service invokes the corresponding agent according to the agent's configuration, analyzes the code differences based on the agent's configured review instructions and semantic understanding capabilities, generates a code review report, and returns it.
[0169] After retrieving the code review report via the command line, a notification request is sent to the instant messaging service. The instant messaging service converts the code review report into the target message format, pushes it to the specified recipients with targeted notifications, and returns a success response upon completion.
[0170] After receiving a successful notification, the command line returns the execution completion result to the user. The user can view the execution status and logs via the command line to understand the execution progress of the code review.
[0171] Through the above interaction process, end-to-end automation is achieved from user-initiated requests to the push of review results. The components interact through standardized interfaces, giving the system good scalability and maintainability.
[0172] In this disclosure embodiment, reference is made to Figure 9 The system also provides a code review device 900, which may include a configuration acquisition module 910, a difference determination module 920, a request construction module 930, and an agent invocation module 940.
[0173] In some embodiments, the configuration acquisition module 910 is configured to acquire review configuration, the review configuration including code repository configuration and agent configuration of the code to be reviewed, the code repository configuration including baseline branch information of the code to be reviewed;
[0174] The difference determination module 920 is configured to obtain the current branch information of the code to be reviewed, and determine the code difference content between the current branch of the code to be reviewed and the baseline branch;
[0175] The request building module 930 is configured to build a code review request for the code to be reviewed based on the code difference content and a preset analysis template.
[0176] The agent invocation module 940 is configured to invoke the corresponding agent according to the agent configuration and send the code review request to the corresponding agent to obtain the code review report generated by the corresponding agent.
[0177] In some embodiments, the code review apparatus 900 may have the features described above. Figure 7 The system architecture shown is illustrated. However, it is understood that in other embodiments, the code review device 900 may also have other reasonable architectures, and this disclosure does not limit this.
[0178] The code review apparatus, components, modules, units, and features described in the embodiments of this disclosure can be combined with the code review method of the embodiments of this disclosure in a non-contradictory manner to obtain new embodiments, which will not be elaborated here. Conversely, the code review method, steps, sub-steps, and features described in the embodiments of this disclosure can also be combined with the code review apparatus of the embodiments of this disclosure in a non-contradictory manner to obtain new embodiments.
[0179] In this disclosure, an electronic device is also provided, including: a processor and a memory storing a computer program, the processor being configured to perform the method of any of the embodiments of this disclosure when running the computer program.
[0180] Figure 10 The illustration shows a method or electronic device 1000 that can implement embodiments of the present disclosure. In some embodiments, it may include more or fewer electronic devices than illustrated. In some embodiments, it may be implemented using a single or multiple electronic devices. In some embodiments, it may be implemented using cloud-based or distributed electronic devices.
[0181] like Figure 10 As shown, the electronic device 1000 includes a processor 1001, which can perform various appropriate operations and processes based on programs and / or data stored in read-only memory (ROM) 1002 or programs and / or data loaded from storage portion 1008 into random access memory (RAM) 1003. The processor 1001 may be a multi-core processor or may contain multiple processors. In some embodiments, the processor 1001 may include a general-purpose main processor and one or more special coprocessors, such as a graphics processing unit (GPU), a neural network processor (NPU), a digital signal processor (DSP), etc. Various programs and data required for the operation of the electronic device 1000 are also stored in RAM 1003. The processor 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. An input / output (I / O) interface 1005 is also connected to bus 1004.
[0182] The processor and memory described above are used together to execute a program stored in the memory. When the program is executed by a computer, it can implement the steps or functions of the methods described in the above embodiments.
[0183] The following components are connected to I / O interface 1005: an input section 1006 including a keyboard, mouse, touchscreen, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to I / O interface 1005 as needed. A removable medium 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 1010 as needed so that computer programs read from it can be installed into storage section 1008 as needed. Figure 10 The diagram only shows a portion of the components and does not imply that the computer system 1000 only includes... Figure 10 The components shown.
[0184] The systems, devices, modules, or units described in the above embodiments can be implemented by a computer or its associated components. The computer may be, for example, a mobile terminal, smartphone, personal computer, laptop computer, in-vehicle human-machine interface device, personal digital assistant, media player, navigation device, game console, tablet computer, wearable device, smart TV, Internet of Things system, smart home, industrial computer, server, or a combination thereof.
[0185] Although not shown, in embodiments of this disclosure, a program product is provided, the program product comprising a computer program configured to be run to implement the methods of any embodiment of this disclosure.
[0186] Although not shown, in embodiments of this disclosure, a storage medium is provided storing a computer program configured to be executed to implement the methods of any of the embodiments of this disclosure.
[0187] Storage media in embodiments of this disclosure include articles that are permanent and non-permanent, removable and non-removable, capable of storing information by any method or technology. Examples of storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0188] The methods, programs, systems, apparatuses, etc., of the embodiments of this disclosure can be executed or implemented in a single or multiple networked computers, or practiced in a distributed computing environment. In the embodiments of this specification, in these distributed computing environments, tasks can be performed by remote processing devices connected via a communication network.
[0189] Those skilled in the art will understand that the embodiments described in this specification can be provided as methods, systems, or computer program products. Therefore, those skilled in the art will realize that the functional modules / units or controllers and related method steps described in the above embodiments can be implemented in software, hardware, or a combination of both.
[0190] Unless explicitly stated otherwise, the actions or steps of the methods or procedures described in the embodiments of this disclosure do not necessarily have to be performed in a specific order and can still achieve the desired results. In some implementations, multitasking and parallel processing are also possible or may be advantageous.
[0191] This document describes several embodiments of the present disclosure; however, for the sake of brevity, the descriptions of the embodiments are not exhaustive, and identical or similar features or portions between the embodiments may be omitted. In this document, "one embodiment," "some embodiments," "example," "specific example," or "some examples" refers to at least one embodiment or example applicable to the present disclosure, but not all embodiments. The above terms do not necessarily refer to the same embodiment or example. Without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of the different embodiments or examples.
[0192] The exemplary systems and methods of this disclosure have been specifically shown and described with reference to the foregoing embodiments, and are merely examples of the best mode for implementing the systems and methods. Those skilled in the art will understand that various changes can be made to the embodiments of the systems and methods described herein without departing from the spirit and scope of this disclosure as defined in the appended claims when implementing the systems and / or methods.
Claims
1. A code review method, characterized in that, include: Obtain the review configuration, which includes the code repository configuration and agent configuration of the code to be reviewed, and the code repository configuration includes the baseline branch information of the code to be reviewed; Obtain the current branch information of the code to be reviewed, and determine the code differences between the current branch and the baseline branch of the code to be reviewed; Based on the code differences and the preset analysis template, a code review request for the code to be reviewed is constructed. The corresponding agent is invoked according to the agent configuration, and the code review request is sent to the corresponding agent to obtain the code review report generated by the corresponding agent.
2. The code review method according to claim 1, characterized in that, The process of obtaining the review configuration includes: Configuration data is obtained from multiple configuration sources, and the multiple configuration sources and / or configuration data have preset priorities; Based on the preset priority, the configuration values of each configuration item in the review configuration are determined by the configuration data.
3. The code review method according to claim 2, characterized in that, The step of determining the configuration values of each configuration item in the review configuration based on the preset priority and the configuration data includes: The configuration data from the multiple configuration sources are merged to obtain the value of each configuration item. In the case where the same configuration item corresponds to multiple configuration sources, the configuration value from the configuration source with higher priority overwrites the configuration value from the configuration source with lower priority to obtain the configuration value of the configuration item.
4. The code review method according to claim 2, characterized in that, The multiple configuration sources, ranked from highest to lowest priority, include: command-line arguments, private environment files, project configuration files, system environment variables, and default values.
5. The code review method according to claim 3, characterized in that, The step of determining the configuration values of each configuration item in the review configuration based on the preset priority and the configuration data further includes: In the case where the same configuration item corresponds to multiple configuration data in the higher-priority configuration source, it is determined whether the multiple configuration data adopt a nested structure; The configuration value of this configuration item is determined based on the configuration data that uses a nested structure.
6. The code review method according to any one of claims 1 to 5, characterized in that, The step of constructing a code review request for the code to be reviewed based on the code differences and a preset analysis template includes: Obtain multiple template variables of the preset analysis template; The variable values corresponding to each of the multiple template variables are determined based on the code repository configuration and the code differences. The variable values are filled into the corresponding template variable positions in the analysis template to generate the code review request.
7. The code review method according to any one of claims 1 to 5, characterized in that, The step of calling the corresponding intelligent agent according to the intelligent agent configuration includes: Based on the intelligent agent configuration, identify the project type corresponding to the code to be reviewed; Based on the project type of the code to be reviewed, the target agent is called from multiple preset agents.
8. The code review method according to claim 7, characterized in that, The step of calling the target agent from multiple preset agents based on the project type of the code to be reviewed includes: In the case that the project type is a front-end project, a first target agent is invoked, wherein the first target agent is configured with compatibility detection; and / or In the case where the project type is a backend project, a second target agent is invoked, wherein the second target agent is configured with security detection.
9. A code review device, characterized in that, include: A configuration acquisition module is used to acquire review configuration, which includes the code repository configuration and agent configuration of the code to be reviewed, and the code repository configuration includes the baseline branch information of the code to be reviewed. The difference determination module is used to obtain the current branch information of the code to be reviewed and determine the code difference content between the current branch of the code to be reviewed and the baseline branch. The request building module is used to build a code review request for the code to be reviewed based on the code difference content and a preset analysis template. The agent invocation module is used to invoke the corresponding agent according to the agent configuration, and send the code review request to the corresponding agent to obtain the code review report generated by the corresponding agent.
10. An electronic device, characterized in that, include: A processor and a memory storing a computer program, the processor being configured to implement the method as described in any one of claims 1 to 8 when the computer program is executed.
11. A program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 8.