Code comment synchronization method and device, equipment and medium

By synchronizing the comment information of the code warehouse in the office group of instant messaging software, the problem of communication fragmentation of the development team is solved, and more efficient code review and better review results are achieved.

CN120434221APending Publication Date: 2025-08-05ZHOUPU DATA TECH NANJING CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510573872.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

The communication between the development team between the instant messaging software and the code repository has resulted in inefficient code review and team members are unable to actively participate in code review and comment, and the audit effect is poor.

Method used

Publish the audit reminder information for code merge requests to the office group of the instant messaging software, obtain the comment events of group members in the code repository, and synchronize the comment information to the office group, and automatically process the comment events by setting consent merge characters and hook functions.

Benefits of technology

It improves the efficiency and effectiveness of code review, allowing more team members to participate in the review, and improves code quality and work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120434221A_ABST
    Figure CN120434221A_ABST
Patent Text Reader

Abstract

The invention discloses a code comment synchronization method and device, equipment and a medium. The method comprises the following steps: issuing auditing reminding information of a code merging request to an office group of instant messaging software; obtaining comment events of group members of the office group in a code warehouse according to the auditing reminding information; and generating to-be-synchronized comment information according to the comment event, and synchronously publishing the comment information to the office group. According to the embodiment of the invention, the code auditing efficiency and auditing effect can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of code management, and in particular to a method, apparatus, device and medium for synchronizing code comments. Background Art

[0002] A code repository is a tool for storing, managing, and tracking code. It is typically used by development teams to collaborate on software projects, manage code versions, record change histories, and support multi-person collaboration. After a team member finishes writing code, they upload the code to the code repository and initiate a merge request. Upon receiving the merge request, the reviewer reviews and comments on the code in the code repository until it can be merged into the main branch. This code repository-based work trace mechanism not only avoids information fragmentation (such as the dispersion of emails or chat records), but also makes it easier for subsequent maintainers to see the discussion context at the time through the code submission history and understand the code decision logic.

[0003] However, this work-tracking mechanism also presents some issues. First, development teams typically have their own instant messaging software, such as DingTalk, WeChat Work, and Lark. Daily team communication occurs within the messaging software, while code review discussions must take place within the code repository. This creates a significant fragmentation and leads to inefficient reviews. Second, reviews and comments are typically conducted one-on-one and are not visible to other team members. This often prevents other team members from actively participating in code reviews and comments, and even if they have better ideas, they are unable to contribute, resulting in suboptimal reviews. Summary of the Invention

[0004] The present invention provides a code review synchronization method, device, equipment and medium to improve code review efficiency and review effect.

[0005] According to one aspect of the present invention, a method for synchronizing code comments is provided, comprising:

[0006] Post the review reminder of the code merge request to the office group of the instant messaging software;

[0007] Obtaining comment events in the code repository by group members of the office group according to the review reminder information;

[0008] Generate comment information to be synchronized according to the comment event, and synchronously publish the comment information to the office group.

[0009] According to another aspect of the present invention, there is provided a code review synchronization device, comprising:

[0010] The reminder publishing module is used to publish the review reminder information of the code merge request to the office group of the instant messaging software;

[0011] An event acquisition module, configured to acquire comment events in the code repository by group members of the office group according to the review reminder information;

[0012] The comment synchronization module is used to generate comment information to be synchronized according to the comment event, and synchronously publish the comment information to the office group.

[0013] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method for synchronizing code reviews according to any one of the embodiments of the present invention is implemented.

[0014] According to another aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the code review synchronization method described in any embodiment of the present invention.

[0015] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the code review synchronization method described in any embodiment of the present invention when executed.

[0016] The embodiment of the present invention converts the code comment records in the code repository into comment information in the instant messaging software, which can greatly improve work efficiency and the efficiency of code review, allowing the development team to focus more on project development and improve code quality; at the same time, it can allow more team members to participate in the code review work and improve the review effect.

[0017] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] 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.

[0019] Figure 1 is a flowchart of a code review synchronization method provided according to an embodiment of the present invention;

[0020] Figure 2A is a flowchart of a code review synchronization method provided according to another embodiment of the present invention;

[0021] Figure 2B is a schematic diagram of a comment event in a code repository provided according to another embodiment of the present invention;

[0022] Figure 2C is a schematic diagram of comment information in an office group provided according to another embodiment of the present invention;

[0023] Figure 3 is a structural diagram of a code review synchronization device provided according to another embodiment of the present invention;

[0024] Figure 4 It is a schematic structural diagram of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0025] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described 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 ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0026] It should be noted that the terms "first," "second," and the like in the present invention are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including," "having," and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatuses.

[0027] Figure 1 This is a flowchart of a code review synchronization method provided by an embodiment of the present invention. This embodiment is applicable to situations where a development team communicates daily in an office group using instant messaging software, and needs to communicate in a code repository when reviewing code. This method can be executed by a code review synchronization device, which can be implemented in the form of hardware and / or software. The device can be configured in an electronic device with corresponding data processing capabilities, such as a merge request automation system based on code repository code submission and push. Figure 1 As shown, the method includes:

[0028] S110: Posting the review reminder information of the code merge request to the office group of the instant messaging software.

[0029] S120: Obtain comment events of group members of the office group in the code repository according to the review reminder information.

[0030] S130: Generate comment information to be synchronized according to the comment event, and synchronously publish the comment information to the office group.

[0031] Among them, the review reminder information includes the comment link of the code merge request; the group members of the office group include the initiator and reviewer of the code merge request, as well as other members of the development team except the initiator and reviewer.

[0032] Specifically, the initiator submits the code to the code repository. After the submitted content is reviewed by the system, the system creates a code merge request and sends it to the code repository. After receiving the code merge request, the code repository returns the review link of the code merge request to the system. The system generates a review reminder message based on the review link. Through the authentication information of the office robot corresponding to the project to which the code belongs, the robot message API provided by the instant messaging software is called, and the office robot publishes the review reminder message in the office group that can be seen by all group members. Every group member, including the initiator and reviewer, can click on the review link in the review reminder message to jump to the code repository to comment on the code, and generate a corresponding comment event in the code repository.

[0033] The code repository forwards the generated comment event to the system, which parses the comment event to determine the specific comment content and how to handle it. Based on the specific comment content or processing results, comment information is generated and simultaneously published to the office group. The comment information publishing process, like the review reminder process, is also implemented by the office robot and will not be detailed here.

[0034] As an intermediary for information transmission, the system will synchronously publish the code comment events in the code repository to the office group in the form of comment information. Team members do not need to jump to the code repository. They can know the specific review status only through the comment information published by the system in the office group, which greatly improves work efficiency. At the same time, other members in the office group except the initiator and reviewer can also participate in the code review work by clicking on the links in the various information published by the system, thereby improving the code review effect.

[0035] The embodiment of the present invention converts the code comment records in the code repository into comment information in the instant messaging software, which can greatly improve work efficiency and the efficiency of code review, allowing the development team to focus more on project development and improve code quality; at the same time, it can allow more team members to participate in the code review work and improve the review effect.

[0036] Figure 2A This is a flowchart of a code review synchronization method provided by another embodiment of the present invention. This embodiment is optimized and improved on the basis of the above embodiment. Figure 2A As shown, the method includes:

[0037] S210: Determine branch information and remark information of the submitted code based on the code submission record obtained from the code repository.

[0038] S220. If the branch information and the remark information meet the merge request creation condition, initiate the code merge request to the code repository according to the branch information and the remark information, and generate review reminder information for the code merge request.

[0039] Specifically, the initiator submits the code to the code repository and fills in the remarks when submitting. The code repository generates a submission record for the code and sends it to the system. The system parses the submission record according to the regular expression format rules to obtain the branch information and remarks contained in the submission record. Not all codes submitted to the code repository need to be merged into the main branch, so it is determined whether the branch information and remarks information meet the conditions for creating a merge request. If not, it means that the code does not need to be automatically merged into the main branch, and no subsequent processes will be carried out. If it does, it means that the code needs to be automatically merged into the main branch. A merge request is created based on the branch information and remarks information and sent to the code repository. After receiving the merge request, the code repository returns a review link to the system, and the system generates a review reminder based on the review link.

[0040] S230: Post the review reminder information of the code merge request to the office group of the instant messaging software.

[0041] S240: Obtain comment events of the group members of the office group in the code repository according to the review reminder information.

[0042] S250: Generate comment information to be synchronized according to the comment event, and synchronously publish the comment information to the office group.

[0043] Based on the above embodiment, optionally, generating the comment information to be synchronized according to the comment event includes:

[0044] If the comment event is to agree to merge and the commenter of the comment event is a reviewer, a code merge instruction is sent to the code repository according to the comment event, and after receiving a reply to the code merge instruction, comment information to be synchronized is generated according to the reply.

[0045] If the comment record is not agreed to be merged or the commentator of the comment event is not a reviewer, the comment event is summarized to obtain comment information.

[0046] Specifically, after receiving the comment event sent by the code repository, the system parses it and obtains specific information such as the request project, request initiator, comment content, and commentator. Determine whether the comment event is for agreement to merge based on the comment content, and determine whether the commentator is the corresponding reviewer. If the comment event is for agreement to merge and the commentator of the comment event is the reviewer, it means that a merge is required, and the reviewer, request identification information and other parameters are assembled, and a code merge instruction is sent to the interface of the code repository. The code repository merges the code into the main branch based on the received code merge instruction, and sends a reply to the system indicating a successful merge. The system generates comment information based on the reply content. If the comment event is not for agreement to merge or the commentator of the comment event is not the reviewer, it means that there is no need to merge for the time being, and the comment event is summarized to obtain comment information.

[0047] Based on the above embodiment, optionally, generating the comment information to be synchronized according to the comment event further includes:

[0048] Determining whether the comment content of the comment event contains preset agreed-to-merge characters;

[0049] If the preset merge-agreement character is included, the comment event is determined to be merge-agreement;

[0050] If the preset consent merge character is not included, it is determined that the comment event is not consent merge.

[0051] Specifically, a pre-agreed merge consent character (e.g., LGTM, meaning looks good to me) is pre-agreed. If a comment contains this consent character, it indicates that the commenter agrees to the merge. If the comment does not contain this consent character, it indicates that the commenter disagrees with the merge. By setting this consent character, the "consent" action in code reviews is separated from ordinary comments, preventing critical information from being overwhelmed. Furthermore, character matching determines whether the code is merged and whether the initiator is legitimate, reducing manual errors and improving the accuracy of code reviews.

[0052] Based on the above embodiment, optionally, generating the comment information to be synchronized according to the comment event includes:

[0053] Determine the commentator, comment content and comment link of this comment based on the comment event;

[0054] The commentator, comment content and comment link are assembled to generate comment information to be synchronized.

[0055] Specifically, if the system determines that a comment is for communication purposes and does not require automatic code merging, it will take the comment content and commenter as input, assemble them together with the comment link, and generate the comment information for this comment. Based on the project name, it will obtain the office robot's authentication information. Based on the authentication information, the office robot will be called to post the comment information in the office group and notify the comment recipient.

[0056] Based on the above embodiment, optionally, the comment event and the reply are sent by a hook function in the code repository.

[0057] Specifically, when a specific event is triggered in the code repository, a webhook function can automatically send relevant information about the event to the target system. This is a capability provided by the code repository. By simply configuring the hook function in advance, various information such as submission records, review links, comment events, and replies can be automatically forwarded to the system.

[0058] For example, the project in the code repository is set to HelloWorld, and the hook function has been set. The code submission employee's name abbreviation is hjw, and the review employee's name abbreviation is zhy.

[0059] 1. Employee zhy received a code merge request from other employee hjw in the HelloWorld project in the office group.

[0060] 2. After reading the code, employee zhy has a question about a point in the code and comments on the specific line of code. The code repository forwards the comment event to the system.

[0061] 3. After receiving the comment event, the system parses out information such as the request project, request initiator, comment content, and commenter.

[0062] 4. The system determines that this comment is for communication purposes, so there's no need to automatically merge the code. The system combines the comment content, the commenter, and the request originator, and then uses the HelloWorld project to retrieve the office robot's authentication information from the system's message template. It then calls the instant messaging API, posts a conversation message in the office group, and notifies (@) the commentee.

[0063] 5. Employees can repeat steps 2-4 to communicate multiple times, and a communication record in dialogue mode will be formed in the office group.

[0064] 6. If the system determines that the comment contains a merge consent string, it considers the comment to be merged. After determining that the commenter is a legitimate approver, the system assembles the approver, request identifier, and other parameters and sends a merge request to the code repository's API.

[0065] 7. After the code repository successfully merges the code, this system receives a reply from the code repository. Then, based on the project HelloWorld, it uses the message template of this system to obtain the authentication information of the office robot, calls the API of the instant messaging software, posts the corresponding comment information in the office group, and reminds (@) the initiator of the merge request.

[0066] For example, Figure 2B As shown in the figure, after the initiator (Developer) submitted the code to the code repository, the reviewer (Maintainer) had some questions about the code and made comments. The initiator answered and explained the questions. After seeing the initiator's answers and explanations, the reviewer determined that there were no problems with the code and could be merged, and commented on the corresponding code merge characters "lgtm". Figure 2C As shown, through the synchronization method of the present invention, Figure 2B Each comment event is synchronized to the workgroup as a conversation message. This message includes the reviewer, the content of the comment, and the specific comment link. Group members can click the link in the conversation message to jump to the code repository, comment on the code, and express their opinions and views.

[0067] The embodiment of the present invention separates the "agree" action of code review from ordinary comments by setting the consent merging character, thereby avoiding the drowning of key information; at the same time, the character matching method is used to determine whether the code is merged and whether the initiator is legal, which also reduces the error rate of manual operation and improves the accuracy of code review.

[0068] Figure 3 A schematic diagram of a code review synchronization device provided by another embodiment of the present invention. Figure 3 As shown, the device includes:

[0069] The reminder publishing module 310 is used to publish the review reminder information of the code merge request to the office group of the instant messaging software;

[0070] An event acquisition module 320 is configured to acquire comment events in the code repository by group members of the office group according to the review reminder information;

[0071] The comment synchronization module 330 is used to generate comment information to be synchronized according to the comment event, and synchronously publish the comment information to the office group.

[0072] The code comment synchronization device provided in the embodiment of the present invention can execute the code comment synchronization method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0073] Optionally, the comment synchronization module 330 includes:

[0074] a first comment synchronization unit, configured to send a code merge instruction to the code repository according to the comment event if the comment event indicates a consent to merge and the commenter of the comment event is a reviewer, and generate comment information to be synchronized according to a reply to the code merge instruction after receiving the reply;

[0075] The second comment synchronization unit is configured to generate comment information to be synchronized according to the comment content of the comment event if the comment record is not agreed to be merged or the commentator of the comment event is not a reviewer.

[0076] Optionally, the second comment synchronization unit is specifically used to: determine the commentator, comment content and comment link of this comment according to the comment event; and assemble the commentator, comment content and comment link to generate comment information to be synchronized.

[0077] Optionally, the comment synchronization module 330 further includes:

[0078] An analysis unit, configured to determine whether the comment content of the comment event contains preset agreed-to-merge characters;

[0079] A first determining unit, configured to determine that the comment event is a merge-agreement event if a preset merge-agreement character is included;

[0080] The second determining unit is configured to determine that the comment event is not a merge-agreement event if the comment event does not contain a preset merge-agreement character.

[0081] Optionally, the comment event and the reply are sent by a hook function in the code repository.

[0082] Optionally, the reminder publishing module 310 is specifically used to: determine the branch information and remark information of the submitted code based on the code submission record obtained from the code repository; if the branch information and remark information meet the merge request creation conditions, then initiate the code merge request to the code repository based on the branch information and the remark information, and generate review reminder information for the code merge request.

[0083] The code comment synchronization device further described can also execute the code comment synchronization method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0084] Figure 4A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0085] like Figure 4 As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., which is communicatively connected to the at least one processor 41. The memory stores a computer program that can be executed by the at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 into the random access memory (RAM) 43. Various programs and data required for the operation of the electronic device 40 can also be stored in the RAM 43. The processor 41, ROM 42, and RAM 43 are connected to each other via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.

[0086] Multiple components in the electronic device 40 are connected to the I / O interface 45, including an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a magnetic disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0087] Processor 41 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processor, controller, microcontroller, etc. Processor 41 executes the various methods and processes described above, such as the code review synchronization method.

[0088] In some embodiments, the method for synchronizing code reviews may be implemented as a computer program that is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the method for synchronizing code reviews described above may be performed. Alternatively, in other embodiments, the processor 41 may be configured to execute the method for synchronizing code reviews in any other appropriate manner (e.g., by means of firmware).

[0089] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0090] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0091] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, 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 foregoing.

[0092] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0093] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by 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), a blockchain network, and the Internet.

[0094] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0095] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0096] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A code review synchronization method, characterized in that: The method comprises: Post the review reminder of the code merge request to the office group of the instant messaging software; Obtaining comment events in the code repository by group members of the office group according to the review reminder information; Generate comment information to be synchronized according to the comment event, and synchronously publish the comment information to the office group.

2. The method according to claim 1, characterized in that Generating the comment information to be synchronized according to the comment event includes: If the comment event is a consent to merge and the commenter of the comment event is a reviewer, a code merge instruction is sent to the code repository according to the comment event, and after receiving a reply to the code merge instruction, comment information to be synchronized is generated according to the reply; If the comment record is not agreed to be merged or the commentator of the comment event is not a reviewer, the comment event is summarized to obtain comment information.

3. The method according to claim 2, characterized in that Generating the comment information to be synchronized according to the comment event further includes: Determining whether the comment content of the comment event contains preset agreed-to-merge characters; If the preset merge-agreement character is included, the comment event is determined to be merge-agreement; If the preset consent merge character is not included, it is determined that the comment event is not consent merge.

4. The method according to claim 2, characterized in that Generating the comment information to be synchronized according to the comment content of the comment event includes: Determine the commentator, comment content and comment link of this comment based on the comment event; The commentator, comment content and comment link are assembled to generate comment information to be synchronized.

5. The method according to claim 2, characterized in that The comment event and the reply are sent by a hook function in the code repository.

6. The method according to claim 1, characterized in that The step of publishing the code merge request review reminder information to the office group of the instant messaging software includes: Determine the branch information and remarks of the submitted code based on the code submission records obtained from the code repository; If the branch information and the remark information meet the merge request creation conditions, the code merge request is initiated to the code repository according to the branch information and the remark information, and review reminder information of the code merge request is generated.

7. A code review synchronization device, characterized in that: The device comprises: The reminder publishing module is used to publish the review reminder information of the code merge request to the office group of the instant messaging software; An event acquisition module, configured to acquire comment events in the code repository by group members of the office group according to the review reminder information; The comment synchronization module is used to generate comment information to be synchronized according to the comment event, and synchronously publish the comment information to the office group.

8. The device according to claim 7, characterized in that The comment synchronization module includes: a first comment synchronization unit, configured to send a code merge instruction to the code repository according to the comment event if the comment event indicates a consent to merge and the commenter of the comment event is a reviewer, and generate comment information to be synchronized according to a reply to the code merge instruction after receiving the reply; The second comment synchronization unit is configured to generate comment information to be synchronized according to the comment content of the comment event if the comment record is not agreed to be merged or the commentator of the comment event is not a reviewer.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the code review synchronization method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the code review synchronization method according to any one of claims 1 to 6 when executed.

Citation Information

Patent Citations

  • Code comment information acquisition method and device, computer equipment and storage medium

    CN109918114A

  • Code auditing method and device, equipment and medium

    CN118057303A

  • Automatic processing method and device after code submission, equipment and medium

    CN118210537A