Visual code review method and system
By using annotation identifiers in code review, the problem of unintuitive code changes is solved, and the review efficiency and intuitiveness is improved.
Patent Information
- Application Number
- CN202411627026.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-04
AI Technical Summary
During the code review process, the changes in the code to be reviewed are not intuitive, which leads to the reviewer needing to continuously scroll the mouse to view and review, reducing the review efficiency.
By adding annotation identifiers to the business code and converting the business code into multiple visual nodes, the reviewer can read the code in segments by clicking on the visual node and understand the changes in the code through the node identifier.
It improves the review efficiency of the review staff, makes the review process more intuitive and efficient, and reduces the need for scrolling viewing of the entire code.
Smart Images

Figure CN119556933A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a visual code review method and system. Background Art
[0002] With the popularity of agile development and DevOps culture, code review has become a standard process for many software development teams. At present, during the code review process, the code to be reviewed will be displayed directly in its entirety. Although the code changes will be marked accordingly, the code changes are not intuitive, and the reviewers need to scroll the mouse constantly to view and review, which reduces the review efficiency of the reviewers. Secondly, during the code review process, the feedback between developers and reviewers is slow, which may cause the developers to be unable to carry out subsequent work while waiting for feedback, thus affecting the overall development progress.
[0003] CN202310143054 discloses a code review method and device, storage medium, and computer equipment, including: displaying the code to be reviewed, and determining the problem code based on the selection operation of the code to be reviewed; in response to the review and editing instruction of the problem code, popping up the code editing box corresponding to the problem code; parsing the problem code information corresponding to the problem code, and filling the problem code information in the first editing option of the code editing box; obtaining the supplementary information filled in the second editing option of the code editing box, and generating a code review record based on the supplementary information and the problem code information. The code review method improves the code review efficiency by establishing a code review record, and avoids the situation where the problem code is omitted. However, the reviewer still needs to read the code in its entirety. When the number of codes is large, the code display is not intuitive enough, and the reviewer needs to scroll the code continuously, which may affect the reviewer's review efficiency.
[0004] The technical problem to be solved by the present invention is: how to improve the review efficiency of reviewers. Summary of the invention
[0005] The main purpose of the present invention is to provide a visual code review method, which converts the business code into multiple visual nodes according to the business steps of the business code. The reviewer can read the business code in sections by clicking on the visual nodes. Moreover, the visual nodes are provided with node identifiers. The reviewer can clearly understand which steps of the business code have been modified or which steps have been newly added through the node identifiers, thereby improving the review efficiency of the reviewer.
[0006] At the same time, a visual code review system is also provided.
[0007] To achieve the above objectives, the technical solutions adopted in this application are:
[0008] A visual code review method includes the following steps:
[0009] Step 1: Receive a service code; the service code is provided with an annotation mark; the annotation mark includes a service code, a service step name, a service step sequence and remarks;
[0010] Step 2: Parse the annotation identifier and decompose the business code into multiple hierarchically distributed visualization nodes; compare with the historical version of the business code, and set a node identifier for displaying the status of each visualization node for multiple visualization nodes; the node identifier includes changed, unchanged, and newly added;
[0011] Step 3: Select reviewers to review the business code through visual nodes.
[0012] Preferably, the method further includes step 4: sending the business code review results to the developers and scoring the professionalism of the reviewers.
[0013] Preferably, the specific operation of selecting reviewers in step 3 is: deriving a comprehensive score based on the reviewers' professional scores and business matching scores and corresponding weights; selecting the top 3 reviewers in terms of comprehensive scores; the professional score is the reviewer's initial score; and the business matching score is the average of the developers' scores on the reviewers.
[0014] Preferably, the weight of the professional score is 0.4; the weight of the business matching score is 0.6.
[0015] Preferably, the step 2 further comprises: when the node is marked as changed, the changed content of the business code in the visualization node is displayed in a highlighted or other color manner.
[0016] Preferably, the visualization node displays the corresponding business code in the form of a pop-up window after clicking the visualization node.
[0017] Preferably, the window is provided with a comparison option and an annotation option; the reviewer views the business code before the change by clicking the comparison option; the reviewer fills in the review suggestions for the business code in the visualization node by clicking the annotation option.
[0018] At the same time, a visual code review system is also disclosed, including the following units:
[0019] Receiving unit: used for receiving a service code; the service code is provided with an annotation mark; the annotation mark includes a service code, a service step name, a service step sequence and remarks;
[0020] Display unit: used to parse annotation identifiers, decompose the business code into multiple hierarchically distributed visualization nodes; compare with the historical version of the business code, and set node identifiers for multiple visualization nodes to display the status of each visualization node; the node identifiers include changed, unchanged, and newly added;
[0021] Review unit: used to select reviewers and review business codes through visual nodes;
[0022] The receiving unit, the display unit and the review unit are communicatively connected in sequence.
[0023] Preferably, it also includes a scoring unit, which is used to send the business code review results to the developers and score the professionalism of the reviewers.
[0024] Compared with the prior art, this solution has the following beneficial effects:
[0025] The visual code review method of this scheme converts the business code into multiple visual nodes according to the annotation identifier. The multiple visual nodes respectively contain the corresponding code of each business step in the business code. The reviewer views the business code of the corresponding step by clicking the visual node. The visual node is provided with a node identifier. The reviewer can clearly understand whether the business code segment has been modified (changed), added or unchanged according to the node identifier. At the same time, it is also convenient for the reviewer to read the context of the code change and understand the code.
[0026] The code structure and logic are displayed through a visual interface, and complex code systems are broken down into multiple modules (multiple visual nodes) for review, so that reviewers can more quickly understand the overall framework and details of the code. The hierarchical structure is displayed to help reviewers better understand the dependencies and interaction logic between codes.
[0027] The modular and hierarchical code structure makes the code easier to understand and maintain, reducing the difficulty of subsequent modification and expansion. The visual code review process itself is also a documented process, which helps subsequent developers better understand and maintain the code. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a flowchart of the visual code review method of Example 1;
[0029] Figure 2 A schematic diagram of the annotation mark of Example 1;
[0030] Figure 3 is a schematic diagram of a visualization node of Example 1;
[0031] Figure 4This is a flowchart of the visual code review system of Example 2. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. The components of the present application implemented as described and shown in the drawings here can be arranged and designed in various different configurations.
[0033] Example 1
[0034] refer to Figure 1-3 , a visual code review method, comprising the following steps:
[0035] Step 1: Receive a business code; the business code is provided with an annotation mark; the annotation mark includes a business code, a business step name, a business step sequence and remarks;
[0036] In this step, when developers write business codes, they annotate the entry of the coding method according to the business process, marking the business code, business step name, business step sequence and remarks of this business code, such as Figure 2 As shown, the business code can be decomposed later; the business code written by the developer is received and the next step is carried out;
[0037] Step 2: Parse the annotation identifier and decompose the business code into multiple hierarchically distributed visualization nodes; compare with the historical version of the business code, and set a node identifier for displaying the status of each visualization node for multiple visualization nodes; the node identifier includes changed, unchanged, and newly added;
[0038] In this step, the annotation identifiers in the business code are parsed, and the business code is decomposed into multiple visualization nodes according to the business code and the business step name. Then, according to the order of the business steps, the multiple visualization nodes are arranged and displayed in a hierarchical manner; by comparing with the historical version of the business code (the previous business code), the corresponding node identifier is set in the corresponding visualization node; when the business code in the visualization node has changed, the changed node identifier is set in the visualization node; when the business code in the visualization node does not exist in the previous business code, the newly added node identifier is set in the visualization node; when the business code in the visualization node has not changed, the unchanged node identifier is set in the visualization node; in this way, the reviewer can clearly understand which business codes have changed, and the layout is clear, which is convenient for the reviewer to understand the contextual relationship of the changed business code.
[0039] Secondly, the visualization node displays the corresponding business code in the form of a pop-up window after clicking the visualization node. When the review begins, only the visualization node is displayed to the reviewer, and the reviewer selects the changed or newly added visualization node for review based on the node identifier. After clicking the corresponding visualization node, a pop-up window will display the business code corresponding to the business step, and the reviewer will review the business code in the window.
[0040] To further help reviewers know which content is changed, when a node is marked as changed, the changed content of the business code in the window is displayed in other colors, such as Figure 3 As shown, the reviewer can immediately know which content is modified, and the changed content can also be highlighted;
[0041] Secondly, the window is equipped with a comparison option. When the node mark of the visualization node is changed, click the comparison option to realize the business code before the change. The reviewer can see the business code before and after the change at the same time, which is convenient for the reviewer to understand the intention of the change and the quality of the code. When the node mark of the visualization node is added or unchanged, the comparison option cannot be clicked or is invalid because the last code did not have the corresponding steps or did not change. The window is also equipped with a comment option. After the review of the business code in the visualization node is completed, click the comment option and fill in the review comments of this part of the business code in the comment window. In this way, developers can also easily know the business code corresponding to the review comments without having to find related content in the entire business code, thereby improving the efficiency of the code review process.
[0042] Step 3: Select reviewers to review the business code through visual nodes.
[0043] Preferably, the specific operation of selecting reviewers in step 3 is: deriving a comprehensive score based on the reviewers' professional scores and business matching scores and corresponding weights; selecting the top 3 reviewers in terms of comprehensive scores; the professional score is the reviewer's initial score; and the business matching score is the average of the developers' scores on the reviewers.
[0044] In this step, a database of reviewers is established. When the reviewer's information is entered into the database, an initial score will be set according to the reviewer's information. The initial score serves as the reviewer's professional score. The initial value of the business matching score is zero. After the reviewer has reviewed the business code, the developer will score the reviewer. This score serves as the business matching score. If the number of reviews is greater than or equal to two, the average value after multiple scores is taken as the business matching score. In other words, the professional score is fixed, and the business matching score will fluctuate as the number of reviews by the reviewer increases. The comprehensive score of the reviewer is then obtained by multiplying the professional score by 0.4 and the business matching score by 0.6. The top three reviewers in the comprehensive score are selected as the reviewers of the business code. After the visualization node is pushed to the reviewer, the reviewer can review the business code according to the visualization node.
[0045] Preferably, the method further includes step 4: sending the business code review results to the developers and scoring the professionalism of the reviewers.
[0046] In this step, after the reviewer completes the review, he / she will send the business code review results to the developer. When the business code passes, the developer will score the reviewer's professionalism, and the score will be included in the business matching score. When the business code fails, the developer will modify the business code based on the review results and resubmit it after the modification is completed.
[0047] Example 2
[0048] refer to Figure 4 , a visual code review system, including the following units:
[0049] Receiving unit: used for receiving a service code; the service code is provided with an annotation mark; the annotation mark includes a service code, a service step name, a service step sequence and remarks;
[0050] Display unit: used to parse annotation identifiers, decompose the business code into multiple hierarchically distributed visualization nodes; compare with the historical version of the business code, and set node identifiers for multiple visualization nodes to display the status of each visualization node; the node identifiers include changed, unchanged, and newly added;
[0051] Review unit: used to select reviewers and review business codes through visual nodes;
[0052] The receiving unit, the display unit and the review unit are communicatively connected in sequence.
[0053] Preferably, it also includes a scoring unit, which is used to send the business code review results to the developers and score the professionalism of the reviewers.
[0054] In this embodiment, the developer writes the business code and writes annotation identifiers in the business code to distinguish the various steps of the business code. After the writing is completed, the business code is uploaded to the visual code review system. The receiving unit receives the business code and sends the business code to the display unit; the display unit decomposes the business code into multiple hierarchically distributed visual nodes by parsing the annotation identifiers in the business code, and then compares it with the historical version of the business code to determine which steps of the business code are modified, newly added or unchanged, and displays the situation of each visual node by setting a node identifier on the corresponding visual node; when the visual node is modified, the node identifier shows the change; when the visual node is newly added, the node identifier shows the addition; when the visual node is unchanged, the node identifier shows the unchanged; after the business code is decomposed into multiple visual nodes, the multiple visual nodes are sent to the review unit; the review unit checks the business code according to the corresponding professional score and business matching score of each reviewer. The review unit generates the review results for the business code and sends them to the scoring unit. The scoring unit pushes the review results to the developer, who views the review results of the business unit through the scoring unit. When the business code passes, the developer scores the professionalism of the reviewer through the scoring unit, and the scoring unit sends the score to the review unit. The review unit records the score and updates the corresponding business matching score. When the business code fails, the developer modifies the business code according to the review suggestions and scores the reviewer. After the modification is completed, the modified business unit is re-uploaded to the receiving unit for the next review.
[0055] By establishing this review system, a process-based management method is implemented to facilitate the tracking and management of the entire code review cycle. Moreover, this system supports real-time updates and feedback. Reviewers can immediately point out problems in the code and communicate with developers in real time, thereby speeding up the review process.
[0056] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A visual code review method, characterized in that: The following steps are involved: Step 1: Receive a service code; the service code is provided with an annotation mark; the annotation mark includes a service code, a service step name, a service step sequence and remarks; Step 2: Parse the annotation identifier and decompose the business code into multiple hierarchically distributed visualization nodes; compare with the historical version of the business code, and set a node identifier for displaying the status of each visualization node for multiple visualization nodes; the node identifier includes changed, unchanged, and newly added; Step 3: Select reviewers to review the business code through visual nodes.
2. The visual code review method according to claim 1, characterized in that: It also includes step 4: sending the business code review results to the developer and scoring the professionalism of the reviewer.
3. The visual code review method according to claim 2, characterized in that: The specific operation of selecting reviewers in step 3 is: deriving a comprehensive score based on the reviewers' professional scores, business matching scores and corresponding weights; selecting the top three reviewers in terms of comprehensive scores; the professional score is the reviewer's initial score; and the business matching score is the average of the developer's scores on the reviewers.
4. The visual code review method according to claim 3, characterized in that: The weight of the professional score is 0.4; the weight of the business matching score is 0.
6.
5. The visual code review method according to claim 1, characterized in that: The step 2 also includes: when the node is marked as changed, the changed content of the business code in the visualization node is displayed in a highlighted or other color manner.
6. The visual code review method according to claim 1, characterized in that: The visualization node displays the corresponding business code in the form of a pop-up window after clicking the visualization node.
7. The visual code review method according to claim 6, characterized in that: The window is provided with a comparison option and an annotation option; the reviewer can view the business code before the change by clicking the comparison option; the reviewer can fill in the review suggestion of the business code in the visualization node by clicking the annotation option.
8. A visual code review system, characterized in that: The following units are included: Receiving unit: used for receiving a service code; the service code is provided with an annotation mark; the annotation mark includes a service code, a service step name, a service step sequence and remarks; Display unit: used to parse annotation identifiers, decompose the business code into multiple hierarchically distributed visualization nodes; compare with the historical version of the business code, and set node identifiers for multiple visualization nodes to display the status of each visualization node; the node identifiers include changed, unchanged, and newly added; Review unit: used to select reviewers and review business codes through visual nodes; The receiving unit, the display unit and the review unit are communicatively connected in sequence.
9. A visual code review system according to claim 8, characterized in that: It also includes a scoring unit, which is used to send business code review results to developers and score the professionalism of reviewers.
Citation Information
Patent Citations
Code review method and device, storage medium and computer equipment
CN116088857A