Multi-branch incremental inspection method and related equipment based on artificial intelligence
Through the multi-branch incremental inspection method based on artificial intelligence, multiple branches in the code warehouse are independently scanned and inspected, which solves the problem of low efficiency of multi-branch inspection in the existing technology and achieves fast and accurate code inspection.
Patent Information
- Application Number
- CN202210594779.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-05-27
AI Technical Summary
The existing technology has low efficiency in independent scanning and checking of multiple branches in the code warehouse, resulting in slow code checking speed and inability to realize independent scanning and checking of multiple branches in the code warehouse, which puts pressure on development and testing work.
Using artificial intelligence-based multi-branch incremental inspection method, by comparing the new code file with the original code file of the target branch, a list of incremental sub-files is generated, and a static code quality scanning tool is used to check only the incremental sub-files to ensure that each branch The inspection results are independent and the inspection speed is improved.
It reduces the number of inspection files, improves the speed and efficiency of code inspection, ensures that the inspection results of each branch are independent of each other, and reduces the work pressure of development and testing.
Smart Images

Figure CN114924978B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an artificial intelligence-based multi-branch incremental inspection method, device, electronic device and storage medium. Background Art
[0002] During the project development process, after the developer finishes writing new code on the terminal, he uploads the new code file to the code repository and merges it with the original code in the code repository. Static code quality scanning tools generally scan and check all codes regularly after merging the codes. After discovering problems, the developer will make modifications. However, the development task has been completed at this time, and the developer has little motivation to make modifications. Moreover, after the modifications, the tester needs to repeat the test, which brings great pressure to the testing work.
[0003] Currently, the scanning and inspection time node is usually advanced to before each code merge, and the scanning and inspection is only performed on a fixed branch. However, this method cannot realize independent scanning and inspection of multiple branches in the code repository, and the inspection speed is slow, which leads to low code inspection efficiency. Summary of the invention
[0004] In view of the above content, it is necessary to propose an artificial intelligence-based multi-branch incremental inspection method and related equipment to solve the technical problem of how to improve the efficiency of code inspection. The related equipment includes an artificial intelligence-based multi-branch incremental inspection device, an electronic device and a storage medium.
[0005] The present application provides a multi-branch incremental inspection method based on artificial intelligence, the method comprising:
[0006] When a submitted new code file requests to be merged with a branch code file of the code repository, respond to the code merge request to obtain an incremental check signal, wherein the incremental check signal includes the ID information corresponding to the branch participating in the code merge in the code repository, and the code merge request includes the ID information of the branch corresponding to the new code file;
[0007] Selecting the same ID information as that in the code merge request from the incremental check signal, taking the branch corresponding to the ID information as the target branch, and comparing the original code file and the new code file of the target branch to obtain an incremental sub-file list, wherein the original code file and the new code file of the target branch include multiple sub-files;
[0008] Matching the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct an incremental sub-file pair of the target branch, wherein the incremental sub-file pair corresponds to the incremental sub-file one by one;
[0009] Creating an inspection item of the target branch based on the ID information of the target branch;
[0010] Performing incremental check on the incremental sub-file pairs of the target branch based on the check items of the target branch to obtain incremental check results;
[0011] The new code file is modified based on the incremental checking result to obtain a correct code file.
[0012] In some embodiments, comparing the original code file and the new code file of the target branch to obtain an incremental sub-file list includes:
[0013] Extracting the original code file and the new code file of the target branch according to the ID information of the target branch;
[0014] Comparing the original code file of the target branch with the sub-files in the new code file to obtain a changed sub-file list, wherein the changed sub-file list includes three change states: added file, deleted file, and modified file;
[0015] The changed sub-file list is filtered based on the change status to obtain the incremental sub-file list.
[0016] In some embodiments, matching the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct the incremental sub-file pair of the target branch includes:
[0017] Filter the original code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to obtain a first sub-file set;
[0018] Filter the new code files of the target branch based on the names of the incremental sub-files in the incremental sub-file list to obtain an incremental sub-file set;
[0019] The first sub-file set and the incremental sub-file set are matched to obtain the incremental sub-file pair of the target branch.
[0020] In some embodiments, matching the first sub-file set and the incremental sub-file set to obtain the incremental sub-file pair of the target branch includes:
[0021] Select any incremental sub-file in the incremental sub-file set as the target sub-file;
[0022] Obtaining a matching result based on matching the target subfile with all subfiles in the first subfile set, wherein the matching result includes a matching success and a matching failure;
[0023] If the match is successful, the target subfile and the subfile with a matching relationship are taken as a set of incremental subfile pairs;
[0024] If the match fails, an empty file and the target sub-file are generated as a set of incremental sub-file pairs;
[0025] All incremental sub-files in the incremental sub-file set are traversed to obtain the incremental sub-file pairs of the target branch.
[0026] In some embodiments, performing an incremental check on the incremental sub-file pair of the target branch based on the check item of the target branch to obtain an incremental check result includes:
[0027] Preprocessing the sub-files in the incremental sub-file pair according to code types, wherein the code types include compiled languages and non-compiled languages;
[0028] Send the preprocessed sub-files to the inspection project to obtain inspection results of two sub-files in each set of incremental sub-file pairs;
[0029] The code increment value is obtained by calculating the absolute value of the difference between the inspection results of two sub-files in the same group of incremental sub-file pairs;
[0030] The code increment value of each group of incremental sub-file pairs is counted as the incremental check result.
[0031] In some embodiments, modifying the new code file based on the incremental check result to obtain a correct code file includes:
[0032] Extracting an error sub-file set in the incremental sub-file list based on the incremental check result;
[0033] The developer modifies the sub-file of the error sub-file set to obtain a modified sub-file set;
[0034] The modified sub-file set is taken as the new code file, and the incremental check process is repeatedly performed to obtain the latest incremental check result, until the number of sub-files in the erroneous sub-file set corresponding to the latest incremental check result is zero, thereby obtaining the correct code file.
[0035] In some embodiments, extracting the set of error sub-files in the incremental sub-file list based on the incremental check result comprises:
[0036] Get the code increment value of each group of incremental sub-file pairs;
[0037] If the code increment value is 0, it means that there is no new code problem in the incremental subfile of the corresponding incremental subfile pair, and the incremental subfile is a correct subfile;
[0038] If the code increment value is not 0, it means that there is a new code problem in the incremental subfile of the corresponding incremental subfile pair, and the incremental subfile is an error subfile;
[0039] All error sub-files are stored to obtain an error sub-file collection.
[0040] The embodiment of the present application also provides a multi-branch incremental inspection device based on artificial intelligence, the device comprising:
[0041] A response unit, configured to respond to a code merge request to obtain an incremental check signal when a submitted new code file requests to be merged with a branch code file of a code repository, wherein the incremental check signal includes ID information corresponding to a branch in the code repository that participates in the code merge, and the code merge request includes ID information of a branch corresponding to the new code file;
[0042] a comparison unit, configured to select the same ID information as that in the code merge request from the incremental check signal, take the branch corresponding to the ID information as the target branch, and compare the original code file and the new code file of the target branch to obtain an incremental sub-file list, wherein the original code file and the new code file of the target branch include multiple sub-files;
[0043] A matching unit, configured to match the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct an incremental sub-file pair of the target branch;
[0044] A creating unit, used for creating an inspection item of a target branch based on the ID information of the target branch;
[0045] A checking unit, configured to perform an incremental check on the incremental sub-file pairs of the target branch based on the check items of the target branch to obtain an incremental check result;
[0046] A modification unit is configured to modify the new code file based on the incremental checking result to obtain a correct code file.
[0047] The present application also provides an electronic device, the electronic device comprising:
[0048] A memory storing at least one instruction;
[0049] A processor executes instructions stored in the memory to implement the artificial intelligence-based multi-branch incremental inspection method.
[0050] An embodiment of the present application also provides a computer-readable storage medium, in which at least one instruction is stored. The at least one instruction is executed by a processor in an electronic device to implement the artificial intelligence-based multi-branch incremental inspection method.
[0051] In summary, this application compares the new code files submitted by developers with the original code files of the corresponding branches to obtain incremental sub-files, and then uses a quality scanning tool to check only the incremental sub-files of each branch to complete the code inspection, thereby reducing the number of inspection files and greatly improving the speed of code inspection while ensuring that the inspection results of each branch are independent of each other. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a flowchart of a preferred embodiment of the artificial intelligence-based multi-branch incremental inspection method involved in this application.
[0053] Figure 2 It is a flowchart of the development tasks involved in this application.
[0054] Figure 3 It is a functional module diagram of a preferred embodiment of the artificial intelligence-based multi-branch incremental inspection device involved in this application.
[0055] Figure 4 It is a structural schematic diagram of an electronic device of a preferred embodiment of the multi-branch incremental inspection method based on artificial intelligence involved in the present application. DETAILED DESCRIPTION
[0056] In order to more clearly understand the purpose, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other. In the following description, many specific details are set forth to facilitate a full understanding of the present application, and the embodiments described are only a part of the embodiments of the present application, rather than all of the embodiments.
[0057] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art to which the present application belongs. The terms used herein in the specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0059] The embodiment of the present application provides a multi-branch incremental inspection method based on artificial intelligence, which can be applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0060] An electronic device can be any electronic product that can interact with a customer, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.
[0061] The electronic device may also include a network device and / or a client device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.
[0062] The network where the electronic device is located includes but is not limited to the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.
[0063] like Figure 1 As shown, it is a flow chart of a preferred embodiment of the multi-branch incremental inspection method based on artificial intelligence of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.
[0064] S10, when the submitted new code file requests to be merged with the branch code file of the code repository, respond to the code merge request to obtain an incremental check signal, the incremental check signal includes the ID information corresponding to the branch participating in the code merge in the code repository, and the code merge request includes the ID information of the branch corresponding to the new code file.
[0065] In an optional embodiment, during the project development process, all code files related to the project will be stored in a code repository. There are multiple branches in the code repository, and each branch stores corresponding code files. The number of branches in the code repository is related to the project tasks. In order to distinguish different branches, the code repository assigns an ID information to each branch. The ID information can be numbers, letters, or symbols, which is not limited in this solution.
[0066] In this optional embodiment, the developer can select a branch to be developed from the code repository with the help of the project management software according to the project development requirements, and copy the original code file in the branch to be developed to his local computer to form a temporary branch. At the same time, the ID of the branch to be developed is extracted to the temporary branch to facilitate the rapid location of the target branch corresponding to the new code file when merging codes later. The developer can develop the original code file on the temporary branch to obtain the new code file. After the development task is completed, the new code file can be uploaded to the code repository with the help of the project management software, and the new code file on the temporary branch is merged with the original code file on the branch to be developed to complete the development task. The flow chart of the development task is shown as follows Figure 2 The project management software may be Gitlab, which is an open source application that can implement a self-hosted Git project code repository, access public or private projects through a Web interface, browse source code, and manage defects and comments.
[0067] In this optional embodiment, in the code repository, there will be multiple branches to be developed at the same time point for code merging operations, and each branch to be developed corresponds to its own original code file and new code file. The original code file is stored in the branch to be developed, and the new code file is stored in the temporary branch corresponding to the branch to be developed.
[0068] When a developer submits a new code file, a pre-configured hook function will be triggered before the new code file is merged with the original code file of the corresponding branch. The output result of the hook function is the incremental check signal, which includes the ID information of all branches participating in the code merge in the code repository at the same time node.
[0069] In this way, during the project development process, the incremental check signal will be obtained every time a new code file is submitted. The incremental check signal can accurately locate the branch where the code is merged, ensuring the independence of each branch in the code repository.
[0070] S11, select the ID information that is the same as that in the code merge request from the incremental check signal, take the branch corresponding to the ID information as the target branch, and compare the original code file and the new code file of the target branch to obtain an incremental sub-file list, wherein the original code file and the new code file of the target branch include multiple sub-files.
[0071] In an optional embodiment, after receiving the code merge request, it is necessary to check all branches included in the incremental check signal according to the code merge request, and retrieve the branch that is consistent with the ID information corresponding to the new code file in the code merge request as the target branch. It should be noted that since the operations between different branches are independent of each other, the code merge request includes at least one new code file to be merged, and this embodiment selects a branch corresponding to the ID information as the target branch, and all operations of other branches are the same as the target branch.
[0072] In this optional embodiment, the step of comparing the original code file and the new code file of the target branch to obtain an incremental sub-file list includes:
[0073] Extracting the original code file and the new code file of the target branch according to the ID information of the target branch;
[0074] Comparing the original code file of the target branch with the sub-files in the new code file to obtain a changed sub-file list, wherein the changed sub-file list includes three change states: added file, deleted file, and modified file;
[0075] The changed sub-file list is filtered based on the change status to obtain the incremental sub-file list.
[0076] In this optional embodiment, the original code file is a code file stored on the target branch before the developer develops the code, and both the original code file and the new code file contain multiple sub-files.
[0077] In this optional embodiment, the git diff function is used to compare the subfiles in the original code file and the new code file to obtain a list of changed subfiles, the list of changed subfiles includes the change status and the corresponding subfile name, the change status includes three types: addition, deletion, and modification, and the corresponding status is represented by the characters A, D, and M respectively, and the column corresponding to the deletion status in the list of changed subfiles is further discarded to obtain an incremental subfile list, and the incremental subfile list includes multiple incremental subfiles. Among them, the git diff function can compare the differences between code texts in different branches, different regions, and different submission records in the code repository.
[0078] Exemplarily, the ID information of the target branch is recorded as i, and the temporary branch corresponding to the target branch i is recorded as i * , the temporary branch i * Compare the new code file on the target branch i with the original code file on the target branch i by executing the following command:
[0079] "git diff --name-status ii * ”
[0080] That is, the changed sub-file list can be automatically obtained:
[0081] A: file1, file2;
[0082] D: file3;
[0083] M: file4, file5;
[0084] From the above changed sub-file list, we can know that two sub-files, file1 and file2, are added to the new code file, one sub-file, file3, is deleted from the original code file, and two sub-files, file4 and file5, are modified in the original code file. By discarding the corresponding columns of the deletion, we can get the incremental sub-file list, which includes 4 incremental sub-files:
[0085] A: file1, file2;
[0086] M: file4, file5;
[0087] In this optional embodiment, the incremental sub-file list corresponding to each branch can be obtained according to the target branch method based on each new code file in the code merge request for the corresponding branch in the incremental check signal.
[0088] In this way, the incremental sub-file list corresponding to the target branch can be obtained, providing a data basis for subsequent incremental checks.
[0089] S12, matching the original code file and the new code file of the target branch based on the names of the incremental sub-files in the incremental sub-file list to construct an incremental sub-file pair of the target branch, wherein the incremental sub-file pair corresponds one-to-one to the incremental sub-files.
[0090] In an optional embodiment, matching the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct the incremental sub-file pair of the target branch includes:
[0091] Filter the original code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to obtain a first sub-file set;
[0092] Filter the new code files of the target branch based on the names of the incremental sub-files in the incremental sub-file list to obtain an incremental sub-file set;
[0093] The first sub-file set and the incremental sub-file set are matched to obtain the incremental sub-file pair of the target branch.
[0094] In an optional embodiment, based on the name of the incremental subfile in the incremental subfile list, the subfile corresponding to the name is queried from the original code file of the target branch according to the intelligent search, and the subfile that can be queried is used as the first subfile set; based on the name of the incremental subfile, the corresponding subfile is extracted from the new code file of the temporary branch in the same way to form an incremental subfile set, and the subfiles of the incremental subfile set correspond to the subfiles in the incremental subfile list one by one. Among them, the intelligent search is a new generation of search engine combined with artificial intelligence technology, which can provide functions such as fast retrieval, information filtering and push.
[0095] Exemplarily, the incremental sub-file list is:
[0096] A: file1, file2;
[0097] M: file4, file5;
[0098] Then the first sub-file set is: {file4(1), file5(1)}, the incremental sub-file set is: {file1(2), file2(2), file4(2), file5(2)}, and the sub-files in the incremental sub-file set correspond one-to-one to the sub-files in the incremental sub-file list.
[0099] In this optional embodiment, matching the first sub-file set and the incremental sub-file set to obtain the incremental sub-file pair of the target branch includes:
[0100] Select any incremental sub-file in the incremental sub-file set as the target sub-file;
[0101] Obtaining a matching result based on matching the target subfile with all subfiles in the first subfile set, wherein the matching result includes a matching success and a matching failure;
[0102] If the match is successful, the target subfile and the subfile with a matching relationship are taken as a set of incremental subfile pairs;
[0103] If the match fails, an empty file and the target sub-file are generated as a set of incremental sub-file pairs;
[0104] All incremental sub-files in the incremental sub-file set are traversed to obtain the incremental sub-file pairs of the target branch.
[0105] In this optional embodiment, the first subfile set is: {file4(1), file5(1)}, and the incremental subfile set is: {file1(2), file2(2), file4(2), file5(2)}. An incremental subfile file1(2) is randomly selected from the incremental subfile set as the target subfile, where file1 is the name of the incremental subfile, and (2) indicates that the subfile is located in the incremental subfile set; further, all subfiles in the first subfile set are matched with the name file1 as a template. If there are subfiles with the same name in the first subfile set, the match is successful, and the target subfile is matched with the subfiles with the same name in the first subfile set. The above two files are used as a set of incremental subfile pairs. If there are no subfiles with the same name in the first subfile set, the match fails, and a blank file is automatically generated to form a set of incremental subfile pairs with the target subfile. Then, a set of incremental subfile pairs can be obtained: #-file1(2), where # is an automatically generated blank file.
[0106] In this optional embodiment, all incremental sub-files in the incremental sub-file set are traversed to complete the construction of incremental sub-file pairs, and a total of 4 incremental sub-file pairs are obtained: #-file1(2), #-file2(2), file4(1)-file4(2), file5(1)-file5(2), and the incremental sub-file pairs correspond one-to-one to the number of incremental sub-files in the incremental file list.
[0107] In this way, the incremental sub-file pair corresponding to each incremental sub-file can be obtained to provide data for subsequent incremental checks.
[0108] S13: Create an inspection item of the target branch based on the ID information of the target branch.
[0109] In an optional embodiment, a check project is created in a static code quality scanning tool, and the check project is named with "project name_target branch ID" as a unique identifier. An independent check project is created for each target branch to ensure that the scans and checks between different branches are independent of each other. The static code quality scanning tool selected in this embodiment is Sonarqube. Among them, Sonarqube is a static code quality scanning tool widely used in continuous integration, which can automatically scan, discover and display common bugs, code specification problems, etc. in the code, discover problems in the code early, and thus improve the code quality.
[0110] In this way, a separate inspection project can be created for each target branch to ensure that the incremental inspections of each branch do not affect each other, thereby achieving independence between the branches.
[0111] S14, performing an incremental check on the incremental sub-file pairs of the target branch based on the check items of the target branch to obtain an incremental check result.
[0112] In an optional embodiment, performing an incremental check on the incremental sub-file pair of the target branch based on the check item of the target branch to obtain the incremental check result includes:
[0113] Preprocessing the subfiles of the incremental subfile pair according to code types, wherein the code types include compiled languages and non-compiled languages;
[0114] Send the preprocessed sub-files to the inspection project to obtain inspection results of two sub-files in each set of incremental sub-file pairs;
[0115] The code increment value is obtained by calculating the absolute value of the difference between the inspection results of two sub-files in the same group of incremental sub-file pairs;
[0116] The code increment value of each group of incremental sub-file pairs is counted as the incremental check result.
[0117] In this optional embodiment, the code type of the subfile in the incremental subfile pair is determined based on a preset compiled language set, and the code type includes compiled languages and non-compiled languages; if the development code used by the subfile is in the compiled language set, the code type is determined to be a compiled language, the subfile in the incremental subfile pair is compiled, the compiled subfile is sent to the inspection item of the target branch, and the inspection result of each subfile is output; if the development code used by the subfile is not in the compiled language set, the code type is determined to be a non-compiled language, and the subfile in the incremental subfile pair is directly sent to the inspection item of the target branch, and the inspection result of each subfile is output, and the inspection result includes the number of bugs in each subfile. Wherein, the compiled language refers to a programming language that requires code to be compiled into a machine language before executing the code, and the preset compiled language set is {C, C++}.
[0118] In this optional embodiment, the inspection results of all sub-files are obtained, and the inspection results of two sub-files in the same group of incremental sub-files are further subtracted to obtain a difference, and the absolute value of the difference is taken to obtain the code incremental value of the current incremental sub-file pair, and the code incremental values of all incremental sub-file pairs are counted as the incremental inspection result. The incremental inspection result is a sequence, and each code incremental value in the sequence corresponds one-to-one to an incremental sub-file pair, and the incremental sub-file pair corresponds one-to-one to the incremental sub-file. Therefore, the incremental inspection result can reflect the number of new bugs in each incremental sub-file in the target branch i.
[0119] In this way, the incremental inspection results of the target branch can be obtained. The incremental inspection only scans the incremental sub-files, reducing the number of scanned files. The changes in code problems in the incremental sub-files can be quickly obtained, thereby improving the efficiency of code quality inspection.
[0120] S15, modifying the new code file based on the incremental check result to obtain a correct code file.
[0121] In an optional embodiment, modifying the new code file based on the incremental check result to obtain the correct code file includes:
[0122] Extracting an error sub-file set in the incremental sub-file list based on the incremental check result;
[0123] The developer modifies the sub-file of the error sub-file set to obtain a modified sub-file set;
[0124] The modified sub-file set is taken as the new code file, and the incremental check process is repeatedly performed to obtain the latest incremental check result, until the number of sub-files in the erroneous sub-file set corresponding to the latest incremental check result is zero, thereby obtaining the correct code file.
[0125] In an optional embodiment, extracting the set of error sub-files in the incremental sub-file list based on the incremental check result includes:
[0126] Get the code increment value of each group of incremental sub-file pairs;
[0127] If the code increment value is 0, it means that there is no new code problem in the incremental subfile of the corresponding incremental subfile pair, and the incremental subfile is a correct subfile;
[0128] If the code increment value is not 0, it means that there is a new code problem in the incremental subfile of the corresponding incremental subfile pair, and the incremental subfile is an error subfile;
[0129] All error sub-files are stored to obtain an error sub-file collection.
[0130] In this optional embodiment, the incremental check result includes the code incremental value of each group of incremental sub-file pairs, determines whether the code incremental value is 0, and stores the incremental sub-files in the incremental sub-file pairs whose code incremental values are not 0 to obtain an error sub-file set.
[0131] In this optional embodiment, the developer only needs to modify the sub-files in the erroneous sub-file set, use the modified files as the new code files, and repeat the incremental check process to obtain the latest incremental check results, until the number of sub-files in the erroneous sub-file set corresponding to the latest incremental check results is zero, indicating that all new bugs in the sub-files in the new code file are 0, and the new code file on the temporary branch is the correct code file.
[0132] In this way, the file contents in the incremental file list are selectively read according to the incremental inspection results, and the code files without new quality problems are not read, thereby improving the efficiency of code quality inspection.
[0133] See also Figure 3 , Figure 3 It is a functional module diagram of a preferred embodiment of the multi-branch incremental inspection device based on artificial intelligence of the present application. The multi-branch incremental inspection device based on artificial intelligence 11 includes a response unit 110, a comparison unit 111, a matching unit 112, a creation unit 113, an inspection unit 114, and a modification unit 115. The module / unit referred to in the present application refers to a series of computer-readable instruction segments that can be executed by the processor 13 and can complete fixed functions, which are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0134] In an optional embodiment, the response unit 110 is used to respond to a code merge request to obtain an incremental check signal when a submitted new code file requests to be merged with a branch code file of the code repository, wherein the incremental check signal includes ID information corresponding to the branch participating in the code merge in the code repository, and the code merge request includes ID information of the branch corresponding to the new code file.
[0135] In an optional embodiment, during the project development process, all code files related to the project will be stored in a code repository. There are multiple branches in the code repository, and each branch stores corresponding code files. The number of branches in the code repository is related to the project tasks. In order to distinguish different branches, the code repository assigns an ID information to each branch. The ID information can be numbers, letters, or symbols, which is not limited in this solution.
[0136] In this optional embodiment, the developer can select a branch to be developed from the code repository with the help of the project management software according to the project development requirements, and copy the original code file in the branch to be developed to his local computer to form a temporary branch. At the same time, the ID of the branch to be developed is extracted to the temporary branch to facilitate the rapid location of the target branch corresponding to the new code file when merging codes later. The developer can develop the original code file on the temporary branch to obtain the new code file. After the development task is completed, the new code file can be uploaded to the code repository with the help of the project management software, and the new code file on the temporary branch is merged with the original code file on the branch to be developed to complete the development task. The flow chart of the development task is shown as follows Figure 2 The project management software may be Gitlab, which is an open source application that can implement a self-hosted Git project code repository, access public or private projects through a Web interface, browse source code, and manage defects and comments.
[0137] In this optional embodiment, in the code repository, there will be multiple branches to be developed at the same time point for code merging operations, and each branch to be developed corresponds to its own original code file and new code file. The original code file is stored in the branch to be developed, and the new code file is stored in the temporary branch corresponding to the branch to be developed.
[0138] When a developer submits a new code file, a pre-configured hook function will be triggered before the new code file is merged with the original code file of the corresponding branch. The output result of the hook function is the incremental check signal, which includes the ID information of all branches participating in the code merge in the code repository at the same time node.
[0139] In an optional embodiment, the comparison unit 111 is used to select the same ID information as that in the code merge request from the incremental check signal, take the branch corresponding to the ID information as the target branch, and compare the original code file and the new code file of the target branch to obtain an incremental sub-file list, wherein the original code file and the new code file of the target branch include multiple sub-files.
[0140] In an optional embodiment, after receiving the code merge request, it is necessary to check all branches included in the incremental check signal according to the code merge request, and retrieve the branch that is consistent with the ID information corresponding to the new code file in the code merge request as the target branch. It should be noted that since the operations between different branches are independent of each other, the code merge request includes at least one new code file to be merged, and this embodiment selects a branch corresponding to the ID information as the target branch, and all operations of other branches are the same as the target branch.
[0141] In this optional embodiment, the step of comparing the original code file and the new code file of the target branch to obtain an incremental sub-file list includes:
[0142] Extracting the original code file and the new code file of the target branch according to the ID information of the target branch;
[0143] Comparing the original code file of the target branch with the sub-files in the new code file to obtain a changed sub-file list, wherein the changed sub-file list includes three change states: added file, deleted file, and modified file;
[0144] The changed sub-file list is filtered based on the change status to obtain the incremental sub-file list.
[0145] In this optional embodiment, the original code file is a code file stored on the target branch before the developer develops the code, and both the original code file and the new code file contain multiple sub-files.
[0146] In this optional embodiment, the git diff function is used to compare the subfiles in the original code file and the new code file to obtain a list of changed subfiles, the list of changed subfiles includes the change status and the corresponding subfile name, the change status includes three types: addition, deletion, and modification, and the corresponding status is represented by the characters A, D, and M respectively, and the column corresponding to the deletion status in the list of changed subfiles is further discarded to obtain an incremental subfile list, and the incremental subfile list includes multiple incremental subfiles. Among them, the git diff function can compare the differences between code texts in different branches, different regions, and different submission records in the code repository.
[0147] Exemplarily, the ID information of the target branch is recorded as i, and the temporary branch corresponding to the target branch i is recorded as i * , the temporary branch i * Compare the new code file on the target branch i with the original code file on the target branch i by executing the following command:
[0148] "git diff --name-status ii * ”
[0149] That is, the changed sub-file list can be automatically obtained:
[0150] A: file1, file2;
[0151] D: file3;
[0152] M: file4, file5;
[0153] From the above changed sub-file list, we can know that two sub-files, file1 and file2, are added to the new code file, one sub-file, file3, is deleted from the original code file, and two sub-files, file4 and file5, are modified in the original code file. By discarding the corresponding columns of the deletion, we can get the incremental sub-file list, which includes 4 incremental sub-files:
[0154] A: file1, file2;
[0155] M: file4, file5;
[0156] In this optional embodiment, the incremental sub-file list corresponding to each branch can be obtained according to the target branch method based on each new code file in the code merge request for the corresponding branch in the incremental check signal.
[0157] In an optional embodiment, the matching unit 112 is used to match the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct an incremental sub-file pair of the target branch, and the incremental sub-file pair corresponds one-to-one to the incremental sub-file.
[0158] In an optional embodiment, matching the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct the incremental sub-file pair of the target branch includes:
[0159] Filter the original code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to obtain a first sub-file set;
[0160] Filter the new code files of the target branch based on the names of the incremental sub-files in the incremental sub-file list to obtain an incremental sub-file set;
[0161] The first sub-file set and the incremental sub-file set are matched to obtain the incremental sub-file pair of the target branch.
[0162] In an optional embodiment, based on the name of the incremental subfile in the incremental subfile list, the subfile corresponding to the name is queried from the original code file of the target branch according to the intelligent search, and the subfile that can be queried is used as the first subfile set; based on the name of the incremental subfile, the corresponding subfile is extracted from the new code file of the temporary branch in the same way to form an incremental subfile set, and the subfiles of the incremental subfile set correspond to the subfiles in the incremental subfile list one by one. Among them, the intelligent search is a new generation of search engine combined with artificial intelligence technology, which can provide functions such as fast retrieval, information filtering and push.
[0163] Exemplarily, the incremental sub-file list is:
[0164] A: file1, file2;
[0165] M: file4, file5;
[0166] Then the first sub-file set is: {file4(1), file5(1)}, the incremental sub-file set is: {file1(2), file2(2), file4(2), file5(2)}, and the sub-files in the incremental sub-file set correspond one-to-one to the sub-files in the incremental sub-file list.
[0167] In this optional embodiment, matching the first sub-file set and the incremental sub-file set to obtain the incremental sub-file pair of the target branch includes:
[0168] Select any incremental sub-file in the incremental sub-file set as the target sub-file;
[0169] Obtaining a matching result based on matching the target subfile with all subfiles in the first subfile set, wherein the matching result includes a matching success and a matching failure;
[0170] If the match is successful, the target subfile and the subfile with a matching relationship are taken as a set of incremental subfile pairs;
[0171] If the match fails, an empty file and the target sub-file are generated as a set of incremental sub-file pairs;
[0172] All incremental sub-files in the incremental sub-file set are traversed to obtain the incremental sub-file pairs of the target branch.
[0173] In this optional embodiment, the first subfile set is: {file4(1), file5(1)}, and the incremental subfile set is: {file1(2), file2(2), file4(2), file5(2)}. An incremental subfile file1(2) is randomly selected from the incremental subfile set as the target subfile, where file1 is the name of the incremental subfile, and (2) indicates that the subfile is located in the incremental subfile set; further, all subfiles in the first subfile set are matched using the name file1 as a template. If there are subfiles with the same name in the first subfile set, the match is successful, and the target subfile is matched with the subfiles with the same name in the first subfile set. The above two files are used as a set of incremental subfile pairs. If there are no subfiles with the same name in the first subfile set, the match fails, and a blank file is automatically generated to form a set of incremental subfile pairs with the target subfile. Then, a set of incremental subfile pairs can be obtained: #-file1(2), where # is an automatically generated blank file.
[0174] In this optional embodiment, all incremental sub-files in the incremental sub-file set are traversed to complete the construction of incremental sub-file pairs, and a total of 4 incremental sub-file pairs are obtained: #-file1(2), #-file2(2), file4(1)-file4(2), file5(1)-file5(2), and the incremental sub-file pairs correspond one-to-one to the number of incremental sub-files in the incremental file list.
[0175] In an optional embodiment, the creating unit 113 is configured to create an inspection item of the target branch based on the ID information of the target branch.
[0176] In an optional embodiment, a check project is created in a static code quality scanning tool, and the check project is named with "project name_target branch ID" as a unique identifier. An independent check project is created for each target branch to ensure that the scans and checks between different branches are independent of each other. The static code quality scanning tool selected in this embodiment is Sonarqube. Among them, Sonarqube is a static code quality scanning tool widely used in continuous integration, which can automatically scan, discover and display common bugs, code specification problems, etc. in the code, discover problems in the code early, and thus improve the code quality.
[0177] In an optional embodiment, the checking unit 114 is configured to perform an incremental check on the incremental sub-file pairs of the target branch based on the check items of the target branch to obtain an incremental check result.
[0178] In an optional embodiment, performing an incremental check on the incremental sub-file pair of the target branch based on the check item of the target branch to obtain the incremental check result includes:
[0179] Preprocessing the subfiles of the incremental subfile pair according to code types, wherein the code types include compiled languages and non-compiled languages;
[0180] Send the preprocessed sub-files to the inspection project to obtain inspection results of two sub-files in each set of incremental sub-file pairs;
[0181] The code increment value is obtained by calculating the absolute value of the difference between the inspection results of two sub-files in the same group of incremental sub-file pairs;
[0182] The code increment value of each group of incremental sub-file pairs is counted as the incremental check result.
[0183] In this optional embodiment, the code type of the subfile in the incremental subfile pair is determined based on a preset compiled language set, and the code type includes compiled languages and non-compiled languages; if the development code used by the subfile is in the compiled language set, the code type is determined to be a compiled language, the subfile in the incremental subfile pair is compiled, the compiled subfile is sent to the inspection item of the target branch, and the inspection result of each subfile is output; if the development code used by the subfile is not in the compiled language set, the code type is determined to be a non-compiled language, and the subfile in the incremental subfile pair is directly sent to the inspection item of the target branch, and the inspection result of each subfile is output, and the inspection result includes the number of bugs in each subfile. Wherein, the compiled language refers to a programming language that requires code to be compiled into a machine language before executing the code, and the preset compiled language set is {C, C++}.
[0184] In this optional embodiment, the inspection results of all sub-files are obtained, and the inspection results of two sub-files in the same group of incremental sub-files are further subtracted to obtain a difference, and the absolute value of the difference is taken to obtain the code incremental value of the current incremental sub-file pair, and the code incremental values of all incremental sub-file pairs are counted as the incremental inspection result. The incremental inspection result is a sequence, and each code incremental value in the sequence corresponds one-to-one to an incremental sub-file pair, and the incremental sub-file pair corresponds one-to-one to the incremental sub-file. Therefore, the incremental inspection result can reflect the number of new bugs in each incremental sub-file in the target branch i.
[0185] In an optional embodiment, the modifying unit 115 modifies the new code file based on the incremental checking result to obtain a correct code file.
[0186] In an optional embodiment, modifying the new code file based on the incremental check result to obtain the correct code file includes:
[0187] Extracting an error sub-file set in the incremental sub-file list based on the incremental check result;
[0188] The developer modifies the sub-file of the error sub-file set to obtain a modified sub-file set;
[0189] The modified sub-file set is taken as the new code file, and the incremental check process is repeatedly performed to obtain the latest incremental check result, until the number of sub-files in the erroneous sub-file set corresponding to the latest incremental check result is zero, thereby obtaining the correct code file.
[0190] In an optional embodiment, extracting the set of error sub-files in the incremental sub-file list based on the incremental check result includes:
[0191] Get the code increment value of each group of incremental sub-file pairs;
[0192] If the code increment value is 0, it means that there is no new code problem in the incremental subfile of the corresponding incremental subfile pair, and the incremental subfile is a correct subfile;
[0193] If the code increment value is not 0, it means that there is a new code problem in the incremental subfile of the corresponding incremental subfile pair, and the incremental subfile is an error subfile;
[0194] All error sub-files are stored to obtain an error sub-file collection.
[0195] In this optional embodiment, the incremental check result includes the code incremental value of each group of incremental sub-file pairs, determines whether the code incremental value is 0, and stores the incremental sub-files in the incremental sub-file pairs whose code incremental values are not 0 to obtain an error sub-file set.
[0196] In this optional embodiment, the developer only needs to modify the sub-files in the erroneous sub-file set, use the modified files as the new code files, and repeat the incremental check process to obtain the latest incremental check results, until the number of sub-files in the erroneous sub-file set corresponding to the latest incremental check results is zero, indicating that all new bugs in the sub-files in the new code file are 0, and the new code file on the temporary branch is the correct code file.
[0197] It can be seen from the above technical solution that the present application compares the new code file submitted by the developer with the original code file of the corresponding branch to obtain the incremental sub-file, and then uses the quality scanning tool to check only the incremental sub-file of each branch to complete the code inspection, thereby reducing the number of inspection files and greatly improving the speed of code inspection while ensuring that the inspection results of each branch are independent of each other.
[0198] See also Figure 4 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 1 includes a memory 12 and a processor 13. The memory 12 is used to store computer-readable instructions, and the processor 13 is used to execute the computer-readable instructions stored in the memory to implement the multi-branch incremental inspection method based on artificial intelligence described in any of the above embodiments.
[0199] In an optional embodiment, the electronic device 1 further includes a bus, a computer program stored in the memory 12 and executable on the processor 13, such as a multi-branch incremental checking program based on artificial intelligence.
[0200] Figure 4 Only the electronic device 1 having the memory 12 and the processor 13 is shown, and those skilled in the art can understand that Figure 4 The structure shown does not constitute a limitation on the electronic device 1 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0201] Combination Figure 1 The memory 12 in the electronic device 1 stores a plurality of computer-readable instructions to implement a multi-branch incremental inspection method based on artificial intelligence, and the processor 13 can execute the plurality of instructions to implement:
[0202] When a submitted new code file requests to be merged with a branch code file of the code repository, respond to the code merge request to obtain an incremental check signal, wherein the incremental check signal includes the ID information corresponding to the branch participating in the code merge in the code repository, and the code merge request includes the ID information of the branch corresponding to the new code file;
[0203] Selecting the same ID information as that in the code merge request from the incremental check signal, taking the branch corresponding to the ID information as the target branch, and comparing the original code file and the new code file of the target branch to obtain an incremental sub-file list, wherein the original code file and the new code file of the target branch include multiple sub-files;
[0204] Matching the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct an incremental sub-file pair of the target branch, wherein the incremental sub-file pair corresponds to the incremental sub-file one by one;
[0205] Creating an inspection item of the target branch based on the ID information of the target branch;
[0206] Performing incremental check on the incremental sub-file pairs of the target branch based on the check items of the target branch to obtain incremental check results;
[0207] The new code file is modified based on the incremental checking result to obtain a correct code file.
[0208] Specifically, the specific implementation method of the processor 13 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0209] Those skilled in the art will appreciate that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation on the electronic device 1. The electronic device 1 may be a bus structure or a star structure. The electronic device 1 may also include more or less other hardware or software than shown in the diagram, or a different arrangement of components. For example, the electronic device 1 may also include input and output devices, network access devices, etc.
[0210] It should be noted that the electronic device 1 is only an example, and other existing or future electronic products that are suitable for the present application should also be included in the protection scope of the present application and included here by reference.
[0211] Among them, the memory 12 includes at least one type of readable storage medium, and the readable storage medium can be non-volatile or volatile. The readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 12 can also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. The memory 12 can not only be used to store application software and various types of data installed on the electronic device 1, such as the code of a multi-branch incremental inspection program based on artificial intelligence, but can also be used to temporarily store data that has been output or is to be output.
[0212] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The processor 13 is the control core (Control Unit) of the electronic device 1, and uses various interfaces and lines to connect the various components of the entire electronic device 1, and executes or executes programs or modules stored in the memory 12 (for example, executing a multi-branch incremental inspection program based on artificial intelligence, etc.), and calls the data stored in the memory 12 to execute various functions of the electronic device 1 and process data.
[0213] The processor 13 executes the operating system of the electronic device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the above-mentioned embodiments of the multi-branch incremental inspection method based on artificial intelligence, for example Figure 1 Steps shown.
[0214] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a response unit 110, a comparison unit 111, a matching unit 112, a creation unit 113, a check unit 114, and a modification unit 115.
[0215] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to execute a part of the multi-branch incremental inspection method based on artificial intelligence described in each embodiment of the present application.
[0216] If the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware devices to complete through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented.
[0217] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory and other memory, etc.
[0218] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0219] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0220] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. Figure 4 Only one arrow is used in the figure, but it does not mean that there is only one bus or one type of bus. The bus is configured to realize the connection and communication between the memory 12 and at least one processor 13, etc.
[0221] An embodiment of the present application also provides a computer-readable storage medium (not shown), in which computer-readable storage medium is stored computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the artificial intelligence-based multi-branch incremental inspection method described in any of the above embodiments.
[0222] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0223] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0224] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0225] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the specification can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.
[0226] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.
Claims
1. A multi-branch incremental inspection method based on artificial intelligence, characterized in that: The method comprises: When a submitted new code file requests to be merged with a branch code file of the code repository, respond to the code merge request to obtain an incremental check signal, wherein the incremental check signal includes the ID information corresponding to the branch participating in the code merge in the code repository, and the code merge request includes the ID information of the branch corresponding to the new code file; Selecting the same ID information as that in the code merge request from the incremental check signal, taking the branch corresponding to the ID information as the target branch, and comparing the original code file and the new code file of the target branch to obtain an incremental sub-file list, wherein the original code file and the new code file of the target branch include multiple sub-files; Matching the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct an incremental sub-file pair of the target branch, wherein the incremental sub-file pair corresponds to the incremental sub-file one by one; Creating an inspection item of the target branch based on the ID information of the target branch; Performing incremental check on the incremental sub-file pairs of the target branch based on the check items of the target branch to obtain incremental check results; The new code file is modified based on the incremental checking result to obtain a correct code file.
2. The multi-branch incremental inspection method based on artificial intelligence as claimed in claim 1, characterized in that: The step of comparing the original code file and the new code file of the target branch to obtain an incremental sub-file list includes: Extracting the original code file and the new code file of the target branch according to the ID information of the target branch; Comparing the original code file of the target branch with the sub-files in the new code file to obtain a changed sub-file list, wherein the changed sub-file list includes three change states: added file, deleted file, and modified file; The changed sub-file list is filtered based on the change status to obtain the incremental sub-file list.
3. The multi-branch incremental inspection method based on artificial intelligence as claimed in claim 1, characterized in that: The incremental sub-file pair matching the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct the target branch includes: Filter the original code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to obtain a first sub-file set; Filter the new code files of the target branch based on the names of the incremental sub-files in the incremental sub-file list to obtain an incremental sub-file set; The first sub-file set and the incremental sub-file set are matched to obtain the incremental sub-file pair of the target branch.
4. The artificial intelligence-based multi-branch incremental inspection method according to claim 3, characterized in that: The matching of the first sub-file set and the incremental sub-file set to obtain the incremental sub-file pair of the target branch includes: Select any incremental sub-file in the incremental sub-file set as the target sub-file; Obtaining a matching result based on matching the target subfile with all subfiles in the first subfile set, wherein the matching result includes a matching success and a matching failure; If the match is successful, the target subfile and the subfile with a matching relationship are taken as a set of incremental subfile pairs; If the match fails, an empty file and the target sub-file are generated as a set of incremental sub-file pairs; All incremental sub-files in the incremental sub-file set are traversed to obtain the incremental sub-file pairs of the target branch.
5. The multi-branch incremental inspection method based on artificial intelligence as claimed in claim 1, characterized in that: The step of performing an incremental check on the incremental sub-file pair of the target branch based on the check item of the target branch to obtain an incremental check result includes: Preprocessing the sub-files in the incremental sub-file pair according to code types, wherein the code types include compiled languages and non-compiled languages; Send the preprocessed sub-files to the inspection project to obtain inspection results of two sub-files in each set of incremental sub-file pairs; The code increment value is obtained by calculating the absolute value of the difference between the inspection results of two sub-files in the same group of incremental sub-file pairs; The code increment value of each group of incremental sub-file pairs is counted as the incremental check result.
6. The artificial intelligence-based multi-branch incremental inspection method according to claim 1, characterized in that: The modifying the new code file based on the incremental check result to obtain a correct code file comprises: Extracting an error sub-file set in the incremental sub-file list based on the incremental check result; The developer modifies the sub-file of the error sub-file set to obtain a modified sub-file set; The modified sub-file set is taken as the new code file, and the incremental check process is repeatedly performed to obtain the latest incremental check result, until the number of sub-files in the erroneous sub-file set corresponding to the latest incremental check result is zero, thereby obtaining the correct code file.
7. The artificial intelligence-based multi-branch incremental inspection method according to claim 6, characterized in that: Extracting the set of error sub-files in the incremental sub-file list based on the incremental check result comprises: Get the code increment value of each group of incremental sub-file pairs; If the code increment value is 0, it means that there is no new code problem in the incremental subfile of the corresponding incremental subfile pair, and the incremental subfile is a correct subfile; If the code increment value is not 0, it means that there is a new code problem in the incremental subfile of the corresponding incremental subfile pair, and the incremental subfile is an error subfile; All error sub-files are stored to obtain an error sub-file collection.
8. A multi-branch incremental inspection device based on artificial intelligence, characterized in that: The device comprises: A response unit, configured to respond to a code merge request to obtain an incremental check signal when a submitted new code file requests to be merged with a branch code file of a code repository, wherein the incremental check signal includes ID information corresponding to a branch in the code repository that participates in the code merge, and the code merge request includes ID information of a branch corresponding to the new code file; a comparison unit, configured to select the same ID information as that in the code merge request from the incremental check signal, take the branch corresponding to the ID information as the target branch, and compare the original code file and the new code file of the target branch to obtain an incremental sub-file list, wherein the original code file and the new code file of the target branch include multiple sub-files; A matching unit, configured to match the original code file and the new code file of the target branch based on the name of the incremental sub-file in the incremental sub-file list to construct an incremental sub-file pair of the target branch; A creating unit, used for creating an inspection item of a target branch based on the ID information of the target branch; A checking unit, configured to perform an incremental check on the incremental sub-file pairs of the target branch based on the check items of the target branch to obtain an incremental check result; A modification unit is configured to modify the new code file based on the incremental checking result to obtain a correct code file.
9. An electronic device, characterized in that: The electronic device comprises: a memory storing computer-readable instructions; and A processor executes computer-readable instructions stored in the memory to implement the artificial intelligence-based multi-branch incremental inspection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the artificial intelligence-based multi-branch incremental inspection method as described in any one of claims 1 to 7.
