Method and device for determining recommended reviewer in code review
By decomposing the code to be reviewed in code review into subtext and recommending reviewers based on the number and activity of writers, the problem of reviewers' choice dependence practice in the existing technology is solved, and the quality of code review is improved.
Patent Information
- Application Number
- CN202510218889.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-06-06
AI Technical Summary
In the prior art, the method of selecting reviewers during code review depends mostly on practice or personal closeness, resulting in lower review quality because reviewers may not be familiar with the code.
By obtaining the target text of the code to be reviewed, decompose it into initial subtext, and determining the target subtext and the specified subtext based on the number and activity of the code writers, the most matching reviewer is recommended.
Improve the quality of code reviews and ensure that the recommended reviewers are more familiar with the review code, thereby discovering logical errors, potential vulnerabilities and other problems.
Smart Images

Figure CN120106491A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of recommended reviewers, and in particular to a method and device for determining recommended reviewers in code review. Background Art
[0002] Code review refers to the process of systematically checking the code by the development team. Code review is quite common in daily development work and is of great significance. During code review, team members can use different perspectives and experiences to identify logical errors, potential vulnerabilities, improper boundary condition handling and other problems in the code, and avoid many errors before retesting through cross-review. In the code review process, choosing the right reviewer is crucial to improving code quality and accelerating project progress. In the existing technology, developers choose which reviewer to use based on convention or personal relationship. Reviewers selected in this way may not be very familiar with the code but participate in the writing of the code throughout the process, resulting in lower quality of code review. Summary of the invention
[0003] In view of the above technical problems, the technical solution adopted by the present invention is: According to a first aspect of the present application, a method for determining a recommended reviewer in a code review is provided, the method comprising the following steps: S100, obtaining a target text corresponding to the code to be reviewed; wherein the target text includes a number of lines, each line corresponding to a line number, a code writer, and a code; S200, obtaining each initial subtext corresponding to the target text to obtain an initial subtext list A=(A 1 , A 2 , …, A i , …, A n ), i=1, 2,...,n; among them, A i is the i-th initial subtext corresponding to the target text, n is the number of initial subtexts corresponding to the target text; each initial subtext corresponds to a method code; S300, traverse A, if A i If the number of corresponding code writers is greater than 1, then A i Determine as the target subtext; otherwise, i Determine the specified subtext; to obtain the target subtext list B = (B 1 , B 2 , …, B j , …, B m ), j = 1, 2, ..., m and specify the subtext list C = (C 1 , C 2 , …, C p , …, C q), p = 1, 2, …, q; where B j is the jth target subtext determined, m is the number of target subtexts determined; C p is the pth designated subtext determined, and q is the number of designated subtexts determined; S400, get B j Each corresponding code writer, to obtain B j List of corresponding code writers D j =(D j,1 , D j,2 , …, D j,x , …, D j,y ), x=1, 2, …, y; where D j,x For B j The corresponding xth code writer, y is B j The number of people who wrote the corresponding code; S500, if y=2 and the code writer corresponding to each specified subtext in C is j If one of the code writers in is the same, the code writer corresponding to each specified sub-text in C is determined as the recommended reviewer.
[0004] Further, after step S500, the method includes the following steps: S600, if D j If one of the code writers only wrote one line of code, the code writers who only wrote one line of code will be filtered out; S610, according to D j The recommended reviewers are determined based on the number of lines of code written and the time spent by other code writers.
[0005] Further, step S610 includes the following steps: S611, get D j Each initial coder except the coder who wrote only one line of code in D j Corresponding initial code writer list RD j =(RD j,1 , R.D. j,2 , …, RD j,a , …, RD j,b ), a=1, 2, …, b; where RD j,a D j The ath initial code writer in the code, b is D j The number of initial code writers in the S612, according to RD j The time and number of lines written by each initial code writer determine the RD jThe weight of each initial code writer in , to get RD j The corresponding weight list η j =(η j,1 , η j,2 ,…,η j,a ,…,η j,b ); where η j,a For RD j,a The corresponding weights; S613, η j The initial code writer corresponding to the maximum weight in is determined as the recommended reviewer.
[0006] Furthermore, η j,a Obtained through the following steps: S61, Get RD j,a Time to write code T j,a and the number of lines of code written NUM j,a ; S62, according to T j,a 、NUM j,a and the current time T now , determine η j,a =-α 1 ×(T now -T j,a ) / T'+α 2 ×NUM j,a / NUM'; where T' is the preset time, and NUM' is the total number of lines of code to be reviewed; α 1 is the first preset weight, α 2 is the second preset weight; α 1 +α 2 =1.
[0007] Furthermore, after step S500, the method further includes the following steps: S700, if the target subtext does not exist, and C p For a code writer who is different from the code writer corresponding to other specified text in C, an abstract syntax tree is constructed based on the code to be reviewed; S710, calculating the calling relationship between the method codes according to the abstract syntax tree, and calling C p The code writer of the upstream code of the corresponding method code is determined as the recommended reviewer.
[0008] According to another aspect of the present application, a device for determining a recommended reviewer in a code review is also provided, the device comprising: The target text acquisition module is used to acquire the target text corresponding to the code to be reviewed; wherein the target text includes a number of lines, each line corresponding to a line number, a code writer and a code; The initial subtext acquisition module is used to acquire each initial subtext corresponding to the target text to obtain an initial subtext list A=(A 1 , A 2 , …, A i , …, A n ), i=1, 2,...,n; among them, A i is the i-th initial subtext corresponding to the target text, n is the number of initial subtexts corresponding to the target text; each initial subtext corresponds to a method code; The target subtext determination module is used to traverse A. If A i If the number of corresponding code writers is greater than 1, then A i Determine as the target subtext; otherwise, i Determine the specified subtext; to obtain the target subtext list B = (B 1 , B 2 , …, B j , …, B m ), j = 1, 2, ..., m and specify the subtext list C = (C 1 , C 2 , …, C p , …, C q ), p = 1, 2, …, q; where B j is the jth target subtext determined, m is the number of target subtexts determined; C p is the pth designated subtext determined, and q is the number of designated subtexts determined; Code writer obtains module, used to obtain B j Each corresponding code writer, to obtain B j List of corresponding code writers D j =(D j,1 , D j,2 , …, D j,x , …, D j,y ), x=1, 2, …, y; where D j,x For B j The corresponding xth code writer, y is B j The number of people who wrote the corresponding code; Recommended reviewer determination module, used if y=2 and the code writer corresponding to each specified subtext in C is the same as D j If one of the code writers in is the same, the code writer corresponding to each specified sub-text in C is determined as the recommended reviewer.
[0009] The present invention has at least the following beneficial effects: The method for determining recommended reviewers in code review of the present invention comprises the following steps: obtaining a target text corresponding to the code to be reviewed; obtaining each initial subtext corresponding to the target text to obtain an initial subtext list; in the initial subtext list, if the number of code writers corresponding to the initial subtext is greater than 1, determining the initial subtext as the target subtext; otherwise, determining it as a designated subtext; and then determining recommended reviewers based on the target subtext and the code writers corresponding to the designated subtext; when developers modify the code, the area closest to the modification will have the greatest impact, identifying the scope of the modification, scanning the context, statistically submitting information, building a call relationship, etc., and obtaining the person who is most familiar with the scope of the modification as the reviewer, so that the determined recommended reviewers are more closely matched with the code to be reviewed, thereby improving the quality of code review. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0012] Figure 1 A flowchart of a method for determining a recommended reviewer in a code review provided by an embodiment of the present invention; Figure 2 A schematic diagram of code text provided for an embodiment of the present invention; Figure 3 A schematic diagram of a boundary recognition method provided by an embodiment of the present invention; Figure 4 A schematic diagram of a parsing code provided by an embodiment of the present invention; Figure 5 A schematic diagram of a printing result provided by an embodiment of the present invention; Figure 6 A schematic diagram of code modification provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0013] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0014] It should be noted that, based on the present disclosure, those skilled in the art should understand that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects described herein can be used to implement a device and / or practice a method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this device and / or practice this method.
[0015] The following will refer to Figure 1 The flowchart of the method for determining recommended reviewers in code review shown in the figure introduces a method for determining recommended reviewers in code review.
[0016] The method for determining the recommended reviewer in the code review may include the following steps: S100, obtaining a target text corresponding to the code to be reviewed; wherein the target text includes a plurality of lines, each line corresponding to a line number, a code writer and a code.
[0017] In this embodiment, the code to be reviewed is in the form of text, such as Figure 2 As shown, xiaohei initially wrote two methods, chooseItem and getItemName, as the first submission; they can obtain the target text corresponding to the code to be reviewed.
[0018] S200, obtaining each initial subtext corresponding to the target text to obtain an initial subtext list A=(A 1 , A 2 , …, A i , …, A n ), i=1, 2,...,n; among them, A i is the i-th initial subtext corresponding to the target text, n is the number of initial subtexts corresponding to the target text; each initial subtext corresponds to a method code.
[0019] In this embodiment, the code to be reviewed includes several method codes, such as Figure 2 As shown, chooseItem and getItemName are two method codes, each corresponding to an initial subtext; by constructing an abstract syntax tree and parsing the offset and text content in the abstract syntax tree, the start and end of each method can be obtained.
[0020] like Figure 3 As shown in the figure, it is a Java code developed and written. It is necessary to parse out the start and end of the two methods setName and getName. The parsing code is as follows Figure 4 As shown, Figure 5 From the printed results shown, we can see that the two method starts and technical line numbers are as expected.
[0021] S300, traverse A, if A i If the number of corresponding code writers is greater than 1, then A i Determine as the target subtext; otherwise, i Determine the specified subtext; to obtain the target subtext list B = (B 1 , B 2 , …, B j , …, B m ), j = 1, 2, ..., m and specify the subtext list C = (C 1 , C 2 , …, C p , …, C q ), p = 1, 2, …, q; where B j is the jth target subtext determined, m is the number of target subtexts determined; C p is the pth designated subtext determined, and q is the number of designated subtexts determined.
[0022] In this embodiment, Figure 6 As shown in the figure, after chooseItem and getItemName were launched, Xiaobai pulled a requirement branch due to a certain requirement and changed the getItemName method code, resulting in two people writing the getItemName method code.
[0023] S400, get B j Each corresponding code writer, to obtain B j List of corresponding code writers D j =(D j,1 , D j,2 , …, D j,x , …, D j,y ), x=1, 2, …, y; where D j,x For B j The corresponding xth code writer, y is B j The number of people who wrote the corresponding code.
[0024] In this embodiment, when there is more than one code writer corresponding to a method code, it means that the method code may have been modified, and B j Each corresponding code writer, to obtain B j List of corresponding code writers D j .
[0025] S500, if y=2 and the code writer corresponding to each specified subtext in C is jIf one of the code writers in is the same, the code writer corresponding to each specified sub-text in C is determined as the recommended reviewer.
[0026] In the above example, the code was written by xiaobai, the modification range is 68-71, and the method getItemName is modified; by scanning the modified file, you can get the line number range of each method in the file and the submitter of each line.
[0027] For the chooseItem method, the range of rows is 53-60; for the getItemName method, the range of rows is 63-74.
[0028] Scan up and down within the range of modified lines to find people who are inconsistent with the current modifier, until the upper and lower boundary lines of the affected methods are scanned. It should be noted that it is not possible to scan up and down indefinitely. Methods may have no connection with each other. If the scanning range exceeds the upper and lower bounds of the methods, the selected reviewers may be completely unfamiliar with the modified content. The method context boundary can be obtained by constructing an abstract tree to obtain the start and end time of each method.
[0029] In the above example, the scanning range is from line 68 to line 63 forward and from line 71 to line 74 backward, and xiaohei can be scanned. Xiaohei can be recommended as a reviewer.
[0030] Further, after step S500, the method includes the following steps: S600, if D j If one of the code writers in the , code writers who wrote only one line of code are filtered out.
[0031] S610, according to D j The recommended reviewers are determined based on the number of lines of code written and the time spent by other code writers.
[0032] In this embodiment, if a developer only adds a new line of log to locate the problem, although he is the person closest to the current modification, he may not be the most suitable person; therefore, it is necessary to filter out the code writer who only wrote one line of code to improve the accuracy of the recommended reviewer.
[0033] Further, step S610 includes the following steps: S611, get D j Each initial coder except the coder who wrote only one line of code in D j Corresponding initial code writer list RD j =(RD j,1 , R.D. j,2 , …, RD j,a, …, RD j,b ), a=1, 2, …, b; where RD j,a D j The ath initial code writer in the j The number of people who wrote the initial code.
[0034] S612, according to RD j The time and number of lines written by each initial code writer determine the RD j The weight of each initial code writer in , to get RD j The corresponding weight list η j =(η j,1 , η j,2 ,…,η j,a ,…,η j,b ); where η j,a For RD j,a The corresponding weight.
[0035] S613, η j The initial code writer corresponding to the maximum weight in is determined as the recommended reviewer.
[0036] In this embodiment, a method code may have multiple code writers. In this case, the weight of each initial code writer is determined according to the time and number of lines of code written by each initial code writer, and then the recommended reviewer is determined.
[0037] Furthermore, η j,a Obtained through the following steps: S61, Get RD j,a Time to write code T j,a and the number of lines of code written NUM j,a .
[0038] S62, according to T j,a 、NUM j,a and the current time T now , determine η j,a =-α 1 ×(T now -T j,a ) / T'+α 2 ×NUM j,a / NUM'; where T' is the preset time, and NUM' is the total number of lines of code to be reviewed; α 1 is the first preset weight, α 2 is the second preset weight; α 1 +α 2 =1.
[0039] In this embodiment, according to η j,aThe corresponding formula shows that the more lines of code a code writer writes and the more recently the code writer writes, the greater the corresponding weight of the code writer, which is in line with the determination logic of recommending reviewers; α 1 and α 2 It can be set according to actual needs or obtained based on a large amount of data statistics.
[0040] Furthermore, after step S500, the method further includes the following steps: S700, if the target subtext does not exist, and C p For a code writer who is different from the code writer corresponding to other specified text in C, an abstract syntax tree is constructed based on the code to be reviewed.
[0041] S710, calculating the calling relationship between the method codes according to the abstract syntax tree, and calling C p The code writer of the upstream code of the corresponding method code is determined as the recommended reviewer.
[0042] In this embodiment, assuming that xiaobai modifies the entire method or adds a new method, causing the above scanning method to be unable to find a person who is inconsistent with the current modifier, the system will build an abstract syntax tree based on the source code, calculate the calling relationship between methods, and find the code where the upstream caller is located. The person who submits the caller code will be recommended as a reviewer.
[0043] When developers modify code, they will focus on the areas closest to the modification, which will have the greatest impact. By identifying the scope of the modification, scanning the context, counting submission information, building call relationships, and other means, the person who is most familiar with the scope of the modification can be selected as the reviewer, which will ensure a certain degree of review effectiveness.
[0044] In this embodiment, the target text corresponding to the code to be reviewed is obtained; each initial sub-text corresponding to the target text is obtained to obtain an initial sub-text list; in the initial sub-text list, if the number of code writers corresponding to the initial sub-text is greater than 1, the initial sub-text is determined as the target sub-text; otherwise, it is determined as a designated sub-text; and then the recommended reviewers are determined based on the target sub-text and the code writers corresponding to the designated sub-text; when developers modify the code, the area closest to the modification will have the greatest impact, the scope of the modification is identified, the context is scanned, statistical method submission information, call relationship construction and other means are used to obtain the person who is most familiar with the scope of the modification as the reviewer, so that the determined recommended reviewers are more closely matched to the code to be reviewed, thereby improving the quality of code review.
[0045] In an exemplary embodiment, a device for determining a recommended reviewer in a code review is also provided, the device comprising: The target text acquisition module is used to obtain the target text corresponding to the code to be reviewed; wherein the target text includes a number of lines, each line corresponding to a line number, a code writer and a code.
[0046] The initial subtext acquisition module is used to acquire each initial subtext corresponding to the target text to obtain an initial subtext list A=(A 1 , A 2 , …, A i , …, A n ), i=1, 2,...,n; among them, A i is the i-th initial subtext corresponding to the target text, n is the number of initial subtexts corresponding to the target text; each initial subtext corresponds to a method code.
[0047] The target subtext determination module is used to traverse A. If A i If the number of corresponding code writers is greater than 1, then A i Determine as the target subtext; otherwise, i Determine the specified subtext; to obtain the target subtext list B = (B 1 , B 2 , …, B j , …, B m ), j = 1, 2, ..., m and specify the subtext list C = (C 1 , C 2 , …, C p , …, C q ), p = 1, 2, …, q; where B j is the jth target subtext determined, m is the number of target subtexts determined; C p is the pth designated subtext determined, and q is the number of designated subtexts determined.
[0048] Code writer obtains module, used to obtain B j Each corresponding code writer, to obtain B j List of corresponding code writers D j =(D j,1 , D j,2 , …, D j,x , …, D j,y ), x=1, 2, …, y; where D j,x For B j The corresponding xth code writer, y is B j The number of people who wrote the corresponding code.
[0049] Recommended reviewer determination module, used if y=2 and the code writer corresponding to each specified subtext in C is the same as D jIf one of the code writers in is the same, the code writer corresponding to each specified sub-text in C is determined as the recommended reviewer.
[0050] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0051] An embodiment of the present invention also provides a non-transitory computer-readable storage medium, which can be set in an electronic device to store at least one instruction or at least one program related to implementing a method in a method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiment.
[0052] The program product may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable 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 above.
[0053] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. 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. Readable signal media may also be any readable medium other than a 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.
[0054] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0055] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0056] An embodiment of the present invention further provides an electronic device, comprising a processor and the aforementioned non-transitory computer-readable storage medium.
[0057] The electronic device is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0058] The electronic device is presented in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: the at least one processor mentioned above, the at least one memory mentioned above, and a bus connecting different system components (including the memory and the processor).
[0059] The memory stores program codes, which can be executed by the processor, so that the processor executes the steps in various embodiments described in this specification.
[0060] The memory may include readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory, and may further include read only memory (ROM).
[0061] The memory may also include a program / utility having a set (at least one) of program modules, such program modules 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.
[0062] The bus may represent 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.
[0063] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device, and / or may communicate with any device (e.g., routers, modems, etc.) that enables the electronic device to communicate with one or more other computing devices. Such communication may be performed through an input / output (I / O) interface. Furthermore, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the electronic device through a bus. 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, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0064] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0065] An embodiment of the present invention further provides a computer program product, which includes program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the method according to various exemplary embodiments of the present invention described above in this specification.
[0066] Although some specific embodiments of the present invention have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are only for illustration, not for limiting the scope of the present invention. It should also be understood by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention.
Claims
1. A method for determining a recommended reviewer in a code review, characterized in that: The method comprises the following steps: S100, obtaining a target text corresponding to the code to be reviewed; wherein the target text includes a number of lines, each line corresponding to a line number, a code writer, and a code; S200, obtaining each initial subtext corresponding to the target text to obtain an initial subtext list A=(A1, A2, ..., A i , …, A n ), i=1, 2,...,n; among them, A i is the i-th initial subtext corresponding to the target text, n is the number of initial subtexts corresponding to the target text; each initial subtext corresponds to a method code; S300, traverse A, if A i If the number of corresponding code writers is greater than 1, then A i Determine as the target subtext; otherwise, i Determine the specified subtext; to obtain the target subtext list B = (B1, B2, ..., B j , …, B m ), j = 1, 2, ..., m and specify the subtext list C = (C1, C2, ..., C p , …, C q ), p = 1, 2, …, q; where B j is the jth target subtext determined, m is the number of target subtexts determined; C p is the pth designated subtext determined, and q is the number of designated subtexts determined; S400, get B j Each corresponding code writer, to obtain B j List of corresponding code writers D j =(D j,1 , D j,2 , …, D j,x , …, D j,y ), x=1, 2, …, y; where D j,x For B j The corresponding xth code writer, y is B j The number of people who wrote the corresponding code; S500, if y=2 and the code writer corresponding to each specified subtext in C is j If one of the code writers in is the same, the code writer corresponding to each specified sub-text in C is determined as the recommended reviewer.
2. The method for determining recommended reviewers in code review according to claim 1, characterized in that: After step S500, the method comprises the following steps: S600, if D j If one of the code writers only wrote one line of code, the code writers who only wrote one line of code will be filtered out; S610, according to D j The recommended reviewers are determined based on the number of lines of code written and the time spent by other code writers.
3. The method for determining recommended reviewers in code review according to claim 2, characterized in that: Step S610 includes the following steps: S611, get D j Each initial coder except the coder who wrote only one line of code in D j Corresponding initial code writer list RD j =(RD j,1 , R.D. j,2 , …, RD j,a , …, RD j,b ), a=1, 2, …, b; where RD j,a D j The ath initial code writer in the code, b is D j The number of initial code writers in the S612, according to RD j The time and number of lines written by each initial code writer determine the RD j The weight of each initial code writer in , to get RD j The corresponding weight list η j =(η j,1 , η j,2 ,…,η j,a ,…,η j,b ); where η j,a For RD j,a The corresponding weights; S613, η j The initial code writer corresponding to the maximum weight in is determined as the recommended reviewer.
4. The method for determining recommended reviewers in code review according to claim 3, characterized in that: η j,a Obtained through the following steps: S61, Get RD j,a Time to write code T j,a and the number of lines of code written NUM j,a ; S62, according to T j,a 、NUM j,a and the current time T now , determine η j,a = -α1×(T now -T j,a ) / T'+α2×NUM j,a / NUM'; where T' is the preset time, NUM' is the total number of lines of code to be reviewed; α1 is the first preset weight, α2 is the second preset weight; α1+α2=1.
5. The method for determining recommended reviewers in code review according to claim 1, characterized in that: After step S500, the method further comprises the following steps: S700, if the target subtext does not exist, and C p For a code writer who is different from the code writer corresponding to other specified text in C, an abstract syntax tree is constructed based on the code to be reviewed; S710, calculating the calling relationship between the method codes according to the abstract syntax tree, and calling C p The code writer of the upstream code of the corresponding method code is determined as the recommended reviewer.
6. A device for determining a recommended reviewer in a code review, characterized in that: The device comprises: The target text acquisition module is used to acquire the target text corresponding to the code to be reviewed; wherein the target text includes a number of lines, each line corresponding to a line number, a code writer and a code; The initial subtext acquisition module is used to acquire each initial subtext corresponding to the target text to obtain an initial subtext list A = (A1, A2, ..., A i , …, A n ), i=1, 2,...,n; among them, A i is the i-th initial subtext corresponding to the target text, n is the number of initial subtexts corresponding to the target text; each initial subtext corresponds to a method code; The target subtext determination module is used to traverse A. If A i If the number of corresponding code writers is greater than 1, then A i Determine as the target subtext; otherwise, i Determine the specified subtext; to obtain the target subtext list B = (B1, B2, ..., B j , …, B m ), j = 1, 2, ..., m and specify the subtext list C = (C1, C2, ..., C p , …, C q ), p = 1, 2, …, q; where B j is the jth target subtext determined, m is the number of target subtexts determined; C p is the pth designated subtext determined, and q is the number of designated subtexts determined; Code writer obtains module, used to obtain B j Each corresponding code writer, to obtain B j List of corresponding code writers D j =(D j,1 , D j,2 , …, D j,x , …, D j,y ), x=1, 2, …, y; where D j,x For B j The corresponding xth code writer, y is B j The number of people who wrote the corresponding code; Recommended reviewer determination module, used if y=2 and the code writer corresponding to each specified subtext in C is the same as D j If one of the code writers in is the same, the code writer corresponding to each specified sub-text in C is determined as the recommended reviewer.