A hypergraph construction method, device, equipment and storage medium
By constructing a hypergraph and calculating hyperedge weights, it solves the problem that ordinary graphs cannot describe complex interactive relationships in code reviews, achieves comprehensive modeling of code review data and interpretability of information, and improves the research and management of review activities. efficiency.
Patent Information
- Application Number
- CN202111617933.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Existing ordinary diagrams cannot accurately capture information when describing complex interactive relationships in code reviews, resulting in information loss and excessive numbers of diagrams, making it difficult to meet the requirements for information comprehensiveness and interpretability, which is not conducive to research on review activities. and management.
By constructing a hypergraph, code review data is obtained, the merge request, developer information and reviewer information are determined as target nodes, a hypergraph is constructed based on the relationship between these nodes, and the hyperedge weights are calculated and normalized to more accurately Describing complex relationships in code review.
It achieves comprehensive modeling of code review data, improves the interpretability of information, facilitates subsequent research and management of review activities, and solves the problem that ordinary graphs cannot accurately describe complex relationships.
Smart Images

Figure CN114327583B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of software development technology, and in particular to a hypergraph construction method, apparatus, device and storage medium. Background Art
[0002] Code review is an important process in software development and is crucial to the software quality of both commercial and open source projects. Code review is performed by professional reviewers who manually and carefully check the source code with the goal of identifying problems and potential improvements in the code, thereby preventing problematic code snippets from being merged into the code repository. In addition to code quality assurance, code review also helps with knowledge dissemination and team collaboration. Now there is a need for a reasonable code review data modeling solution to describe the relationship between code merge requests, developers, and reviewers, so as to facilitate the study and management of code review behavior.
[0003] In the prior art, there are already several modeling methods based on composition to describe code review activities. However, all current modeling schemes are based on building ordinary graphs. An ordinary graph is a graph with two nodes on one edge, and it is impossible to connect more than three nodes at the same time. Ordinary graphs cannot accurately describe the complex interactive relationships in code reviews, and some information will be lost, such as the joint review relationship of reviewers. In addition, using ordinary graphs to describe complex review relationships will result in a large number of edges on the graph, which is difficult to understand. Existing technologies cannot meet the model's requirements in terms of information comprehensiveness and explainability, and are not convenient for subsequent research and management of review activities. Summary of the invention
[0004] The embodiments of the present invention provide a hypergraph construction method, apparatus, device and storage medium, which solve the problem that ordinary graphs cannot accurately describe the complex interactive relationships in code reviews, which will result in the loss of some information, and that using ordinary graphs to describe complex review relationships will result in a large number of edges on the graph, which cannot meet the model's requirements in terms of information comprehensiveness and interpretability, and is inconvenient for subsequent research and management of review activities. The method can model the relationship between merge requests, developer information and reviewer information based on code review data, meet information comprehensiveness and interpretability, and facilitate subsequent research and management of review activities.
[0005] In a first aspect, an embodiment of the present invention provides a hypergraph construction method, comprising:
[0006] Get code review data;
[0007] Determine at least two target nodes according to the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information;
[0008] A target hypergraph is constructed according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests.
[0009] Further, after constructing the target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests, the method further includes:
[0010] Get the target merge request;
[0011] Based on the target merge request, the target hypergraph is queried to obtain target developer information and a matching degree with the target merge request and reviewer information;
[0012] The reviewer information whose matching degree is greater than the matching degree threshold is sent to the terminal corresponding to the target developer information.
[0013] Further, after constructing the target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests, the method further includes:
[0014] Get target developer information;
[0015] Querying the target hypergraph based on the target developer information to obtain a matching degree between the target developer information and the reviewer information;
[0016] The reviewer information whose matching degree is greater than the matching degree threshold is sent to the terminal corresponding to the target developer information.
[0017] Furthermore, a target hypergraph is constructed according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests, including:
[0018] Obtaining the weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests;
[0019] Normalizing the weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests;
[0020] A hypergraph is constructed according to the normalized weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests.
[0021] Further, obtaining the weight of the hyperedge between the merge request and the reviewer information includes:
[0022] Determining a request set based on the code review data;
[0023] Obtain the creation time corresponding to the merge request, the reviewer information set corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request;
[0024] The weight of the hyperedge between the merge request and the reviewer information is determined based on the creation time corresponding to the merge request, the reviewer information set corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs.
[0025] Furthermore, the reviewer information set includes: the number of reviewers, the number of review comments of each reviewer, and the release time corresponding to each review comment;
[0026] Determining the weight of the hyperedge between the merge request and the reviewer information according to the creation time corresponding to the merge request, the reviewer information set corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs, including:
[0027] The weight of the hyperedge between the merge request and the reviewer information is determined based on the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the target request belongs, the number of reviewers, the number of review opinions of each reviewer, and the publication time corresponding to each review opinion.
[0028] Further, obtaining the weight of the hyperedge between the merge request and the developer information includes:
[0029] The weight of the hyperedge between the merge request and the developer information is determined according to the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs.
[0030] Further, obtaining the weight of the hyperedge between any two of the merge requests includes:
[0031] Obtain a set of modified files corresponding to any two merge requests;
[0032] Calculate the similarity between any two modified files in each modified file set;
[0033] The weight of the hyperedge between any two merge requests is determined based on the length of the modified file set, the similarity between any two modified files in each modified file set, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the merge request belongs, and the creation time corresponding to any two merge requests.
[0034] Furthermore, the similarity between any two modified files in each modified file set is calculated, including:
[0035] Get the path of each modified file in the modified file collection;
[0036] Determine the same prefix length of any two modified files and the path depth of each modified file according to the paths of any two modified files;
[0037] The similarity between any two modified files is determined according to the prefix lengths of the any two modified files and the path depths of the any two modified files.
[0038] In a second aspect, an embodiment of the present invention further provides a hypergraph construction device, the hypergraph construction device comprising:
[0039] Acquisition module, used to obtain code review data;
[0040] A determination module, configured to determine at least two target nodes according to the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information;
[0041] A construction module is used to construct a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests.
[0042] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a hypergraph construction method as described in any one of the embodiments of the present invention is implemented.
[0043] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a hypergraph construction method as described in any one of the embodiments of the present invention.
[0044] The embodiment of the present invention obtains code review data; determines at least two target nodes according to the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information; and constructs a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests. This solves the problem that ordinary graphs cannot accurately describe the complex interactive relationships in code reviews, which will result in the loss of some information, and that using ordinary graphs to describe complex review relationships will result in a large number of edges on the graph, which cannot meet the model's requirements in terms of information comprehensiveness and interpretability, and is inconvenient for subsequent research and management of review activities. The relationship between merge requests, developer information, and reviewer information can be modeled according to code review data, meeting information comprehensiveness and interpretability, and facilitating subsequent research and management of review activities. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0046] Figure 1 is a flow chart of a hypergraph construction method in an embodiment of the present invention;
[0047] Figure 1a is a schematic diagram of a hypergraph in an embodiment of the present invention;
[0048] Figure 1b is a flow chart of a hyperedge establishment method in an embodiment of the present invention;
[0049] Figure 1c is a flow chart of a method for calculating the similarity between two modified files in an embodiment of the present invention;
[0050] Figure 2 is a schematic structural diagram of a hypergraph construction device in an embodiment of the present invention;
[0051] Figure 3 is a schematic structural diagram of an electronic device in an embodiment of the present invention;
[0052] Figure 4It is a schematic diagram of the structure of a computer-readable storage medium containing a computer program in an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings. In addition, the embodiments of the present invention and the features in the embodiments may be combined with each other without conflict.
[0054] It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe various operations (or steps) as sequential processes, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to methods, functions, procedures, subroutines, subprograms, etc. In addition, the embodiments in the present invention and the features in the embodiments can be combined with each other without conflict.
[0055] The term “including” and its variations used in the present invention are open inclusions, that is, “including but not limited to.” The term “based on” means “based at least in part on.” The term “one embodiment” means “at least one embodiment.”
[0056] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0057] Figure 1 A flowchart of a hypergraph construction method provided in an embodiment of the present invention. This embodiment is applicable to the case of hypergraph construction. The method can be executed by a hypergraph construction device in an embodiment of the present invention. The device can be implemented in software and / or hardware. Figure 1 As shown, the method specifically comprises the following steps:
[0058] S110, obtaining code review data.
[0059] The code review data may be historical code review data of at least one project.
[0060] Specifically, code review data refers to a collection of several merge requests and related code review activities, which represents the informal, asynchronous, tool-based code review practice of software project code submission. A merge request includes a collection of code modification files, and a collection of related code review activities includes: developer information corresponding to the merge request, reviewer information of the merge request, and review opinions. For example, there are several historical merge requests in the project, which are set PRS. For any merge request p in the set, i ∈PRS, there is a developer a i , and some in p i The set R of reviewers who have published review comments i .
[0061] In a specific example, the code review data of the software project metaploit on the open source project platform GitHub is first read. The review data includes a collection of several code merge requests and related code review activities, which are specifically embodied in the code merge request data and review opinion data. The code merge request data and review opinion data are both in the format of TSV files.
[0062] S120, determining at least two target nodes according to the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information.
[0063] The merge request is a code merge request, which is used to merge the code into the code repository. The merge request includes: the creation time of the merge request, the creation time of the earliest created request in the request set to which the merge request belongs, and the creation time of the latest created request in the request set to which the target request belongs.
[0064] The developer information is the developer information corresponding to the merge request, and includes developer identification information and terminal address information corresponding to the developer.
[0065] Specifically, the method of determining at least two target nodes according to the code review data may be: the hypergraph node set and the hyperedge set are both empty sets in an initial situation, and the developer information, the reviewer information and the merge request constitute the target node.
[0066] In a specific example, based on all the historical code merge request information of a certain project, statistics are first performed according to the developer to obtain all developer information, then statistics are performed according to the code reviewer to obtain all code reviewer information, and then all code merge requests are obtained according to the code merge statistics. Exemplarily, 1,000 code merge requests of a certain software project are collected, as well as 50 developers and 70 code reviewers who participated in these code merge requests. Further, these code merge requests, developers, and reviewers are added to the node set of the hypergraph, for example, 1,000 nodes representing code merge requests, 50 nodes representing developer information, and 70 nodes representing code reviewer information are created, and these nodes are added to the node set of the hypergraph.
[0067] S130: construct a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests.
[0068] Among them, a hypergraph is a graph structure used to more accurately describe the relationship between objects with multiple associations.
[0069] Specifically, the method of constructing the target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests can be: construct a hyperedge according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests, and construct the target hypergraph according to the constructed hyperedge and the target node, wherein constructing a hyperedge means adding a merge request node and a reviewer information node to the new hyperedge. Calculate the weight of the hyperedge from the merge request node to the reviewer information node. Add the calculated hyperedge to the hyperedge set of the hypergraph. Due to the existence of multiple merge requests, multiple edges will be added to the hypergraph.
[0070] In a specific example, multiple merge requests are processed in sequence, with a single merge request as the processing granularity. For a merge request, there is a corresponding set of code reviewers, as well as the time when each reviewer made multiple comments when making a review. For this merge request, a hyperedge is established, and the merge request and all the reviewer information corresponding to the merge request are added to the hyperedge.
[0071] In another specific example, for a specific project corresponding to a certain code merge, the time when the earliest code merge request in this project was created and the time when the latest code merge request in this project was created can be obtained. On the basis of obtaining the time when the earliest and latest code merge request were created in the project, further, according to the time distribution of each code review date, the time when the code review opinions were published, the number of reviewers participating in the review and the corresponding number of opinions as judgment criteria, the weight of the hyperedge between the code merge request node and the reviewer information node is calculated. After calculating the weight of the hyperedge between the code merge request node and the reviewer information node, further, the hyperedge between the code merge request and the code reviewer can be added to the hyperedge set of the hypergraph.
[0072] The relationship between the merge request and the developer information indicates the creation of the merge request by the developer in a specific merge request; constructing a hyperedge means adding the merge request node and the developer node to the new hyperedge. Calculate the weight of the hyperedge between the node corresponding to the merge request and the developer information node. Add the calculated hyperedge to the hyperedge set of the hypergraph.
[0073] In this embodiment, multiple merge requests are processed in sequence according to a single code merge request as the processing granularity. For a certain merge request, there is corresponding developer information and the creation time of the merge request. For this merge request, a hyperedge is established, and the merge request and the corresponding developer information are added to the hyperedge.
[0074] For a specific project corresponding to a merge request, you can get the creation time of the earliest merge request in this project and the creation time of the latest merge request in this project. On the basis of obtaining the creation time of the earliest and latest merge requests in the project, further, based on the merge request creation date as the judgment standard, calculate the weight of the hyperedge between the merge request node and the developer information node. Add the hyperedge between the developer information and the merge request to the hyperedge set of the hypergraph.
[0075] The relationship between merge requests indicates the degree of correlation between two merge requests, which belong to the same project. Constructing a hyperedge means adding two merge request nodes to a new hyperedge. Calculate the weight of the hyperedge between the two merge request nodes. For each merge request, keep several hyperedges with the largest weights with other merge requests. Add the calculated hyperedge to the hyperedge set of the hypergraph.
[0076] Specifically, multiple merge requests are processed in sequence according to a single merge request as the processing granularity. For a certain software project, there are multiple historical merge requests. The creation time of the earliest merge request in this project and the creation time of the latest merge request in this project can be obtained. For a certain merge request, the modified file set involved in the merge request can be obtained. On the basis of obtaining all merge requests of the project and the modified file set in each merge request. Further, the weight of the hyperedge between each merge request node and other merge request nodes is calculated. The weight is calculated by the similarity between the modified file sets, the creation time of the earliest code merge request in the project, the creation time of the latest code merge request in the project, and the creation time of two paired code merge requests. Among them, the similarity between the modified file sets depends on the number of files in the two file sets and the similarity between the modified files in the sets. The similarity between the modified files represents the relationship between the same prefix length of the file paths of the two modified files and the depth of the paths in the two file paths. The similarity between the two modified files is proportional to the same prefix length of the two file paths and inversely proportional to the deepest path length in the two file paths. For example, the path of file A is "src / com / android / settings / LocationSettings.java", and the path of file B is "src / com / android / settings / Utils.java". Then, the same prefix length of the two file paths is 4, the depth of the path of file A is 5, and the depth of the path of file B is 5, then the similarity between file A and file B is 4 / 5.
[0077] Specifically, the program reads the merge request and review opinion data, and adds nodes corresponding to the merge request, developer information, and reviewer information. The program adds hyperedges in the hypergraph according to the relationship between merge requests and reviewers, the relationship between merge requests and developers, and the relationship between merge requests. Count the edges connected to each node and the weight of each hyperedge, and establish the indicator matrix H and the edge weight matrix W. For the hypergraph G = {V, E} containing a vertex set V and a hyperedge set E, the indicator matrix H and the edge weight matrix W are used in the program. The indicator matrix is used to record the relationship between nodes and hyperedges on the hypergraph, and its size is |V|×|E|. The i-th row and j-th column of the indicator matrix records the vertex v i ∈V and hyperedge e j ∈E. If the vertex v i On the side j h(v i ,e j )=1, otherwise h(v i ,e j)=0. The edge weight matrix is a diagonal matrix of size |E|×|E|, where the diagonal elements are the weights of the hyperedges.
[0078] In this embodiment, the software Gephi is used to visualize the calculated hypergraph. Figure 1a As shown in FIG. 1 , the diagram includes three different nodes: a node corresponding to the access request, a node corresponding to the developer information, and a node corresponding to the reviewer information. The modeling data of the code review can be used for subsequent research or management activities.
[0079] Optionally, after constructing the target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests, the method further includes:
[0080] Get the target merge request;
[0081] Based on the target merge request, the target hypergraph is queried to obtain target developer information and a matching degree with the target merge request and reviewer information;
[0082] The reviewer information whose matching degree is greater than the matching degree threshold is sent to the terminal corresponding to the target developer information.
[0083] The target merge request may be obtained by a user clicking a target control, or may be obtained by a user voice input, which is not limited in the embodiment of the present invention.
[0084] The matching degree threshold may be a preset threshold.
[0085] Specifically, a target merge request is obtained; based on the target merge request, the target hypergraph is queried to obtain target developer information, and the degree of match between the target merge request and the reviewer information; the reviewer information having a degree of match greater than a matching threshold is sent to a terminal corresponding to the target developer information. For example, a merge request A may be obtained, and a target hypergraph may be queried according to merge request A to obtain developer information Q corresponding to merge request A, and the degree of match between merge request A and all reviewer information; and the reviewer information having a degree of match greater than a matching threshold is sent to a terminal corresponding to the developer information Q.
[0086] Optionally, after constructing the target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests, the method further includes:
[0087] Get target developer information;
[0088] Querying the target hypergraph based on the target developer information to obtain a matching degree between the target developer information and the reviewer information;
[0089] The reviewer information whose matching degree is greater than the matching degree threshold is sent to the terminal corresponding to the target developer information.
[0090] The target developer information may be a developer ID, or other identification information that can identify a developer, which is not limited in this embodiment of the present invention.
[0091] Specifically, the target developer information is obtained; based on the target developer information, the target hypergraph is queried to obtain the matching degree between the target developer information and the reviewer information; the reviewer information whose matching degree is greater than the matching degree threshold is sent to the terminal corresponding to the target developer information. For example, the developer information P can be obtained; based on the developer information P, the target hypergraph is queried to obtain the matching degree between the developer information P and all the reviewer information; the reviewer information whose matching degree is greater than the matching degree threshold is sent to the terminal corresponding to the developer information P.
[0092] Optionally, constructing a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests includes:
[0093] Obtaining the weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests;
[0094] Normalizing the weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests;
[0095] A hypergraph is constructed according to the normalized weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests.
[0096] Among them, normalization is a processing method that maps data to a range of 0 to 1 through a certain calculation method.
[0097] Specifically, according to the weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests obtained in the previous step, different types of hyperedges are normalized respectively. Exemplarily, the weights of the hyperedges between all merge requests and the reviewer information are processed, and all weights are mapped to the range of 0 to 1 to facilitate subsequent model data processing.
[0098] In a specific example, according to the hyperedges between merge requests and reviewer information, between merge requests and developer information, and between merge requests and other merge requests obtained in the previous step, different types of hyperedges are normalized respectively. The edge e∈E in the graph is divided into three sets, namely E pr ,E pc ,E pp , normalize the weights in each set. pr For example, assuming that the corresponding weight set is W pr ={w1Kw n}. For any weight w i Do the following processing:
[0099]
[0100] Among them, w min is the weight set W pr The minimum value, W max is the weight set W pr The normalized result W′ pr ={w′1K w′ n} replace the original weights.
[0101] Optionally, obtaining the weight of the hyperedge between the merge request and the reviewer information includes:
[0102] Determining a request set based on the code review data;
[0103] Obtain the creation time corresponding to the merge request, the reviewer information set corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs;
[0104] The weight of the hyperedge between the merge request and the reviewer information is determined based on the creation time corresponding to the merge request, the reviewer information set corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs.
[0105] Among them, the request set to which the merge request belongs is the request set corresponding to the project to which the merge request belongs. For example, if the request set corresponding to project X is W, and merge request A is a merge request in request set W, then the request set to which merge request A belongs is request set W.
[0106] The creation time corresponding to the earliest created request in the request set to which the merged request belongs is the creation time corresponding to the earliest created request in the request set W.
[0107] The creation time corresponding to the latest created request in the request set to which the merged request belongs is the creation time corresponding to the latest created request in the request set W.
[0108] The reviewer information set includes: the number of reviewers, the number of review comments of each reviewer, and the release time corresponding to each review comment.
[0109] Specifically, the weight of the hyperedge between the merge request and the reviewer information can be determined according to the creation time corresponding to the merge request, the reviewer information set corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs: determining the relationship between the merge request and the reviewer information according to the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the target request belongs, the number of reviewers, the number of review opinions of each reviewer, and the publication time corresponding to each review opinion.
[0110] Optionally, the reviewer information set includes: the number of reviewers, the number of review comments of each reviewer, and the release time corresponding to each review comment;
[0111] Determining the weight of the hyperedge between the merge request and the reviewer information according to the creation time corresponding to the merge request, the reviewer information set corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs, including:
[0112] The weight of the hyperedge between the merge request and the reviewer information is determined based on the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the target request belongs, the number of reviewers, the number of review opinions of each reviewer, and the publication time corresponding to each review opinion.
[0113] Specifically, the weight of the hyperedge between the merge request and the reviewer information is determined according to the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the target request belongs, the number of reviewers, the number of review opinions of each reviewer, and the release time corresponding to each review opinion. For example, the weight of the hyperedge between the merge request and the reviewer information may be calculated. The specific calculation method is as follows:
[0114]
[0115] Among them, the merge request p i Each reviewer In p i Published in the review The kth review opinion was published on λ∈[0,1] is a hyperparameter used to adjust the impact of multiple review comments. i , t i For merge request p i Creation time; t s is the creation time of the earliest merge request in the set PRS, t e The creation time of the latest merge request in the set PRS.
[0116] Optionally, obtaining a weight of a hyperedge between the merge request and the developer information includes:
[0117] The weight of the hyperedge between the merge request and the developer information is determined according to the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs.
[0118] Specifically, the weight of the hyperedge between the merge request and the developer information is determined according to the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs. For example, the weight of the hyperedge between the merge request and the reviewer information may be calculated, and the specific calculation method is as follows:
[0119]
[0120] Among them, t i For merge request p i Creation time; for all PRSs in the entire project, t s is the creation time of the earliest merge request in the set PRS, te The creation time of the latest merge request in the set PRS.
[0121] Based on the above formula, we can get i and a i As a node, a hyperedge e with weight w pc , and add this hyperedge to the hypergraph edge set E.
[0122] Optionally, obtaining the weight of a hyperedge between any two merge requests includes:
[0123] Obtain a set of modified files corresponding to any two merge requests;
[0124] Calculate the similarity between any two modified files in each modified file set;
[0125] The weight of the hyperedge between any two merge requests is determined based on the length of the modified file set, the similarity between any two modified files in each modified file set, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the merge request belongs, and the creation time corresponding to any two merge requests.
[0126] Among them, each merge request corresponds to a set of modified files.
[0127] Specifically, the method of calculating the similarity between any two modified files in each modified file set may be: calculating the similarity between any two modified files in each modified file set. For example, if a modified file set M and a modified file set V are included, the modified file set M includes: modified file 1, modified file 2 and modified file 3, and the modified file set V includes: modified file 4, modified file 5 and modified file 6, the similarity between modified file 1 and modified file 2, the similarity between modified file 1 and modified file 3, and the similarity between modified file 2 and modified file 3 are calculated; the similarity between modified file 4 and modified file 5, the similarity between modified file 4 and modified file 6, and the similarity between modified file 5 and modified file 6 are calculated.
[0128] For example, for a merge request p i , F i For p i The set of files involved in the modification, the number of which is |F i |. For pull requests p j , F j For p j The set of files involved in the modification, the number of which is |F j |. For selecting any modified file fi ∈F i and f j ∈F j , calculate the similarity between two modified files (Similarity(f i ,f j )) to calculate the similarity between two modified files (Similarity(f i ,f j )), which is calculated as follows:
[0129]
[0130] Calculation details such as Figure 1c As shown, where LCP(f i ,f j ) is to find two file paths f i ,f j The same prefix length. Split the file path according to the path separator to obtain two string arrays. The two string arrays are compared from the beginning of the array, and the number of identical string elements is the longest prefix length. And len(f i ) function calculates the depth of the file path, that is, the number of elements in the string array obtained by splitting the file path according to the path separator.
[0131] In a specific example, Figure 1b As shown, the code merge request set that needs to be traversed is PRS, and its size is |PRS|. Initialize the hyperedge set E pp It is used to store the vertices and weight information for establishing hyperedges. The outer loop uses the variable i, and the traversal code merge request is p i The inner loop uses variable j, and the traversal code merge request is p j Each time you traverse the outer loop, initialize the candidate set In the inner loop, the calculation code is merged into the request p i and p j The similarity w ij For the establishment of triples (p i' ,p j' ,w ij ), put in If i < j, then i' = i, j' = j; if i > j, then i' = j, j' = i. After one inner loop traversal is completed, for the candidate set Sort the triplets in by weight (the third item in the triplets) from large to small to get a list For List Select the previous item a and add it to set E pp After the outer traversal is completed, according to the set Epp The first two items of the triplet are the vertices of the hyperedge, and the third item is the weight of the hyperedge.
[0132] Optionally, the similarity between any two modified files in each modified file set is calculated, including:
[0133] Get the path of each modified file in the modified file collection;
[0134] Determine the same prefix length of any two modified files and the path depth of each modified file according to the paths of any two modified files;
[0135] The similarity between any two modified files is determined according to the prefix lengths of the any two modified files and the path depths of the any two modified files.
[0136] For example, if f1 = "src / com / android / settings / LocationSettings.java", f2 = "src / com / android / settings / Utils.java". Then len(f1) = 5, len(f2) = 5, LCP(f1, f2) = length([src, com, android, settings]) = 4. LCP(f1, f2) is the same prefix length of the two modified files, len(f1) is the path depth of f1, and len(f2) is the path depth of f2.
[0137] In a specific example, first initialize the hypergraph G = {V, E}, set the node set V and the hyperedge set E to empty sets, that is:
[0138] Further, add nodes of the hypergraph. There are several historical merge requests in the project, which are merge request set PRS. For any merge request p in the merge request set i ∈PRS, there is a developer a i , and some in p i The set of reviewers who have published review comments on R i . Traverse the merged requests p in turn i ∈PRS, the node set V adds the merge request p in turn i , developer a i and the reviewer set R i The members in are nodes, that is, V←{V∪{p i}∪{a i}∪R i}.
[0139] Calculate the hyperedge weight between the merge request and the reviewer information. The specific calculation method is as follows:
[0140]
[0141] Among them, the merge request p i Each reviewer In p i Published in the review The kth review opinion was published at λ∈[0,1] is a hyperparameter used to adjust the impact of multiple review comments. i , t i For merge request p i Creation time; t s is the creation time of the earliest merge request in the set PRS, t e The creation time of the latest merge request in the set PRS.
[0142] The weight of the hyperedge measures the relevance between the merge request and the reviewer information, taking into account the participation of all reviewers in the merge request. and the number of reviews each reviewer made The more people participate, the more opinions are raised, and the more relevant it is. For each review opinion, its timeliness is also considered. and publication order (λ k-1 ), the more recent the opinion was published and the earlier it was published, the more relevant it is.
[0143] Get p i and any As a node, a hyperedge e with weight w pr , and add this hyperedge to the hypergraph edge set E.
[0144] Among them, λ∈[0,1] is used to adjust the influence of multiple review opinions. Review opinions will interact with each other. The early comments will affect the subsequent comments and have a greater influence, while the later review opinions will be relatively affected by the previous comments and have a smaller influence.
[0145] The embodiment of the present invention provides a specific method for measuring the influence of multiple review opinions, which is related to the order in which the review opinions are published. The earlier the publication time, the less influenced the review opinions are by other review opinions.
[0146] Calculate the hyperedge weight between the merge request and the reviewer information. The specific calculation method is as follows:
[0147]
[0148] Among them, t i For merge request p i Creation time; for all PRSs in the entire project, t s is the creation time of the earliest merge request in the set PRS, t e The creation time of the latest merge request in the set PRS.
[0149] Based on the above formula, we can get i and a i As a node, a hyperedge e with weight w pc , and add this hyperedge to the hypergraph edge set E.
[0150] The weight of the hyperedge measures the relevance between the merge request and the developer, taking into account the timeliness of the merge request. The newer the pull request was created (t i -t s ), the greater the correlation, the difference between the creation time of the earliest merge request and the latest merge request is considered to normalize the weight (t e -t s ).
[0151] For pull requests i , F i For p i The set of files involved in the modification, the number of which is |F i |. For pull requests p j , F j For p j The set of files involved in the modification, the number of which is |F j |. For selecting any modified file f i ∈F i and f j ∈F j , calculate the similarity between two modified files (Similarity(f i ,f j )) to calculate the similarity between two modified files (Similarity(f i ,f j )), which is calculated as follows:
[0152]
[0153] Calculation details such as Figure 1c As shown, where LCP(f i ,f j ) is to find two file paths f i ,f jThe same prefix length. Split the file path according to the path separator to obtain two string arrays. The two string arrays are compared from the beginning of the array, and the number of identical string elements is the longest prefix length. And len(f i ) function calculates the depth of the file path, that is, the number of elements in the string array obtained by splitting the file path according to the path separator.
[0154] For example, if f1 = "src / com / android / settings / LocationSettings.java", f2 = "src / com / android / settings / Utils.java", then len(f1) = 5, len(f2) = 5, LCP(f1, f2) = length([src, com, android, settings]) = 4.
[0155] For pull requests i , t i For merge request p i Creation time; for all PRSs in the entire project, t s is the creation time of the earliest merge request in the set PRS, t e is the creation time of the latest merge request in the set PRS. i ∈PRS, calculate p i and other pull requests j ∈PRS|i≠j} ij , which is calculated as:
[0156]
[0157] For pull requests i , the result set of correlation calculation is {w ij ,p j ∈PRS|i≠j}, sort them according to the weight. The larger the weight, the more important it is. Select a most important merge requests to establish a hyperedge. Set the node as merge request p i and the corresponding other pull requests p j , with weight w ij The super edge Join SuperMap.
[0158] Among them, the a most important code merge requests are selected to establish a hyperedge in order to limit the number of edges of this type in the graph. Each code merge request retains at most a and other hyperedges, and only those edges with the largest weights are selected. For example, suppose there are 100 merge request nodes in the graph. Then there are (100*100) / 2 edges connecting two of them, and there are at most 100*a edges of this type in the graph. When establishing a hyperedge between merge requests, there are only two vertices on a hyperedge. Assuming there are a total of 100 merge requests, the logic established is: traverse each merge request in turn, calculate the weight between it and the other 99 merge requests, and there are a total of 99 weight values. Select the a with the largest weight among these 99, and the two nodes that calculate the weight, and establish a edge.
[0159] The technical solution of this embodiment obtains code review data; determines at least two target nodes based on the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information; and constructs a target hypergraph based on the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests. This solves the problem that ordinary graphs cannot accurately describe the complex interactive relationships in code reviews and will lose some information. In addition, using ordinary graphs to describe complex review relationships will result in a large number of edges on the graph, which cannot meet the model's requirements in terms of information comprehensiveness and interpretability, and is not convenient for subsequent research and management of review activities. This solution can model the relationship between merge requests, developer information, and reviewer information based on code review data, meet information comprehensiveness and interpretability, and facilitate subsequent research and management of review activities.
[0160] Figure 2 This is a schematic diagram of the structure of a hypergraph construction device provided by an embodiment of the present invention. This embodiment is applicable to the case of hypergraph construction. The device can be implemented in software and / or hardware. The device can be integrated in any device that provides a hypergraph construction function, such as Figure 2 As shown, the hypergraph construction device specifically includes: an acquisition module 210, a determination module 220 and a construction module 230.
[0161] Among them, the acquisition module is used to obtain code review data;
[0162] A determination module, configured to determine at least two target nodes according to the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information;
[0163] A construction module is used to construct a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests.
[0164] The above-mentioned product can execute the method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0165] The technical solution of this embodiment obtains code review data; determines at least two target nodes based on the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information; and constructs a target hypergraph based on the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests. This solves the problem that ordinary graphs cannot accurately describe the complex interactive relationships in code reviews and will lose some information. In addition, using ordinary graphs to describe complex review relationships will result in a large number of edges on the graph, which cannot meet the model's requirements in terms of information comprehensiveness and interpretability, and is not convenient for subsequent research and management of review activities. This solution can model the relationship between merge requests, developer information, and reviewer information based on code review data, meet information comprehensiveness and interpretability, and facilitate subsequent research and management of review activities.
[0166] Figure 3 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Figure 3 A block diagram of an electronic device 312 suitable for implementing embodiments of the present invention is shown. Figure 3 The electronic device 312 shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention. The device 312 is a typical computing device for trajectory fitting functions.
[0167] like Figure 3 As shown, the electronic device 312 is in the form of a general purpose computing device. The components of the electronic device 312 may include, but are not limited to: one or more processors 316, a storage device 328, and a bus 318 connecting different system components (including the storage device 328 and the processor 316).
[0168] Bus 318 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0169] The electronic device 312 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 312, including volatile and non-volatile media, removable and non-removable media.
[0170] The storage device 328 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 330 and / or cache memory 332. The electronic device 312 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 334 may be used to read and write non-removable, non-volatile magnetic media ( Figure 3 not shown, usually called a "hard drive"). Although Figure 3 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a read-only optical disk (Compact Disc-Read Only Memory, CD-ROM), a digital video disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical media) may be provided. In these cases, each drive may be connected to the bus 318 via one or more data medium interfaces. The storage device 328 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0171] A program 336 having a set (at least one) of program modules 326 may be stored, for example, in a storage device 328, such program modules 326 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 326 generally perform the functions and / or methods of the embodiments described herein.
[0172] The electronic device 312 may also communicate with one or more external devices 314 (e.g., keyboard, pointing device, camera, display 324, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 312, and / or communicate with any device that enables the electronic device 312 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 322. In addition, the electronic device 312 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through a network adapter 320. As shown, the network adapter 320 communicates with other modules of the electronic device 312 through a bus 318. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 312, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) systems, tape drives, and data backup storage systems.
[0173] The processor 316 executes various functional applications and data processing by running the programs stored in the storage device 328, for example, implementing the hypergraph construction method provided in the above embodiment of the present invention:
[0174] Get code review data;
[0175] Determine at least two target nodes according to the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information;
[0176] A target hypergraph is constructed according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests.
[0177] Figure 4Schematic diagram of the structure of a computer-readable storage medium containing a computer program in an embodiment of the present invention. The embodiment of the present invention provides a computer-readable storage medium 61 on which a computer program 610 is stored. When the program is executed by one or more processors, the hypergraph construction method provided in all the inventive embodiments of the present application is implemented:
[0178] Get code review data;
[0179] Determine at least two target nodes according to the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information;
[0180] A target hypergraph is constructed according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests.
[0181] Any combination of one or more computer-readable media can be used. Computer-readable media can be computer-readable signal media or computer-readable storage media or any combination of the above two. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.
[0182] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0183] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0184] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0185] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0186] Computer program code for performing the operation of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0187] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0188] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0189] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0190] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0191] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A hypergraph construction method, characterized in that: include: Get code review data; Determine at least two target nodes according to the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information; constructing a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests; Constructing a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests, including: Obtaining the weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests; Normalizing the weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests; Constructing a hypergraph according to the normalized weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests; Obtaining the weight of the hyperedge between the merge request and the reviewer information, including: The weight of the hyperedge between the merge request and the reviewer information is determined according to the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the merge request belongs, the number of reviewers, the number of review comments of each reviewer, the release time corresponding to each review comment, and a first formula, wherein the first formula is: ; Among them, merge request Each reviewer exist Published in the review Review opinion, No. The corresponding release time of the review opinions is , is a hyperparameter for merge requests. , Pull request The creation time, Pull request The creation time of the earliest request in the request set. Pull request The creation time of the latest request in the request set. For reviewers, Pull request and reviewers The weight of the hyperedge between them; Obtaining the weight of the hyperedge between any two merge requests, including: Obtain a set of modified files corresponding to any two merge requests; Get the path of each modified file in the modified file collection; Determine the same prefix length of any two modified files and the path depth of each modified file according to the paths of any two modified files; Determine the similarity between any two modified files according to the prefix lengths of the any two modified files and the path depths of the any two modified files; The weight of the hyperedge between any two merge requests is determined based on the length of the modified file set, the similarity between any two modified files in each modified file set, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the merge request belongs, and the creation time corresponding to any two merge requests.
2. The method according to claim 1, characterized in that After constructing a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests, the method further includes: Get the target merge request; Based on the target merge request, the target hypergraph is queried to obtain target developer information and a matching degree with the target merge request and reviewer information; The reviewer information whose matching degree is greater than the matching degree threshold is sent to the terminal corresponding to the target developer information.
3. The method according to claim 1, characterized in that After constructing a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests, the method further includes: Get target developer information; Querying the target hypergraph based on the target developer information to obtain a matching degree between the target developer information and the reviewer information; The reviewer information whose matching degree is greater than the matching degree threshold is sent to the terminal corresponding to the target developer information.
4. The method according to claim 1, characterized in that: Obtaining the weight of the hyperedge between the merge request and the developer information includes: The weight of the hyperedge between the merge request and the developer information is determined according to the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, and the creation time corresponding to the latest created request in the request set to which the merge request belongs.
5. A hypergraph construction device, characterized in that: include: Acquisition module, used to obtain code review data; A determination module, configured to determine at least two target nodes according to the code review data, wherein the target nodes include: a merge request, developer information, and reviewer information; A construction module, configured to construct a target hypergraph according to the relationship between the merge request and the reviewer information, the relationship between the merge request and the developer information, and the relationship between any two merge requests; The building blocks are specifically used to: Obtaining the weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests; Normalizing the weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests; Constructing a hypergraph according to the normalized weight of the hyperedge between the merge request and the reviewer information, the weight of the hyperedge between the merge request and the developer information, and the weight of the hyperedge between any two merge requests; Building blocks are also used to: The weight of the hyperedge between the merge request and the reviewer information is determined according to the creation time corresponding to the merge request, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the merge request belongs, the number of reviewers, the number of review comments of each reviewer, the release time corresponding to each review comment, and a first formula, wherein the first formula is: ; Among them, merge request Each reviewer exist Published in the review Review opinion, No. The corresponding release time of the review opinions is , is a hyperparameter for merge requests. , Pull request The creation time, Pull request The creation time of the earliest request in the request set. Pull request The creation time of the latest request in the request set. For reviewers, Pull request and reviewers The weight of the hyperedge between ; Building blocks are also used to: Obtain a set of modified files corresponding to any two merge requests; Get the path of each modified file in the modified file collection; Determine the same prefix length of any two modified files and the path depth of each modified file according to the paths of any two modified files; Determine the similarity between any two modified files according to the prefix lengths of the any two modified files and the path depths of the any two modified files; The weight of the hyperedge between any two merge requests is determined based on the length of the modified file set, the similarity between any two modified files in each modified file set, the creation time corresponding to the earliest created request in the request set to which the merge request belongs, the creation time corresponding to the latest created request in the request set to which the merge request belongs, and the creation time corresponding to any two merge requests.
6. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the processors are enabled to implement the method according to any one of claims 1 to 4.
7. A computer-readable storage medium containing a computer program, wherein the computer program is stored thereon, characterized in that: When the program is executed by one or more processors, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Code review method and system, computing equipment and storage medium
CN112860565A
Abnormal transaction prediction method and device based on hypergraph, equipment and storage medium
CN113822757A
