Code review method and device, computer equipment, storage medium and product

By constructing the target heterogeneous diagram of the code review project and applying the code allocation model, the problems of inefficient code review process and inaccurate results in the existing technology are solved, and more efficient and accurate code review is achieved.

CN119645800APending Publication Date: 2025-03-18CHINA LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411728184.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

Existing code review recommendation methods cannot effectively capture the dependence between code and reviewers, resulting in inefficient code review process and inaccurate results.

Method used

By obtaining the information to be reviewed for the code items to be reviewed, a target heterogeneous graph is constructed, the relationship between the candidate review objects and the code to be reviewed is characterized, and based on the code allocation model, the candidate review objects are determined for review.

Benefits of technology

The efficiency of the code review process and the accuracy of the review results are improved. By comprehensively considering the correlation between candidate review objects and the code to be reviewed, the accuracy and adaptability of the review objects are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645800A_ABST
    Figure CN119645800A_ABST
Patent Text Reader

Abstract

The invention relates to a code review method and device, computer equipment, a storage medium and a product. The method comprises the steps of obtaining to-be-reviewed information corresponding to a to-be-reviewed code item; wherein the to-be-reviewed information comprises object attribute information of each candidate reviewed object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate reviewed object and each to-be-reviewed code; according to the to-be-reviewed information, constructing a target heterogeneous graph corresponding to the to-be-reviewed code item; wherein the target heterogeneous graph represents an association relationship between a candidate review object and a to-be-reviewed code in the to-be-reviewed code project; determining candidate review objects corresponding to the to-be-reviewed codes based on a code allocation model according to a target heterogeneous graph corresponding to the to-be-reviewed code items and the to-be-reviewed information; and controlling each candidate review object to review the corresponding to-be-reviewed code. By adopting the method, the efficiency of a code review process can be improved, and the accuracy of a code review result is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a code review method, apparatus, computer equipment, storage medium and product. Background Art

[0002] Code review technology is a key link in the development process to ensure code quality, improve team collaboration efficiency, and reduce errors and maintenance costs. Through code review, developers can find potential problems, improve code readability, and ensure that the code complies with project standards and best practices.

[0003] Currently, existing code review recommendation methods usually rely on static code change features or historical data to recommend reviewers, such as collaborative filtering, supervised learning, content-based recommendation, etc.; however, the above methods cannot effectively capture the dependency between code and reviewers, resulting in reduced adaptability between the assigned code and reviewers, thereby reducing the efficiency of the code review process and failing to guarantee the accuracy of the code review results. Summary of the invention

[0004] Based on this, it is necessary to provide a code review method, device, computer equipment, and storage medium product to address the above technical problems, which can improve the efficiency of the code review process and ensure the accuracy of the code review results.

[0005] In a first aspect, the present application provides a code review method, comprising:

[0006] Acquire the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code;

[0007] According to the information to be reviewed, a target heterogeneous graph corresponding to the code project to be reviewed is constructed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed;

[0008] Based on the code allocation model, determining the candidate review objects corresponding to each code to be reviewed according to the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed;

[0009] Control each candidate review object to review the corresponding code to be reviewed.

[0010] In one of the embodiments, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges, and review relationship edges;

[0011] The step of constructing a target heterogeneous graph corresponding to the code project to be reviewed according to the information to be reviewed includes:

[0012] According to the object attribute information of each candidate review object, an object node representing each candidate review object is constructed;

[0013] According to the code attribute information of each code to be reviewed, a code node representing each code to be reviewed is constructed;

[0014] Determine, according to the association information between each candidate review object and each code to be reviewed, a first object code pair having a submission association relationship and a second object code pair having a review association relationship;

[0015] A submission relationship edge is constructed between the first object code pairs, and a review relationship edge is constructed between the second object code pairs.

[0016] In one of the embodiments, the code allocation model includes a word embedding neural network and a heterogeneous graph neural network;

[0017] The code allocation model is based on the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed, and the candidate review object corresponding to each code to be reviewed is determined, including:

[0018] Based on the word embedding neural network, a vector embedding heterogeneous graph is determined according to the target heterogeneous graph and the information to be reviewed; wherein the vector embedding heterogeneous graph is a target heterogeneous graph in which attribute vectors are embedded;

[0019] Based on the heterogeneous graph neural network, the candidate review objects corresponding to each of the codes to be reviewed are determined according to the vector embedding heterogeneous graph.

[0020] In one of the embodiments, the word embedding neural network includes a vector extraction layer and a word embedding layer;

[0021] The word embedding neural network-based method determines the vector embedding heterogeneous graph according to the target heterogeneous graph and the information to be reviewed, including:

[0022] Inputting the information to be reviewed into the vector extraction layer to obtain the attribute vector output by the vector extraction layer;

[0023] The attribute vector and the target heterogeneous graph are input into the word embedding layer to obtain the vector embedding heterogeneous graph output by the word embedding layer.

[0024] In one of the embodiments, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges and review relationship edges, and the attribute vector includes an object attribute vector corresponding to each candidate review object, a code attribute vector corresponding to each code to be reviewed, a submission relationship attribute vector and a review relationship attribute vector;

[0025] The step of inputting the information to be reviewed into the vector extraction layer to obtain the attribute vector output by the vector extraction layer includes:

[0026] Inputting the object attribute information of each candidate review object into the vector extraction layer to obtain the object attribute vector of the object node corresponding to each candidate review object;

[0027] Inputting the code attribute information of each code to be reviewed into the vector extraction layer to obtain the code attribute vector of the code node corresponding to each code to be reviewed;

[0028] The association information between each of the candidate review objects and each of the to-be-reviewed codes is input into the vector extraction layer to obtain the submission relationship attribute vector of each submission relationship edge and the review relationship attribute vector of each review relationship edge.

[0029] In one embodiment, the step of inputting the attribute vector and the target heterogeneous graph into the word embedding layer to obtain the vector embedding heterogeneous graph output by the word embedding layer includes:

[0030] The object attribute vector of each object node, the code attribute vector of each code node, the submission relationship attribute vector of each submission relationship edge, the review relationship attribute vector of each review relationship edge, and the target heterogeneous graph are input into the word embedding layer, so that the word embedding layer embeds the object attribute vector of each object node into the corresponding object node, embeds the code attribute vector of each code node into the corresponding code node, embeds the submission relationship attribute vector of each submission relationship edge into the corresponding submission relationship edge, and embeds the review relationship attribute vector of each review relationship edge into the corresponding review relationship edge, and outputs the vector embedded heterogeneous graph.

[0031] In a second aspect, the present application also provides a code review device, comprising:

[0032] An information acquisition module is used to acquire the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code;

[0033] A heterogeneous graph construction module is used to construct a target heterogeneous graph corresponding to the code project to be reviewed according to the information to be reviewed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed;

[0034] An object determination module, used to determine the candidate review object corresponding to each code to be reviewed based on the code allocation model and the target heterogeneous graph corresponding to the code to be reviewed and the information to be reviewed;

[0035] The code review module is used to control each candidate review object to review the corresponding code to be reviewed.

[0036] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0037] Acquire the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code;

[0038] According to the information to be reviewed, a target heterogeneous graph corresponding to the code project to be reviewed is constructed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed;

[0039] Based on the code allocation model, determining the candidate review objects corresponding to each code to be reviewed according to the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed;

[0040] Control each candidate review object to review the corresponding code to be reviewed.

[0041] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0042] Acquire the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code;

[0043] According to the information to be reviewed, a target heterogeneous graph corresponding to the code project to be reviewed is constructed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed;

[0044] Based on the code allocation model, determining the candidate review objects corresponding to each code to be reviewed according to the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed;

[0045] Control each candidate review object to review the corresponding code to be reviewed.

[0046] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0047] Acquire the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code;

[0048] According to the information to be reviewed, a target heterogeneous graph corresponding to the code project to be reviewed is constructed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed;

[0049] Based on the code allocation model, determining the candidate review objects corresponding to each code to be reviewed according to the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed;

[0050] Control each candidate review object to review the corresponding code to be reviewed.

[0051] The above-mentioned code review method, apparatus, computer equipment, storage medium and product, because the information to be reviewed not only includes the object attribute information of each candidate review object in the code project to be reviewed and the code attribute information of each code to be reviewed, but also includes the association information between each candidate review object and each code to be reviewed, is equivalent to comprehensively considering the association between each candidate review object and each code to be reviewed, ensuring that the constructed target heterogeneous graph corresponding to the code project to be reviewed can accurately characterize the association relationship between the candidate review object and the code to be reviewed in the code project to be reviewed; further, by introducing a code allocation model, and based on the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed, the accuracy and adaptability of the candidate review objects corresponding to each code to be reviewed are guaranteed, and the efficiency of the review process of each candidate review object reviewing the corresponding code to be reviewed and the accuracy of the review results are further guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0053] Figure 1 A flowchart of a code review method in one embodiment;

[0054] Figure 2 A target heterogeneous graph corresponding to a code project to be reviewed constructed in an embodiment;

[0055] Figure 3 A schematic diagram of a process for determining candidate review objects corresponding to each code to be reviewed in one embodiment;

[0056] Figure 4 A schematic diagram of a process for determining a vector embedding heterogeneous graph in one embodiment;

[0057] Figure 5 A schematic diagram of a process for determining an attribute vector in one embodiment;

[0058] Figure 6 A flowchart of a code review method in another embodiment;

[0059] Figure 7 is a structural block diagram of a code review device in one embodiment;

[0060] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0062] The code review method provided in the embodiment of the present application can be applied to an application environment for reviewing codes in a code project. The code review method provided in the embodiment of the present application can be executed by a computer device, which can be a server or a terminal with powerful computing capabilities.

[0063] In one embodiment, Figure 1 As shown, a code review method is provided, which is applied to Figure 1 The server in the example is used as an example to illustrate the specific steps:

[0064] S101, obtaining the to-be-reviewed information corresponding to the to-be-reviewed code project.

[0065] The information to be reviewed includes, but is not limited to, object attribute information of each candidate review object in the code project to be reviewed, code attribute information of each code to be reviewed, and association information between each candidate review object and each code to be reviewed. The candidate review object is the party that reviews the code, for example, the candidate review object can be a reviewer; the code to be reviewed is the code that needs to be reviewed; in the embodiment of the present application, the candidate review object can upload and submit the code to be reviewed, and can also review the code to be reviewed.

[0066] The association information between each candidate review object and each code to be reviewed represents the association relationship between each candidate review object and each code to be reviewed; it should be noted that the association relationship between the candidate review object and the code to be reviewed can be a submission association relationship, a review association relationship, or no association relationship. Among them, if the candidate review object submits the code to be reviewed, the candidate review object and the code to be reviewed have a submission association relationship; if the candidate review object has reviewed the code to be reviewed, the candidate review object and the code to be reviewed have a review association relationship.

[0067] Optionally, object attribute information of each candidate review object corresponding to the code project to be reviewed, code attribute information of each code to be reviewed, and association information between each candidate review object and each code to be reviewed can be obtained from the code submission record and review record of the code project to be reviewed.

[0068] S102: construct a target heterogeneous graph corresponding to the code project to be reviewed according to the information to be reviewed.

[0069] The target heterogeneous graph represents the association between the candidate review objects and the code to be reviewed in the code to be reviewed project. In the embodiment of the present application, the target heterogeneous graph may include but is not limited to code nodes, object nodes, submission relationship edges and review relationship edges.

[0070] Optionally, according to preset target heterogeneous graph construction rules, important features can be extracted from the information to be reviewed to construct a target heterogeneous graph corresponding to the code project to be reviewed.

[0071] Optionally, in order to ensure the accuracy of the constructed target heterogeneous graph, object nodes representing each candidate review object can be constructed based on the object attribute information of each candidate review object; code nodes representing each code to be reviewed can be constructed based on the code attribute information of each code to be reviewed; first object code pairs with a submission association relationship and second object code pairs with a review association relationship can be determined based on the association information between each candidate review object and each code to be reviewed; submission relationship edges between the first object code pairs can be constructed, and review relationship edges between the second object code pairs can be constructed. It can be understood that by constructing the target heterogeneous graph, not only the association relationship between the candidate review object and the code to be reviewed is represented, but also the collaboration mode between each candidate review object is indirectly represented, and also the association relationship between each code to be reviewed is indirectly represented.

[0072] Specifically, the nodes in the target heterogeneous graph are composed of two different types of nodes: ;in, Indicates the first person who participated in the code submission and review process. Candidate review subjects, Representative The code to be reviewed after submission needs to be reviewed; according to the code submission and review records, the connection edges between the nodes are constructed based on the target heterogeneous graph constructed above. It consists of two different types of connections ; Among them, the edge Indicates Candidates for review Submitted Code to be reviewed ,side Indicates Candidates for review Reviewed the Code to be reviewed This completes the definition of the topological structure of the target heterogeneous graph. .

[0073] For example, if the code project to be reviewed includes , , and Candidates for review include: and Two codes to be reviewed, and and There is a submission relationship between them. and There is a review relationship between them. and and There is a review relationship between them. and There is a review relationship between them. and There is a submission association relationship between them. According to the above code projects to be reviewed, Figure 2 As shown, it is the target heterogeneous graph corresponding to the code project to be reviewed constructed in the embodiment of the present application. , , and All nodes are candidate review objects. and All of them are code nodes for code to be reviewed; dotted lines are review relationship edges, and solid lines are submission relationship edges.

[0074] S103, based on the code allocation model, according to the target heterogeneous graph corresponding to the code items to be reviewed and the information to be reviewed, determining the candidate review objects corresponding to each code to be reviewed.

[0075] Among them, the code allocation model is used to assign suitable candidate review objects to the code to be reviewed; in an embodiment of the present application, the code allocation model can be constructed by a word embedding neural network and a heterogeneous graph neural network.

[0076] Optionally, the target heterogeneous graph and information to be reviewed corresponding to the code project to be reviewed can be input into the code allocation model, so that the code allocation model can perform calculations and analysis on the target heterogeneous graph and information to be reviewed according to model parameters and internal logic, and use the output results of the code allocation model as candidate review objects corresponding to each code to be reviewed.

[0077] S104, controlling each candidate review object to review the corresponding code to be reviewed.

[0078] In the above code review method, since the information to be reviewed not only includes the object attribute information of each candidate review object in the code project to be reviewed and the code attribute information of each code to be reviewed, but also includes the association information between each candidate review object and each code to be reviewed, it is equivalent to comprehensively considering the association between each candidate review object and each code to be reviewed, ensuring that the target heterogeneous graph corresponding to the constructed code project to be reviewed can accurately represent the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed; further, by introducing a code allocation model, and based on the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed, the accuracy and adaptability of the candidate review objects corresponding to each code to be reviewed are guaranteed, and the efficiency of the review process in which each candidate review object reviews the corresponding code to be reviewed and the accuracy of the review results are further guaranteed.

[0079] Optionally, in one embodiment, the code assignment model includes a word embedding neural network and a heterogeneous graph neural network. In this case, Figure 3 As shown, a method for determining candidate review objects corresponding to each code to be reviewed is provided, and the above S103 is refined, specifically including the following steps:

[0080] S301, based on the word embedding neural network, determine the vector embedding heterogeneous graph according to the target heterogeneous graph and the information to be reviewed.

[0081] The vector embedding heterogeneous graph is a target heterogeneous graph in which attribute vectors are embedded. The word embedding neural network is used to embed attribute vectors into the target heterogeneous graph. In an embodiment of the present application, the word embedding neural network may include a vector extraction layer and a word embedding layer.

[0082] Optionally, the target heterogeneous graph and the information to be reviewed can be input into a word embedding neural network so that the word embedding neural network extracts the attribute vectors corresponding to each node and each edge in the target heterogeneous graph, embeds the extracted attribute vectors into the corresponding edges and nodes, and outputs the vector embedded heterogeneous graph.

[0083] S302, based on the heterogeneous graph neural network, according to the vector embedding heterogeneous graph, determine the candidate review object corresponding to each code to be reviewed.

[0084] Among them, heterogeneous graph neural networks are used to continuously update the embedded representations of nodes and edges in the semantic space through message passing and information aggregation.

[0085] Optional, in the total number of layers In the heterogeneous graph neural network, the message passing and information aggregation of each layer are as shown in the following formula (1):

[0086] (1)

[0087] in, Indicates Layer Node The properties of the node at level 0 The attribute of is the attribute vector embedded in each node (object node or code node) in the heterogeneous graph; Representation Node With Node The attributes on the edges between are the attribute vectors embedded in each edge (submission relationship edge or review relationship edge) in the vector embedding heterogeneous graph; Represents the type of edge in the vector embedding heterogeneous graph; Indicates that for the node Type Neighbor nodes (i.e., nodes There is a type The connected node set); is the regularization constant, which is numerically equal to the node Type The number of neighbor nodes ; Indicates The type of aggregation used for the layer is The linear change function of the nodes connected by the edges; represents the projection matrix; Represents the activation function.

[0088] Optionally, the vector embedding heterogeneous graph is input into the heterogeneous graph neural network, and the heterogeneous graph neural network iteratively calculates the vector embedding heterogeneous graph according to the above formula (1), and outputs the calculated representations of each code node and each object node. Furthermore, the vector embedding probability calculation formula of any object node in the heterogeneous graph can be calculated by a preset link probability calculation formula, such as the following formula (2). and any code node Possibility of a link between:

[0089] (2)

[0090] in, is the total number of layers of the heterogeneous graph neural network.

[0091] Furthermore, for any code node, the object node with the greatest possibility of being linked to the code node is used as the object node corresponding to the code node, that is, the candidate review object corresponding to the object node is used as the candidate review object corresponding to the code to be reviewed corresponding to the code node.

[0092] In this embodiment, by introducing word embedding neural networks and heterogeneous graph neural networks, the association relationship between candidate review objects and the code to be reviewed in the code project to be reviewed can be effectively captured, thereby more accurately recommending candidate review objects related to the code to be reviewed.

[0093] Optionally, in one embodiment, the word embedding neural network includes a vector extraction layer and a word embedding layer; in this case, Figure 4 As shown, a method for determining a vector embedding heterogeneous graph is provided to refine the above S301, specifically comprising the following steps:

[0094] S401, input the information to be reviewed into the vector extraction layer to obtain the attribute vector output by the vector extraction layer.

[0095] Among them, the vector extraction layer is used to convert the text attributes in the review information into vectors of preset length. In the embodiment of the present application, the vector extraction layer can be constructed according to a normal distribution with a preset mean and a preset variance.

[0096] Optionally, the information to be reviewed is input into a vector extraction layer, so that the vector extraction layer extracts an attribute vector from the information to be reviewed according to a preset rule.

[0097] S402, input the attribute vector and the target heterogeneous graph into the word embedding layer to obtain the vector embedding heterogeneous graph output by the word embedding layer.

[0098] Optionally, the attribute vector and the target heterogeneous graph are input into a word embedding layer, so that the word embedding layer embeds the attribute vector into the target heterogeneous graph according to a preset rule, and outputs the vector embedded heterogeneous graph.

[0099] In this embodiment, by introducing the vector extraction layer, the attribute vector in the information to be reviewed can be accurately extracted; at the same time, by introducing the word embedding layer, the attribute vector can be accurately embedded into the target heterogeneous graph, thereby ensuring the accuracy of the obtained vector embedding heterogeneous graph.

[0100] Optionally, in one embodiment, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges and review relationship edges, and the attribute vector includes the object attribute vector corresponding to each candidate review object, the code attribute vector corresponding to each code to be reviewed, the submission relationship attribute vector and the review relationship attribute vector; in this case, Figure 5 As shown, a method for determining an attribute vector is provided to refine the above S401, and specifically includes the following steps:

[0101] S501, inputting the object attribute information of each candidate review object into the vector extraction layer to obtain the object attribute vector of the object node corresponding to each candidate review object.

[0102] Optionally, the object attribute information of each candidate review object can be input into the vector extraction layer, so that the vector extraction layer generates an object attribute vector according to the object attribute information based on preset rules. Exemplarily, for any candidate review object, the object attribute information of the candidate review object includes but is not limited to the object name, submission email address, etc., and the object attribute information is input into the vector extraction layer so that the vector extraction layer outputs a length of Object property vector .

[0103] S502: Input the code attribute information of each code to be reviewed into the vector extraction layer to obtain the code attribute vector of the code node corresponding to each code to be reviewed.

[0104] Optionally, the code attribute information of each code to be reviewed can be input into the vector extraction layer, so that the vector extraction layer generates a code attribute vector according to the code attribute information based on preset rules. Exemplarily, for any code to be reviewed, the code attribute information of the code to be reviewed includes but is not limited to the text attributes submitted by the code, including but not limited to the warehouse name, code file name, code file address, etc., and the code attribute information is input into the vector extraction layer, so that the vector extraction layer outputs a length of Object property vector .

[0105] S503, inputting the association information between each candidate review object and each to-be-reviewed code into the vector extraction layer, and obtaining the submission relationship attribute vector of each submission relationship edge and the review relationship attribute vector of each review relationship edge.

[0106] Optionally, the associated information between the candidate review objects and the code to be reviewed that have a submission association relationship includes but is not limited to submission time, submission text information, etc.; the associated information between the candidate review objects and the code to be reviewed that have a review association relationship includes but is not limited to review time, review opinions, review information, etc.

[0107] Furthermore, the association information of any candidate review object with a submission association relationship and the code to be reviewed can be input into the vector extraction layer, and the length of the submission relationship edge can be obtained as The submission relation attribute vector ; and input the association information of any candidate review object with review association relationship and the code to be reviewed into the vector extraction layer, and the length of the review relationship edge is The review relationship attribute vector .

[0108] In this embodiment, by introducing object attribute vectors, code attribute vectors, submission relationship attribute vectors and review relationship attribute vectors, a method for accurately and quickly determining attribute vectors is provided, while ensuring the accuracy of the determined attribute vectors.

[0109] It should be noted that, based on the method for determining the attribute vector provided by S501-S503 provided in the above-mentioned embodiment, in an embodiment of the present application, the attribute vector and the target heterogeneous graph are input into the word embedding layer to obtain the vector embedded heterogeneous graph output by the word embedding layer. The implementation method can also be: the object attribute vector of each object node, the code attribute vector of each code node, the submission relationship attribute vector of each submission relationship edge, the review relationship attribute vector of each review relationship edge, and the target heterogeneous graph are input into the word embedding layer, so that the word embedding layer embeds the object attribute vector of each object node into the corresponding object node, embeds the code attribute vector of each code node into the corresponding code node, embeds the submission relationship attribute vector of each submission relationship edge into the corresponding submission relationship edge, and embeds the review relationship attribute vector of each review relationship edge into the corresponding review relationship edge, and outputs the vector embedded heterogeneous graph.

[0110] Optionally, in an embodiment of the present application, if the code allocation model includes a word embedding neural network and a heterogeneous graph neural network, the embodiment of the present application also provides a training method for the code allocation model. Specifically, the training strategy of positive and negative sample pairs is used, and the cross-entropy loss function (CELF) is used to optimize the heterogeneous graph neural network to complete the training process of the heterogeneous graph neural network and the word embedding neural network. First, sample data is obtained, wherein the sample data includes the object attribute information of each candidate review object in the reference review code project, the code attribute information of each code to be reviewed, and the association information between each candidate review object and each code to be reviewed, and the sample data is input into the constructed initial word embedding neural network and heterogeneous graph neural network, and the node representation result output by the heterogeneous graph neural network is obtained; further, based on the above formula (2), the possibility of a link between any two predicted nodes is obtained, and a predefined noise distribution is used. , using the negative sampling strategy to train the heterogeneous graph neural network word embedding neural network. In the negative sampling strategy, the nodes that actually exist are connected ( ) is considered as a positive sample, and from All nodes sampled It is regarded as a negative sample (i.e., a false non-existent edge connection), and the cross entropy loss function is used to calculate the difference between the positive sample pair and the negative sample pair as the loss value. The cross entropy loss function is calculated as shown in the following formula (3):

[0111] (3)

[0112] Furthermore, based on the loss function defined above and the corresponding training strategy, the optimizer Optim is used to optimize the loss value defined by the loss function to complete the optimization of the trainable parameters in the heterogeneous graph neural network and the word embedding neural network.

[0113] Figure 6 FIG. 1 is a flowchart of a code review method in another embodiment. Based on the above embodiment, this embodiment provides an optional example of a code review method. Figure 6 The specific implementation process is as follows:

[0114] S601, obtaining the to-be-reviewed information corresponding to the to-be-reviewed code project.

[0115] The information to be reviewed includes object attribute information of each candidate review object in the code project to be reviewed, code attribute information of each code to be reviewed, and association information between each candidate review object and each code to be reviewed.

[0116] S602: constructing an object node representing each candidate review object according to the object attribute information of each candidate review object in the information to be reviewed.

[0117] S603: constructing a code node representing each code to be reviewed according to the code attribute information of each code to be reviewed in the information to be reviewed.

[0118] S604: Determine a first object code pair having a submission association relationship and a second object code pair having a review association relationship according to association information between each candidate review object and each code to be reviewed in the information to be reviewed.

[0119] S605: construct a submission relationship edge between the first object code pairs, and construct a review relationship edge between the second object code pairs.

[0120] S606: Construct a target heterogeneous graph corresponding to the code project to be reviewed according to the object nodes, code nodes, submission relationship edges and review relationship edges.

[0121] S607, inputting the object attribute information of each candidate review object into the vector extraction layer of the word embedding neural network to obtain the object attribute vector of the object node corresponding to each candidate review object.

[0122] S608, inputting the code attribute information of each code to be reviewed into the vector extraction layer of the word embedding neural network to obtain the code attribute vector of the code node corresponding to each code to be reviewed.

[0123] S609, inputting the association information between each candidate review object and each code to be reviewed into the vector extraction layer of the word embedding neural network to obtain the submission relationship attribute vector of each submission relationship edge and the review relationship attribute vector of each review relationship edge.

[0124] S610, input the object attribute vector of each object node, the code attribute vector of each code node, the submission relationship attribute vector of each submission relationship edge, the review relationship attribute vector of each review relationship edge, and the target heterogeneous graph into the word embedding layer to obtain the vector embedded heterogeneous graph output by the word embedding layer.

[0125] Optionally, the word embedding layer embeds the object attribute vector of each object node into the corresponding object node, embeds the code attribute vector of each code node into the corresponding code node, embeds the submission relationship attribute vector of each submission relationship edge into the corresponding submission relationship edge, and embeds the review relationship attribute vector of each review relationship edge into the corresponding review relationship edge, and outputs a vector embedding heterogeneous graph.

[0126] S611, based on the heterogeneous graph neural network, according to the vector embedding heterogeneous graph, determine the candidate review object corresponding to each code to be reviewed.

[0127] S612, controlling each candidate review object to review the corresponding code to be reviewed.

[0128] The specific process of S601-S612 can refer to the description of the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0129] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0130] Based on the same inventive concept, the embodiment of the present application also provides a code review device for implementing the code review method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more code review device embodiments provided below can refer to the limitations of the code review method above, and will not be repeated here.

[0131] In an exemplary embodiment, Figure 7As shown, a code review device 700 is provided, including: an information acquisition module 710, a heterogeneous graph construction module 720, an object determination module 730 and a code review module 740, wherein:

[0132] The information acquisition module 710 is used to acquire the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code;

[0133] The heterogeneous graph construction module 720 is used to construct a target heterogeneous graph corresponding to the code project to be reviewed according to the information to be reviewed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed;

[0134] The object determination module 730 is used to determine the candidate review object corresponding to each code to be reviewed based on the code allocation model, according to the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed;

[0135] The code review module 740 is used to control each candidate review object to review the corresponding code to be reviewed.

[0136] The above-mentioned code review device, since the information to be reviewed not only includes the object attribute information of each candidate review object in the code project to be reviewed and the code attribute information of each code to be reviewed, but also includes the association information between each candidate review object and each code to be reviewed, is equivalent to comprehensively considering the association between each candidate review object and each code to be reviewed, ensuring that the constructed target heterogeneous graph corresponding to the code project to be reviewed can accurately characterize the association relationship between the candidate review objects and the codes to be reviewed in the code project to be reviewed; further, by introducing a code allocation model, and based on the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed, the accuracy and adaptability of the candidate review objects corresponding to each code to be reviewed are guaranteed, and the efficiency of the review process of each candidate review object reviewing the corresponding code to be reviewed and the accuracy of the review results are further guaranteed.

[0137] In one embodiment, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges, and review relationship edges; the heterogeneous graph construction module 720 is specifically used to:

[0138] According to the object attribute information of each candidate review object, an object node representing each candidate review object is constructed; according to the code attribute information of each code to be reviewed, a code node representing each code to be reviewed is constructed; according to the association information between each candidate review object and each code to be reviewed, a first object code pair with a submission association relationship and a second object code pair with a review association relationship are determined; a submission relationship edge between the first object code pairs is constructed, and a review relationship edge between the second object code pairs is constructed.

[0139] In one embodiment, the code allocation model includes a word embedding neural network and a heterogeneous graph neural network; the object determination module 730 includes:

[0140] The first determination unit is used to determine a vector embedding heterogeneous graph based on a word embedding neural network, according to a target heterogeneous graph and information to be reviewed; wherein the vector embedding heterogeneous graph is a target heterogeneous graph for embedding attribute vectors.

[0141] The second determination unit is used to determine the candidate review objects corresponding to each code to be reviewed based on the heterogeneous graph neural network and according to the vector embedding heterogeneous graph.

[0142] In one embodiment, the word embedding neural network includes a vector extraction layer and a word embedding layer; the first determination unit includes:

[0143] The first determination subunit is used to input the information to be reviewed into the vector extraction layer to obtain the attribute vector output by the vector extraction layer.

[0144] The second determination subunit is used to input the attribute vector and the target heterogeneous graph into the word embedding layer to obtain the vector embedding heterogeneous graph output by the word embedding layer.

[0145] In one embodiment, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges and review relationship edges, and the attribute vector includes an object attribute vector corresponding to each candidate review object, a code attribute vector corresponding to each code to be reviewed, a submission relationship attribute vector and a review relationship attribute vector; the first determination subunit is specifically used to:

[0146] The object attribute information of each candidate review object is input into the vector extraction layer to obtain the object attribute vector of the object node corresponding to each candidate review object; the code attribute information of each code to be reviewed is input into the vector extraction layer to obtain the code attribute vector of the code node corresponding to each code to be reviewed; the association information between each candidate review object and each code to be reviewed is input into the vector extraction layer to obtain the submission relationship attribute vector of each submission relationship edge and the review relationship attribute vector of each review relationship edge.

[0147] In one embodiment, the second determining subunit is specifically used for:

[0148] The object attribute vector of each object node, the code attribute vector of each code node, the submission relationship attribute vector of each submission relationship edge, the review relationship attribute vector of each review relationship edge, and the target heterogeneous graph are input into the word embedding layer, so that the word embedding layer embeds the object attribute vector of each object node into the corresponding object node, embeds the code attribute vector of each code node into the corresponding code node, embeds the submission relationship attribute vector of each submission relationship edge into the corresponding submission relationship edge, and embeds the review relationship attribute vector of each review relationship edge into the corresponding review relationship edge, and outputs the vector embedded heterogeneous graph.

[0149] Each module in the above-mentioned code review device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0150] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a code review method is implemented.

[0151] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0152] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0153] Obtaining the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code;

[0154] According to the information to be reviewed, a target heterogeneous graph corresponding to the code project to be reviewed is constructed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed;

[0155] Based on the code allocation model, the candidate review objects corresponding to each code to be reviewed are determined according to the target heterogeneous graph corresponding to the code to be reviewed and the information to be reviewed;

[0156] Control each candidate review object to review the corresponding code to be reviewed.

[0157] In one embodiment, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges, and review relationship edges; when the processor executes the computer program to construct the target heterogeneous graph corresponding to the code project to be reviewed according to the information to be reviewed, the processor also implements the following steps:

[0158] According to the object attribute information of each candidate review object, an object node representing each candidate review object is constructed; according to the code attribute information of each code to be reviewed, a code node representing each code to be reviewed is constructed; according to the association information between each candidate review object and each code to be reviewed, a first object code pair with a submission association relationship and a second object code pair with a review association relationship are determined; a submission relationship edge between the first object code pairs is constructed, and a review relationship edge between the second object code pairs is constructed.

[0159] In one embodiment, the code allocation model includes a word embedding neural network and a heterogeneous graph neural network; when the processor executes the computer program based on the code allocation model, according to the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed, to determine the candidate review object corresponding to each code to be reviewed, the following steps are also implemented:

[0160] Based on the word embedding neural network, the vector embedding heterogeneous graph is determined according to the target heterogeneous graph and the information to be reviewed; wherein the vector embedding heterogeneous graph is the target heterogeneous graph in which the attribute vector is embedded; based on the heterogeneous graph neural network, the candidate review objects corresponding to each code to be reviewed are determined according to the vector embedding heterogeneous graph.

[0161] In one embodiment, the word embedding neural network includes a vector extraction layer and a word embedding layer; when the processor executes the computer program to determine the vector embedding heterogeneous graph based on the word embedding neural network according to the target heterogeneous graph and the information to be reviewed, the following steps are also implemented:

[0162] The information to be reviewed is input into the vector extraction layer to obtain the attribute vector output by the vector extraction layer; the attribute vector and the target heterogeneous graph are input into the word embedding layer to obtain the vector embedding heterogeneous graph output by the word embedding layer.

[0163] In one embodiment, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges and review relationship edges, and the attribute vector includes an object attribute vector corresponding to each candidate review object, a code attribute vector corresponding to each code to be reviewed, a submission relationship attribute vector and a review relationship attribute vector; when the processor executes a computer program to input the information to be reviewed into the vector extraction layer, and obtains the attribute vector output by the vector extraction layer, the following steps are also implemented:

[0164] The object attribute information of each candidate review object is input into the vector extraction layer to obtain the object attribute vector of the object node corresponding to each candidate review object; the code attribute information of each code to be reviewed is input into the vector extraction layer to obtain the code attribute vector of the code node corresponding to each code to be reviewed; the association information between each candidate review object and each code to be reviewed is input into the vector extraction layer to obtain the submission relationship attribute vector of each submission relationship edge and the review relationship attribute vector of each review relationship edge.

[0165] In one embodiment, when the processor executes a computer program to input the attribute vector and the target heterogeneous graph into the word embedding layer and obtains the vector embedding heterogeneous graph output by the word embedding layer, the following steps are also implemented:

[0166] The object attribute vector of each object node, the code attribute vector of each code node, the submission relationship attribute vector of each submission relationship edge, the review relationship attribute vector of each review relationship edge, and the target heterogeneous graph are input into the word embedding layer, so that the word embedding layer embeds the object attribute vector of each object node into the corresponding object node, embeds the code attribute vector of each code node into the corresponding code node, embeds the submission relationship attribute vector of each submission relationship edge into the corresponding submission relationship edge, and embeds the review relationship attribute vector of each review relationship edge into the corresponding review relationship edge, and outputs the vector embedded heterogeneous graph.

[0167] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0168] Obtaining the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code;

[0169] According to the information to be reviewed, a target heterogeneous graph corresponding to the code project to be reviewed is constructed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed;

[0170] Based on the code allocation model, the candidate review objects corresponding to each code to be reviewed are determined according to the target heterogeneous graph corresponding to the code to be reviewed and the information to be reviewed;

[0171] Control each candidate review object to review the corresponding code to be reviewed.

[0172] In one embodiment, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges, and review relationship edges; when the processor executes the computer program to construct the target heterogeneous graph corresponding to the code project to be reviewed according to the information to be reviewed, the processor also implements the following steps:

[0173] According to the object attribute information of each candidate review object, an object node representing each candidate review object is constructed; according to the code attribute information of each code to be reviewed, a code node representing each code to be reviewed is constructed; according to the association information between each candidate review object and each code to be reviewed, a first object code pair with a submission association relationship and a second object code pair with a review association relationship are determined; a submission relationship edge between the first object code pairs is constructed, and a review relationship edge between the second object code pairs is constructed.

[0174] In one embodiment, the code allocation model includes a word embedding neural network and a heterogeneous graph neural network; when the processor executes the computer program based on the code allocation model, according to the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed, to determine the candidate review object corresponding to each code to be reviewed, the following steps are also implemented:

[0175] Based on the word embedding neural network, the vector embedding heterogeneous graph is determined according to the target heterogeneous graph and the information to be reviewed; wherein the vector embedding heterogeneous graph is the target heterogeneous graph in which the attribute vector is embedded; based on the heterogeneous graph neural network, the candidate review objects corresponding to each code to be reviewed are determined according to the vector embedding heterogeneous graph.

[0176] In one embodiment, the word embedding neural network includes a vector extraction layer and a word embedding layer; when the processor executes the computer program to determine the vector embedding heterogeneous graph based on the word embedding neural network according to the target heterogeneous graph and the information to be reviewed, the following steps are also implemented:

[0177] The information to be reviewed is input into the vector extraction layer to obtain the attribute vector output by the vector extraction layer; the attribute vector and the target heterogeneous graph are input into the word embedding layer to obtain the vector embedding heterogeneous graph output by the word embedding layer.

[0178] In one embodiment, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges and review relationship edges, and the attribute vector includes an object attribute vector corresponding to each candidate review object, a code attribute vector corresponding to each code to be reviewed, a submission relationship attribute vector and a review relationship attribute vector; when the processor executes a computer program to input the information to be reviewed into the vector extraction layer, and obtains the attribute vector output by the vector extraction layer, the following steps are also implemented:

[0179] The object attribute information of each candidate review object is input into the vector extraction layer to obtain the object attribute vector of the object node corresponding to each candidate review object; the code attribute information of each code to be reviewed is input into the vector extraction layer to obtain the code attribute vector of the code node corresponding to each code to be reviewed; the association information between each candidate review object and each code to be reviewed is input into the vector extraction layer to obtain the submission relationship attribute vector of each submission relationship edge and the review relationship attribute vector of each review relationship edge.

[0180] In one embodiment, when the processor executes a computer program to input the attribute vector and the target heterogeneous graph into the word embedding layer and obtains the vector embedding heterogeneous graph output by the word embedding layer, the following steps are also implemented:

[0181] The object attribute vector of each object node, the code attribute vector of each code node, the submission relationship attribute vector of each submission relationship edge, the review relationship attribute vector of each review relationship edge, and the target heterogeneous graph are input into the word embedding layer, so that the word embedding layer embeds the object attribute vector of each object node into the corresponding object node, embeds the code attribute vector of each code node into the corresponding code node, embeds the submission relationship attribute vector of each submission relationship edge into the corresponding submission relationship edge, and embeds the review relationship attribute vector of each review relationship edge into the corresponding review relationship edge, and outputs the vector embedded heterogeneous graph.

[0182] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0183] Obtaining the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code;

[0184] According to the information to be reviewed, a target heterogeneous graph corresponding to the code project to be reviewed is constructed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed;

[0185] Based on the code allocation model, the candidate review objects corresponding to each code to be reviewed are determined according to the target heterogeneous graph corresponding to the code to be reviewed and the information to be reviewed;

[0186] Control each candidate review object to review the corresponding code to be reviewed.

[0187] In one embodiment, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges, and review relationship edges; when the processor executes the computer program to construct the target heterogeneous graph corresponding to the code project to be reviewed according to the information to be reviewed, the processor also implements the following steps:

[0188] According to the object attribute information of each candidate review object, an object node representing each candidate review object is constructed; according to the code attribute information of each code to be reviewed, a code node representing each code to be reviewed is constructed; according to the association information between each candidate review object and each code to be reviewed, a first object code pair with a submission association relationship and a second object code pair with a review association relationship are determined; a submission relationship edge between the first object code pairs is constructed, and a review relationship edge between the second object code pairs is constructed.

[0189] In one embodiment, the code allocation model includes a word embedding neural network and a heterogeneous graph neural network; when the processor executes the computer program based on the code allocation model, according to the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed, to determine the candidate review object corresponding to each code to be reviewed, the following steps are also implemented:

[0190] Based on the word embedding neural network, the vector embedding heterogeneous graph is determined according to the target heterogeneous graph and the information to be reviewed; wherein the vector embedding heterogeneous graph is the target heterogeneous graph in which the attribute vector is embedded; based on the heterogeneous graph neural network, the candidate review objects corresponding to each code to be reviewed are determined according to the vector embedding heterogeneous graph.

[0191] In one embodiment, the word embedding neural network includes a vector extraction layer and a word embedding layer; when the processor executes the computer program to determine the vector embedding heterogeneous graph based on the word embedding neural network according to the target heterogeneous graph and the information to be reviewed, the following steps are also implemented:

[0192] The information to be reviewed is input into the vector extraction layer to obtain the attribute vector output by the vector extraction layer; the attribute vector and the target heterogeneous graph are input into the word embedding layer to obtain the vector embedding heterogeneous graph output by the word embedding layer.

[0193] In one embodiment, the target heterogeneous graph includes code nodes, object nodes, submission relationship edges and review relationship edges, and the attribute vector includes an object attribute vector corresponding to each candidate review object, a code attribute vector corresponding to each code to be reviewed, a submission relationship attribute vector and a review relationship attribute vector; when the processor executes a computer program to input the information to be reviewed into the vector extraction layer, and obtains the attribute vector output by the vector extraction layer, the following steps are also implemented:

[0194] The object attribute information of each candidate review object is input into the vector extraction layer to obtain the object attribute vector of the object node corresponding to each candidate review object; the code attribute information of each code to be reviewed is input into the vector extraction layer to obtain the code attribute vector of the code node corresponding to each code to be reviewed; the association information between each candidate review object and each code to be reviewed is input into the vector extraction layer to obtain the submission relationship attribute vector of each submission relationship edge and the review relationship attribute vector of each review relationship edge.

[0195] In one embodiment, when the processor executes a computer program to input the attribute vector and the target heterogeneous graph into the word embedding layer and obtains the vector embedding heterogeneous graph output by the word embedding layer, the following steps are also implemented:

[0196] The object attribute vector of each object node, the code attribute vector of each code node, the submission relationship attribute vector of each submission relationship edge, the review relationship attribute vector of each review relationship edge, and the target heterogeneous graph are input into the word embedding layer, so that the word embedding layer embeds the object attribute vector of each object node into the corresponding object node, embeds the code attribute vector of each code node into the corresponding code node, embeds the submission relationship attribute vector of each submission relationship edge into the corresponding submission relationship edge, and embeds the review relationship attribute vector of each review relationship edge into the corresponding review relationship edge, and outputs the vector embedded heterogeneous graph.

[0197] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0198] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0199] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0200] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A code review method, characterized in that: The method comprises: Acquire the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code; According to the information to be reviewed, a target heterogeneous graph corresponding to the code project to be reviewed is constructed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed; Based on the code allocation model, determining the candidate review objects corresponding to each code to be reviewed according to the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed; Control each candidate review object to review the corresponding code to be reviewed.

2. The method according to claim 1, characterized in that The target heterogeneous graph includes code nodes, object nodes, submission relationship edges and review relationship edges; The step of constructing a target heterogeneous graph corresponding to the code project to be reviewed according to the information to be reviewed includes: According to the object attribute information of each candidate review object, an object node representing each candidate review object is constructed; According to the code attribute information of each code to be reviewed, a code node representing each code to be reviewed is constructed; Determine, according to the association information between each candidate review object and each code to be reviewed, a first object code pair having a submission association relationship and a second object code pair having a review association relationship; A submission relationship edge is constructed between the first object code pairs, and a review relationship edge is constructed between the second object code pairs.

3. The method according to claim 1, characterized in that The code allocation model includes a word embedding neural network and a heterogeneous graph neural network; The code allocation model is based on the target heterogeneous graph corresponding to the code project to be reviewed and the information to be reviewed, and the candidate review object corresponding to each code to be reviewed is determined, including: Based on the word embedding neural network, a vector embedding heterogeneous graph is determined according to the target heterogeneous graph and the information to be reviewed; wherein the vector embedding heterogeneous graph is a target heterogeneous graph in which attribute vectors are embedded; Based on the heterogeneous graph neural network, the candidate review objects corresponding to each of the codes to be reviewed are determined according to the vector embedding heterogeneous graph.

4. The method according to claim 3, characterized in that The word embedding neural network includes a vector extraction layer and a word embedding layer; The word embedding neural network-based method determines the vector embedding heterogeneous graph according to the target heterogeneous graph and the information to be reviewed, including: Inputting the information to be reviewed into the vector extraction layer to obtain the attribute vector output by the vector extraction layer; The attribute vector and the target heterogeneous graph are input into the word embedding layer to obtain the vector embedding heterogeneous graph output by the word embedding layer.

5. The method according to claim 4, characterized in that The target heterogeneous graph includes code nodes, object nodes, submission relationship edges and review relationship edges, and the attribute vector includes an object attribute vector corresponding to each candidate review object, a code attribute vector corresponding to each code to be reviewed, a submission relationship attribute vector and a review relationship attribute vector; The step of inputting the information to be reviewed into the vector extraction layer to obtain the attribute vector output by the vector extraction layer includes: Inputting the object attribute information of each candidate review object into the vector extraction layer to obtain the object attribute vector of the object node corresponding to each candidate review object; Inputting the code attribute information of each code to be reviewed into the vector extraction layer to obtain the code attribute vector of the code node corresponding to each code to be reviewed; The association information between each of the candidate review objects and each of the to-be-reviewed codes is input into the vector extraction layer to obtain the submission relationship attribute vector of each submission relationship edge and the review relationship attribute vector of each review relationship edge.

6. The method according to claim 5, characterized in that The step of inputting the attribute vector and the target heterogeneous graph into the word embedding layer to obtain the vector embedding heterogeneous graph output by the word embedding layer includes: The object attribute vector of each object node, the code attribute vector of each code node, the submission relationship attribute vector of each submission relationship edge, the review relationship attribute vector of each review relationship edge, and the target heterogeneous graph are input into the word embedding layer, so that the word embedding layer embeds the object attribute vector of each object node into the corresponding object node, embeds the code attribute vector of each code node into the corresponding code node, embeds the submission relationship attribute vector of each submission relationship edge into the corresponding submission relationship edge, and embeds the review relationship attribute vector of each review relationship edge into the corresponding review relationship edge, and outputs the vector embedded heterogeneous graph.

7. A code review device, characterized in that: The device comprises: An information acquisition module is used to acquire the to-be-reviewed information corresponding to the to-be-reviewed code project; wherein the to-be-reviewed information includes object attribute information of each candidate review object in the to-be-reviewed code project, code attribute information of each to-be-reviewed code, and association information between each candidate review object and each to-be-reviewed code; A heterogeneous graph construction module is used to construct a target heterogeneous graph corresponding to the code project to be reviewed according to the information to be reviewed; wherein the target heterogeneous graph represents the association relationship between the candidate review objects and the code to be reviewed in the code project to be reviewed; An object determination module, used to determine the candidate review object corresponding to each code to be reviewed based on the code allocation model and the target heterogeneous graph corresponding to the code to be reviewed and the information to be reviewed; The code review module is used to control each candidate review object to review the corresponding code to be reviewed.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.