Code risk determination method and device, equipment and storage medium

By storing and utilizing the modification information of the modified code, the risk value of the second modified code is determined, and the problem of low efficiency in the modification code risk assessment in the prior art is solved, and efficient and accurate risk assessment is achieved.

CN119441011APending Publication Date: 2025-02-14GUANGZHOU KUGOU COMP TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411556160.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, the risk assessment of modified code is less efficient and mainly relies on manual empirical analysis.

Method used

By storing the modification information corresponding to the first modification code in the code set, and combining the second modification code, the risk value of the second modification code is determined based on the modification information, and the risk is evaluated using the modification information of the target code.

Benefits of technology

It realizes accurate and efficient risk assessment of modified code, reduces dependence on manual empirical analysis, and improves evaluation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441011A_ABST
    Figure CN119441011A_ABST
Patent Text Reader

Abstract

The invention discloses a code risk determination method and device, equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: storing modification information corresponding to a first modification code in a code set, wherein the first modification code comprises a code modified for solving a code defect; obtaining a second modification code corresponding to the code set, wherein the second modification code comprises a code modified by updating the version of the code set; and determining a risk value of the second modified code according to the modification information, wherein the risk value is used for reflecting the possibility that the second modified code has code defects. The first modified code comprises the code modified for solving the code defect, so that the risk value of the second modified code is determined by referring to the modification information corresponding to the first modified code, the risk of the second modified code can be assessed by referring to the code defect appearing in the past, and the process does not need to depend on artificial experience analysis; therefore, the efficiency of carrying out risk assessment on the modified code can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for determining code risks. Background Art

[0002] By modifying the code in the code set corresponding to the application, the version of the code set can be updated, thereby updating the version of the application.

[0003] In the process of modifying the code in the code set, code defects may be introduced into the code set, so it is necessary to perform risk assessment on the modified code modified by the updated code set to assess the possibility of code defects in the modified code. In the related art, risk assessment of modified code is usually performed based on manual experience analysis.

[0004] Performing risk assessment on code modification in the above manner has the problem of low efficiency. Summary of the invention

[0005] The present application provides a method, device, equipment and storage medium for determining code risk, which can improve the efficiency of risk assessment for modified code. The technical solution is as follows:

[0006] According to one aspect of the present application, a method for determining code risk is provided, the method comprising:

[0007] storing modification information corresponding to a first modification code in a code set, wherein the first modification code includes a code modified to solve a code defect;

[0008] Obtaining a second modification code corresponding to the code set, wherein the second modification code includes a code modified by updating a version of the code set;

[0009] A risk value of the second modified code is determined according to the modification information, where the risk value is used to reflect the possibility that the second modified code has the code defect.

[0010] According to another aspect of the present application, a device for determining code risk is provided, the device comprising:

[0011] A storage module, used to store modification information corresponding to a first modification code in a code set, wherein the first modification code includes a code modified to solve a code defect;

[0012] An acquisition module, configured to acquire a second modification code corresponding to the code set, wherein the second modification code includes a code modified by updating a version of the code set;

[0013] A determination module is used to determine a risk value of the second modified code according to the modification information, wherein the risk value is used to reflect the possibility that the second modified code has the code defect.

[0014] In an optional design, the modification information includes a first modification position corresponding to the first modification code; the determination module is used to determine the second modification position corresponding to the second modification code by parsing the second modification code; based on the stored modification information, determine the target code corresponding to the second modification code in the first modification code, the first modification position corresponding to the target code is the same as the second modification position; determine the risk value of the second modification code based on the target code.

[0015] In an optional design, the modification information also includes the modification time corresponding to the first modification code; the determination module is used to determine the time difference between the modification time corresponding to the target code and the target time, and the target time is the time for determining the risk value of the second modification code; according to the inverse of the time difference, the risk value of the second modification code is determined, and the risk value is positively correlated with the possibility that the second modification code contains the code defect.

[0016] In an optional design, the first modification location includes a first file path corresponding to the first modification code and a first modification device, the first file path is used to indicate the code file where the first modification code is located in the code set, and the first modification device is used to indicate the device modified by the first modification code;

[0017] The second modification location includes a second file path corresponding to the second modification code and a second modification device, the second file path is used to indicate the code file where the second modification code is located in the code set, and the second modification device is used to indicate the device modified by the second modification code.

[0018] In an optional design, the determination module is used to determine the risk value of the second modification code based on the product of the inverse of the time difference and a preset time length; wherein the preset time length is used to make the risk value fall within a preset value range.

[0019] In an optional design, the determination module is used to determine the risk value of the second modified code based on the sum of the inverses of time differences corresponding to different target codes in the multiple target codes when the second modified code corresponds to multiple target codes.

[0020] In an optional design, the device also includes: the determination module, used to determine the number of repetitions of the repeated defect code corresponding to the same code defect in the multiple segments of target code corresponding to the second modification code; the weighting module, used to weight the inverse of the time difference corresponding to the repeated defect code when the number of repetitions is greater than a number threshold, and the weighted weight is positively correlated with the number of repetitions.

[0021] In an optional design, the storage module is used to store the modification information corresponding to the first modification code through a knowledge database.

[0022] In an optional design, the modification information includes at least one of the following information:

[0023] a defect identifier of a code defect corresponding to the first modification code;

[0024] The modification time corresponding to the first modification code;

[0025] The modification position corresponding to the first modification code.

[0026] According to another aspect of the present application, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the method for determining code risk as described above.

[0027] According to another aspect of the present application, a computer-readable storage medium is provided, in which at least one program is stored. The at least one program is loaded and executed by a processor to implement the method for determining code risk as described above.

[0028] According to another aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the code risk determination method provided in various optional implementations of the above aspects.

[0029] The beneficial effects of the technical solution provided by this application include at least:

[0030] The risk value of the second modified code is determined by obtaining the version of the updated code set and modifying the code set, and combining the modification information corresponding to the pre-stored first modified code. Since the first modified code includes the code modified to solve the code defect, the risk value of the second modified code is determined by referring to the modification information corresponding to the first modified code, which can evaluate the risk of the second modified code with reference to the code defects that occurred in the past, and accurately perform risk assessment on the second modified code. Since the above-mentioned process of risk assessment on the second modified code does not need to rely on manual experience analysis, it can improve the efficiency of risk assessment on the modified code. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0032] Figure 1 is a schematic diagram of a process of determining code risk provided by an exemplary embodiment of the present application;

[0033] Figure 2 It is a flowchart of a method for determining code risk provided by an exemplary embodiment of the present application;

[0034] Figure 3 It is a flowchart of a method for determining code risk provided by an exemplary embodiment of the present application;

[0035] Figure 4 is a schematic diagram of a knowledge database provided by an exemplary embodiment of the present application;

[0036] Figure 5 is a schematic diagram of a process of determining a target code provided by an exemplary embodiment of the present application;

[0037] Figure 6 is a schematic diagram of a process of determining a risk value provided by an exemplary embodiment of the present application;

[0038] Figure 7 It is a structural schematic diagram of a device for determining code risk provided by an exemplary embodiment of the present application;

[0039] Figure 8 It is a structural schematic diagram of a device for determining code risk provided by an exemplary embodiment of the present application;

[0040] Fig. 9 It is a structural diagram of a computer device provided by an exemplary embodiment of the present application.

[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application. DETAILED DESCRIPTION

[0042] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0043] First, the names involved in the embodiments of the present application are introduced:

[0044] Code defects: Code defects refer to problems in the written code that do not meet expectations, do not meet specifications, cause software function anomalies, performance degradation, security vulnerabilities, etc. during the development process of a software development project. In some embodiments, code defects can be called bugs.

[0045] Exemplarily, code defects include at least one of grammatical errors, logical errors, performance defects, security defects, compatibility defects, readability and maintainability defects. Among them, grammatical errors are a basic code defect, such as missing necessary punctuation marks in the code, keyword spelling errors, undeclared variables, etc., and grammatical errors usually cause the code to fail to compile or run. For example, when using loop logic, the loop condition is incorrectly set in the code, resulting in the loop logic failing to end normally or entering an infinite loop. Logical errors refer to the execution logic of the code not meeting expectations, such as improper algorithm selection, conditional judgment errors, or unreasonable process control. For example, when dealing with a combination of multiple conditions, all possible situations are not taken into account, resulting in some situations being omitted in the code. Performance defects refer to the inefficient execution of the code, consuming too many resources, such as memory, central processing unit (CPU) time, etc. For example, when the code involves frequent operations on a large amount of data, no appropriate data structure and algorithm are used, resulting in a slow processing speed. Security defects are security issues that may cause software developed by software development projects to be attacked, data leaks, etc. For example, when processing user input, insufficient validation and filtering may lead to Structured Query Language (SQL) injection, cross-site scripting attacks, etc. Compatibility defects refer to problems where the code cannot run properly under different operating systems, browsers, hardware environments, etc. For example, the code runs normally on a Windows system (one operating system), but there are problems when running on a Linux system (another operating system), causing it to not run properly. Readability and maintainability defects refer to code that is difficult to understand or maintain, which is not conducive to subsequent development and modification. For example, the naming of variables and functions in the code is unclear, the code structure is chaotic, and there are no appropriate comments.

[0046] Code management tools: Code management tools are software applications used to help developers organize, store, track, and collaborate on code efficiently.

[0047] Exemplarily, code management tools include the following functions: (1) Version control: Code management tools allow developers to track the history of code changes and easily roll back to any previous version. This helps resolve code conflicts that may arise during multi-person collaborative development. (2) Team collaboration: Code management tools can facilitate code sharing and communication among development team members. They also support setting different permissions to ensure that only authorized personnel can perform corresponding operations. (3) Branch management: Code management tools can be used to create multiple branches for code to develop different functions or make experimental modifications without affecting the stability of the main branch. (4) Code merging: When the branch development is completed, the code management tool can be used to merge the branch code into the main branch or other branches. (5) Code review: The code review function provided by the code management tool can facilitate development team members to evaluate the code of others and make improvement suggestions.

[0048] Figure 1 FIG. 1 is a schematic diagram of a process for determining code risk provided by an exemplary embodiment of the present application. Figure 1 As shown, by resolving the code defect, the computer device will store the modification information 102 corresponding to the first modification code in the code set 101 through the knowledge database, and the first modification code includes the code modified to resolve the code defect. The modification information 102 includes at least one of the defect identifier of the code defect corresponding to the first modification code, the modification time corresponding to the first modification code, and the first modification position corresponding to the first modification code. Optionally, the first modification position includes at least one of the first file path and the first modification method corresponding to the first modification code. Among them, the first file path is used to indicate the code file where the first modification code is located in the code set 101, and the first modification method is used to indicate the method of modifying the first modification code. Optionally, the knowledge database stores one or more segments of modification information 102 corresponding to the first modification code. For example, by resolving the code defect multiple times, the computer device can store the modification information 102 corresponding to the first modification code corresponding to each solution of the code defect in the knowledge database.

[0049] By performing a version update on the code set 101, the computer device will obtain the second modification code corresponding to the code set 101, and the second modification code includes the code modified by the version of the updated code set 101. The computer device can determine the second modification position 103 corresponding to the second modification code by parsing the second modification code, and thereby determine the target code corresponding to the second modification code in the first modification code in combination with the modification information 102 stored in the knowledge database, the first modification position corresponding to the target code is the same as the second modification position 103, and the target code includes one or more segments of the first modification code. Optionally, the second modification position 103 includes a second file path and a second modification method corresponding to the second modification code, the second file path is used to indicate the code file where the second modification code is located in the code set 101, and the second modification method is used to indicate the method of modifying the second modification code. After determining the target code, the computer device will determine the time difference between the modification time corresponding to the target code and the target time according to the modification information 102 of the target code, and thereby determine the risk value 104 of the second modification code according to the inverse of the time difference. The target time is the time for determining the risk value 104 of the second modification code, and the risk value 104 is positively correlated with the possibility that the second modification code has a code defect. In some embodiments, when the second modified code corresponds to multiple target codes (first modified code), the computer device determines the risk value 104 of the second modified code according to the sum of the inverses of the time differences corresponding to the different target codes.

[0050] The risk value of the second modified code is determined by obtaining the version of the updated code set and modifying the code set, and combining the modification information corresponding to the pre-stored first modified code. Since the first modified code includes the code modified to solve the code defect, the risk value of the second modified code is determined by referring to the modification information corresponding to the first modified code, which can evaluate the risk of the second modified code with reference to the code defects that occurred in the past, and accurately perform risk assessment on the second modified code. Since the above-mentioned process of risk assessment on the second modified code does not need to rely on manual experience analysis, it can improve the efficiency of risk assessment on the modified code.

[0051] Figure 2 FIG. 1 is a flow chart of a method for determining code risk provided by an exemplary embodiment of the present application. The method can be used on a computer device or a client on a computer device. Figure 2 As shown, the method includes:

[0052] Step 202: store modification information corresponding to the first modification code in the code set.

[0053] A code set is a set formed by all codes belonging to the same software development project. A code set includes one or more code files, and the codes in the code files belong to the same software development project. In some embodiments, the software development project corresponding to the code set is used to develop applications, such as music applications, live broadcast applications, video applications, etc. The embodiments of the present application do not limit the type of application. In this case, the code set is a set formed by the codes used to develop the application. Through the codes in the code set, it is possible to define / provide the functions corresponding to the application.

[0054] The first modified code includes the code modified to solve the code defect, that is, the first modified code includes the code involved in the modification when solving the code defect, and the first modified code includes one or more code segments. Code defects refer to the problems that do not meet expectations, do not meet specifications, cause software function abnormalities, performance degradation, security vulnerabilities, etc. in the written code during the development process of the software development project. The embodiments of the present application do not limit the type of code defects. In some embodiments, the code defect can be called a bug. In some embodiments, the code defect is solved by manually modifying the code, and the first modified code is obtained by manually modifying the code in the code set.

[0055] Exemplarily, code defects include at least one of grammatical errors, logical errors, performance defects, security defects, compatibility defects, readability and maintainability defects. Among them, grammatical errors are a basic code defect, such as missing necessary punctuation marks in the code, misspelling of keywords, undeclared variables, etc. Syntax errors usually cause the code to fail to compile or run. For example, when using loop logic, the loop condition is incorrectly set in the code, resulting in the loop logic failing to end normally or entering an infinite loop. Logical errors refer to the execution logic of the code not meeting expectations, such as improper algorithm selection, incorrect condition judgment, or unreasonable process control. For example, when dealing with a combination of multiple conditions, all possible situations are not considered, resulting in some situations being omitted in the code. Performance defects refer to the inefficient execution of the code, consuming too many resources, such as memory, CPU time, etc. For example, when the code involves frequent operations on a large amount of data, no appropriate data structure and algorithm are used, resulting in slow processing speed. Security defects are security issues that may cause software developed by software development projects to be attacked, data leaks, etc. For example, when processing user input, there is no sufficient verification and filtering, which may lead to SQL injection, cross-site scripting attacks, etc. Compatibility defects refer to problems where the code cannot run properly under different operating systems, browsers, hardware environments, etc. For example, the code runs normally on a Windows system (one operating system), but there are problems when running on a Linux system (another operating system), causing it to not run properly. Readability and maintainability defects refer to code that is difficult to understand or maintain, which is not conducive to subsequent development and modification. For example, the variables and functions in the code are not clearly named, the code structure is chaotic, and there are no appropriate comments.

[0056] Optionally, the modification information corresponding to the first modification code includes at least one of the following information:

[0057] · A defect identifier of a code defect corresponding to the first modification code;

[0058] The modification time corresponding to the first modification code;

[0059] The modification position corresponding to the first modification code;

[0060] The severity level of the code defect corresponding to the first modified code;

[0061] The probability of recurrence of the code defect corresponding to the first modified code;

[0062] The sensitivity level of the modification location corresponding to the first modification code.

[0063] The defect identifier is an identifier set for the code defect corresponding to the first modification code. The defect identifier is used to identify the code defect corresponding to the first modification code. Different code defects correspond to different defect identifiers. The code defect corresponding to the first modification code is a code defect resolved by the first modification code. Optionally, the defect identifier is generated by a computer device for the code defect corresponding to the first modification code when resolving the code defect.

[0064] The modification time corresponding to the first modification code refers to the generation time of the first modification code, and can also be understood as the time of resolving the code defect corresponding to the first modification code. Optionally, the modification time is generated by a computer device for the first modification code when resolving the code defect corresponding to the first modification code.

[0065] The modification position corresponding to the first modification code is used to reflect the position of the first modification code in the code set. Optionally, the modification position corresponding to the first modification code includes at least one of a file path and a modification method corresponding to the first modification code. Among them, the file path corresponding to the first modification code is used to indicate the code file where the first modification code is located in the code set, and the modification method corresponding to the first modification code is used to indicate the method modified by the first modification code among all the methods defined in the code set. Optionally, the modification position corresponding to the first modification code is determined by a computer device analyzing the first modification code through a code management tool.

[0066] The severity level of the code defect corresponding to the first modified code is used to reflect the severity of the code defect corresponding to the first modified code. Optionally, the higher the severity level, the higher the negative impact of the code defect corresponding to the first modified code on the code in the running code set, which can be understood as the more serious the bug; the lower the severity level, the lower the negative impact of the code defect corresponding to the first modified code on the code in the running code set, which can be understood as the less serious the bug. Optionally, the severity level is set by the developer according to the code defect corresponding to the first modified code, or is determined by the computer device according to the type of the code defect corresponding to the first modified code. For example, the correspondence between different types of code defects and severity levels is pre-set in the computer device. By determining the type of the code defect corresponding to the first modified code, the severity level of the code defect corresponding to the first modified code can be determined.

[0067] In some embodiments, the severity level is predicted by an artificial intelligence (AI) model, for example, the AI ​​model is a first machine learning model, and the first machine learning model is built based on a neural network (NN). By inputting the first modified code and the original code corresponding to the first modified code into the first machine learning model, the severity level of the code defect corresponding to the first modified code predicted by the first machine learning model can be obtained. The original code is the code corresponding to the first modified code before the code defect corresponding to the first modified code is not resolved, that is, by modifying the original code to the first modified code, the code defect corresponding to the first modified code can be resolved. The first machine learning model is trained by the first sample code, the first sample modified code corresponding to the first sample code, and the sample severity level corresponding to the first sample code and the first sample modified code. There is a first sample code defect in the first sample code, the first sample modified code is a code obtained by modifying the first sample code to resolve the first sample code defect, and the sample severity level is the severity level set for the first sample code defect.

[0068] The probability of recurrence of the code defect corresponding to the first modified code is used to reflect the possibility of the code defect corresponding to the first modified code reappearing. Since the first modified code may be modified again after the code defect is solved by the first modified code, the modified first modified code may be re-introduced into the code defect solved by the first modified code. Optionally, the higher the probability of recurrence, the higher the possibility of the code defect corresponding to the first modified code reappearing; the lower the probability of recurrence, the lower the possibility of the code defect corresponding to the first modified code reappearing. Optionally, the probability of recurrence is set by the developer according to the code defect corresponding to the first modified code, or is determined by the computer device according to the type of code defect corresponding to the first modified code. For example, the correspondence between different types of code defects and recurrence probabilities is pre-set in the computer device. By determining the type of code defect corresponding to the first modified code, the probability of recurrence of the code defect corresponding to the first modified code can be determined.

[0069] In some embodiments, the recurrence probability is predicted by an AI model, for example, the AI ​​model is a second machine learning model, and the second machine learning model is built based on NN. By inputting the first modified code and the original code corresponding to the first modified code into the second machine learning model, the recurrence probability of the code defect corresponding to the first modified code predicted by the second machine learning model can be obtained. The original code is the code corresponding to the first modified code before the code defect corresponding to the first modified code is not resolved, that is, by modifying the original code to the first modified code, the code defect corresponding to the first modified code can be resolved. The second machine learning model is obtained by training the second sample code, the second sample modified code corresponding to the second sample code, and the sample recurrence probability corresponding to the second sample code and the second sample modified code. There is a second sample code defect in the second sample code, and the second sample modified code is a code obtained by modifying the second sample code to resolve the second sample code defect. The sample recurrence probability is the recurrence probability set for the second sample code defect.

[0070] The sensitivity level of the modification position corresponding to the first modification code is used to reflect the importance of the modification position corresponding to the first modification code in the code set. Optionally, the higher the sensitivity level, the higher the importance of the modification position corresponding to the first modification code in the code set, and the higher the negative impact on the code in the running code set when a code defect occurs at the modification position; the lower the sensitivity level, the lower the importance of the modification position corresponding to the first modification code in the code set, and the lower the negative impact on the code in the running code set when a code defect occurs at the modification position. For example, when a code defect occurs at modification position 1, it will affect the normal operation of the first part of the code in the code set, and when a code defect occurs at modification position 2, it will affect the normal operation of the second part of the code in the code set. If the number of codes in the first part is more than that in the second part, the sensitivity level of modification position 1 is higher than that of modification position 2. Optionally, the sensitivity level is set by the developer according to the modification position corresponding to the first modification code.

[0071] In some embodiments, the sensitivity level is predicted by an AI model, for example, the AI ​​model is a third machine learning model, and the third machine learning model is built based on NN. By inputting the first modified code and the original code corresponding to the first modified code into the third machine learning model, the sensitivity level corresponding to the first modified code predicted by the third machine learning model can be obtained. The original code is the code corresponding to the first modified code before the code defect corresponding to the first modified code is not resolved, that is, by modifying the original code to the first modified code, the code defect corresponding to the first modified code can be resolved. The third machine learning model is obtained by training the third sample code, the third sample modification code corresponding to the third sample code, and the sample sensitivity level corresponding to the third sample code and the third sample modification code. There is a third sample code defect in the third sample code, and the third sample modification code is a code obtained by modifying the third sample code to resolve the third sample code defect. The sample sensitivity level is the sensitivity level set for the third sample code and the third sample modification code.

[0072] In some embodiments, each time a code defect is resolved, the computer device stores the modification information corresponding to the first modification code modified this time. Optionally, the granularity of the modification information stored by the computer device is the modification position, that is, for the first modification codes corresponding to different modification positions, the computer device stores the modification information of the part of the first modification code corresponding to each modification position.

[0073] Step 204: Obtain a second modification code corresponding to the code set.

[0074] The second modification code includes the code modified by the version of the updated code set. When the version of the code set is updated, a part of the code in the code set will be modified, and the second modification code is the part of the code modified in the code set. In some embodiments, the first modification code and the second modification code belong to different versions of the code set. In some embodiments, by updating the version of the code set, it is possible to update the code in the code set, thereby updating the version of the software (application) developed by the code set. Optionally, by updating the version of the software (application), it is possible to optimize the functions provided by the software (application) and / or provide new functions for the software (application).

[0075] In some embodiments, when updating the version of a code set, the computer device uses a code management tool to analyze the difference between the code in the current version of the code set and the code in the previous version of the code set, thereby determining the second modification code corresponding to the code set.

[0076] Code management tools are software applications used to help developers effectively organize, store, track, and collaborate on code. For example, code management tools include the following functions: (1) Version control: Code management tools allow developers to track the history of code changes and easily roll back to any previous version. This helps resolve code conflicts that may arise during multi-person collaborative development. (2) Team collaboration: Code management tools facilitate code sharing and communication among development team members. They also support setting different permissions to ensure that only authorized personnel can perform corresponding operations. (3) Branch management: Code management tools can be used to create multiple branches for code to develop different functions or make experimental modifications without affecting the stability of the main branch. (4) Code merging: When the branch development is completed, the code management tool can be used to merge the branch code into the main branch or other branches. (5) Code review: The code review function provided by the code management tool can facilitate development team members to evaluate the code of others and make improvement suggestions.

[0077] Step 206: Determine the risk value of the second modification code according to the modification information.

[0078] The risk value is used to reflect the possibility that the second modified code has a code defect. In some embodiments, the risk value is positively correlated with the possibility that the second modified code has a code defect. That is, the higher the risk value of the second modified code, the higher the possibility that the second modified code has a code defect; the lower the risk value of the second modified code, the lower the possibility that the second modified code has a code defect. In some embodiments, the risk value is negatively correlated with the possibility that the second modified code has a code defect. That is, the lower the risk value of the second modified code, the higher the possibility that the second modified code has a code defect; the higher the risk value of the second modified code, the lower the possibility that the second modified code has a code defect.

[0079] Optionally, in the process of determining the risk value of the second modification code according to the modification information stored in the computer device, the computer device determines the modification position corresponding to the second modification code in the code set. The modification position corresponding to the second modification code is used to reflect the position of the second modification code in the code set. Optionally, the modification position corresponding to the second modification code includes at least one of the file path and modification method corresponding to the second modification code. Among them, the file path corresponding to the second modification code is used to indicate the code file where the second modification code is located in the code set, and the modification method corresponding to the second modification code is used to indicate the method modified by the second modification code in all methods defined in the code set. Optionally, the modification position corresponding to the second modification code is determined by the computer device analyzing the second modification code through a code management tool. Then, the computer device determines the target code corresponding to the second modification code according to the modification position of the second modification code and the modification position in the different modification information stored. The target code is a code having the same modification position in the first modification code and the modification position in the second modification code. Then, the computer device determines the risk value of the second modification code according to the information except the modification position in the modification information corresponding to the target code.

[0080] Optionally, the computer device determines the risk value of the second modified code according to at least one of the modification time corresponding to the target code, the severity level of the code defect corresponding to the target code, the probability of recurrence of the code defect corresponding to the target code, and the sensitivity level of the modification position corresponding to the target code. The risk value of the second modified code is negatively correlated with the time difference corresponding to the target code, and the time difference is the difference between the modification time corresponding to the target code and the time for determining the risk value of the second modified code. The risk value of the second modified code is positively correlated with the severity level of the code defect corresponding to the target code. The risk value of the second modified code is positively correlated with the probability of recurrence of the code defect corresponding to the target code. The risk value of the second modified code is positively correlated with the sensitivity level of the modification position corresponding to the target code.

[0081] For example, the computer device determines the risk value of the second modified code according to the inverse of the above time difference corresponding to the target code, in which case the risk value is positively correlated with the possibility that the second modified code has a code defect. In the case where the second modified code corresponds to multiple segments of target code, the computer device determines the risk value of the second modified code according to the sum of the inverses of the time differences corresponding to different target codes in the multiple segments of target code. In addition, in the process of determining the risk value of the second modified code, the computer device can also weight the inverse of the time difference corresponding to the target code, and the weighted weight is positively correlated with at least one of the severity level of the code defect corresponding to the target code, the probability of recurrence of the code defect corresponding to the target code, and the sensitivity level of the modification position corresponding to the target code. For example, the risk value of the second modified code determined by the computer device is: (1 / time difference corresponding to target code 1)*a+(1 / time difference corresponding to target code 2)*b+(1 / time difference corresponding to target code 3)*c. Among them, target code 1 is the first segment of target code corresponding to the second modified code, target code 2 is the second segment of target code corresponding to the second modified code, and target code 3 is the third segment of target code corresponding to the second modified code. a is determined by the product of the severity level of the code defect corresponding to target code 1 and the average value of the sensitivity level of the modified position corresponding to target code 1, and the probability of recurrence of the code defect corresponding to target code 1. b is determined by the product of the severity level of the code defect corresponding to target code 2 and the average value of the sensitivity level of the modified position corresponding to target code 2, and the probability of recurrence of the code defect corresponding to target code 2. c is determined by the product of the severity level of the code defect corresponding to target code 3 and the average value of the sensitivity level of the modified position corresponding to target code 3, and the probability of recurrence of the code defect corresponding to target code 3.

[0082] In summary, the method provided in this embodiment determines the risk value of the second modified code by obtaining the version of the updated code set, modifying the code set, and combining the modification information corresponding to the pre-stored first modified code. Since the first modified code includes the code modified to solve the code defect, the risk value of the second modified code is determined with reference to the modification information corresponding to the first modified code, which can evaluate the risk of the second modified code with reference to the code defects that occurred in the past, and accurately perform risk assessment on the second modified code. Since the above-mentioned process of risk assessment on the second modified code does not need to rely on manual experience analysis, it can improve the efficiency of risk assessment on the modified code.

[0083] Figure 3 FIG. 1 is a flow chart of a method for determining code risk provided by an exemplary embodiment of the present application. The method can be used on a computer device or a client on a computer device. Figure 3 As shown, the method includes:

[0084] Step 302: Store modification information corresponding to the first modification code in the code set.

[0085] A code collection is a collection of all codes belonging to the same software development project. The code collection includes one or more code files, and the codes in the code files belong to the same software development project. In some embodiments, the software development project corresponding to the code collection is used to develop an application. In this case, the code collection is a collection of codes used to develop the application. Through the codes in the code collection, the functions corresponding to the application can be defined / provided.

[0086] The first modified code includes the code modified to solve the code defect, that is, the first modified code includes the code involved in the modification when solving the code defect, and the first modified code includes one or more code segments. Code defects refer to the problems that do not meet expectations, do not meet specifications, cause software function abnormalities, performance degradation, security vulnerabilities, etc. in the written code during the development process of the software development project. The embodiments of the present application do not limit the type of code defects. In some embodiments, the code defect can be called a bug. In some embodiments, the code defect is solved by manually modifying the code, and the first modified code is obtained by manually modifying the code in the code set.

[0087] Optionally, the modification information corresponding to the first modification code includes at least one of the following information:

[0088] · A defect identifier of a code defect corresponding to the first modification code;

[0089] The modification time corresponding to the first modification code;

[0090] The modification position corresponding to the first modification code;

[0091] The severity level of the code defect corresponding to the first modified code;

[0092] The probability of recurrence of the code defect corresponding to the first modified code;

[0093] The sensitivity level of the modification location corresponding to the first modification code.

[0094] The defect identifier is an identifier set for the code defect corresponding to the first modification code. The defect identifier is used to identify the code defect corresponding to the first modification code. Different code defects correspond to different defect identifiers. The code defect corresponding to the first modification code is a code defect solved by the first modification code. The modification time corresponding to the first modification code refers to the generation time of the first modification code, which can also be understood as the time to solve the code defect corresponding to the first modification code. The modification position corresponding to the first modification code is used to reflect the position of the first modification code in the code set, and the modification position corresponding to the first modification code can be called the first modification position. Optionally, the modification position corresponding to the first modification code includes at least one of the file path and the modification method corresponding to the first modification code. The file path corresponding to the first modification code can be called the first file path, and the modification method corresponding to the first modification code can be called the first modification method. Among them, the file path corresponding to the first modification code is used to indicate the code file where the first modification code is located in the code set, and the modification method corresponding to the first modification code is used to indicate the method modified by the first modification code in all methods defined in the code set. The severity level of the code defect corresponding to the first modification code is used to reflect the severity of the code defect corresponding to the first modification code. Optionally, the higher the severity level, the higher the negative impact of the code defect corresponding to the first modified code on the code in the running code set, which can be understood as the more serious the bug; the lower the severity level, the lower the negative impact of the code defect corresponding to the first modified code on the code in the running code set, which can be understood as the less serious the bug. The probability of recurrence of the code defect corresponding to the first modified code is used to reflect the possibility of the code defect corresponding to the first modified code reappearing. Since the first modified code may be modified again after the code defect is solved by the first modified code, the modified first modified code may be re-introduced into the code defect solved by the first modified code. Optionally, the higher the probability of recurrence, the higher the possibility of the code defect corresponding to the first modified code reappearing; the lower the probability of recurrence, the lower the possibility of the code defect corresponding to the first modified code reappearing. The sensitivity level of the modification position corresponding to the first modified code is used to reflect the importance of the modification position corresponding to the first modified code in the code set. Optionally, the higher the sensitivity level, the more important the modification position corresponding to the first modification code is in the code set, and the higher the negative impact on the code in the running code set when a code defect occurs at the modification position; the lower the sensitivity level, the lower the importance of the modification position corresponding to the first modification code in the code set, and the lower the negative impact on the code in the running code set when a code defect occurs at the modification position.

[0095] In some embodiments, each time a code defect is resolved, the computer device stores the modification information corresponding to the first modification code modified this time. Optionally, the granularity of the modification information stored by the computer device is the modification position, that is, for the first modification codes corresponding to different modification positions, the computer device stores the modification information of the part of the first modification code corresponding to each modification position.

[0096] In some embodiments, the computer device stores modification information corresponding to the first modification code via a knowledge database. The knowledge database is a database for storing different modification information, and the modification information stored in the knowledge database can be understood as representing the corresponding first modification code.

[0097] For example, Figure 4 FIG. 1 is a schematic diagram of a knowledge database provided by an exemplary embodiment of the present application. Figure 4 As shown, the knowledge database 401 at least stores modification information 402, modification information 403, and modification information 404. Among them, modification information 402 is modification information corresponding to the first modification code 1, and the first modification code 1 is a code used to solve code defect 1 and thus modify it. Modification information 403 is modification information corresponding to the first modification code 2, and the first modification code 2 is a code used to solve code defect 2 and thus modify it. Modification information 404 is modification information corresponding to the first modification code 3, and the first modification code 3 is a code used to solve code defect 3 and thus modify it. Modification information 402, modification information 403, and modification information 404 at least include the defect identifier of the corresponding code defect, the modification time of the first modification code, and the modification position of the first modification code.

[0098] Step 304: Obtain a second modification code corresponding to the code set.

[0099] The second modification code includes the code modified by the version of the updated code set. When the version of the code set is updated, a part of the code in the code set will be modified, and the second modification code is the part of the code modified in the code set. In some embodiments, the first modification code and the second modification code belong to different versions of the code set. In some embodiments, by updating the version of the code set, it is possible to update the code in the code set, thereby updating the version of the software (application) developed by the code set. Optionally, by updating the version of the software (application), it is possible to optimize the functions provided by the software (application) and / or provide new functions for the software (application).

[0100] In some embodiments, when updating the version of a code set, the computer device uses a code management tool to analyze the difference between the code in the current version of the code set and the code in the previous version of the code set, thereby determining the second modification code corresponding to the code set.

[0101] Step 306: Determine the modification position corresponding to the second modification code by parsing the second modification code.

[0102] In some embodiments, the modification information includes a first modification position corresponding to the first modification code. The computer device can determine the second modification position corresponding to the second modification code by parsing the second modification code, and the second modification position is used to reflect the position of the second modification code in the code set. Optionally, the second modification position includes at least one of a second file path and a second modification method corresponding to the second modification code. The second file path is used to indicate the code file where the second modification code is located in the code set, and the second modification method is used to indicate the method modified by the second modification code among all the methods defined in the code set. Optionally, the second modification code corresponds to one or more modification positions, and each modification position corresponding to the second modification code is different from each other.

[0103] Optionally, the second modification position corresponding to the second modification code is determined by the computer device analyzing the second modification code through a code management tool.

[0104] Step 308: Determine the target code corresponding to the second modification code in the first modification code according to the stored modification information.

[0105] The first modification position and the second modification position corresponding to the target code are the same, that is, the target code is a code in which the first modification position corresponding to the first modification code is the same as the second modification position corresponding to the second modification code. In some embodiments, in the process of determining the target code, the computer device obtains the second modification position corresponding to the second modification code, and compares the second modification position with the first modification position in each modification information stored in the computer device. In the case where the first modification position in the modification information is the same as the second modification position corresponding to the second modification code, the computer device determines the first modification code corresponding to the modification information as the target code.

[0106] For example, Figure 5 FIG. 1 is a schematic diagram of a process for determining a target code provided by an exemplary embodiment of the present application. Figure 5 As shown, the modification position corresponding to the second modification code 501 is modification position 1, and the knowledge database 502 of the computer device stores modification information 503, modification information 504, and modification information 505. The modification position in modification information 503 is modification position 2, the modification position in modification information 504 is modification position 1, and the modification position in modification information 505 is modification position 3. Figure 5 In the illustrated case, the computer device determines the first modified code corresponding to the modification information 504 as the target code.

[0107] Step 310: Determine the risk value of the second modified code according to the target code.

[0108] The risk value is used to reflect the possibility that the second modified code has a code defect. In some embodiments, the risk value is positively correlated with the possibility that the second modified code has a code defect. That is, the higher the risk value of the second modified code, the higher the possibility that the second modified code has a code defect; the lower the risk value of the second modified code, the lower the possibility that the second modified code has a code defect. In some embodiments, the risk value is negatively correlated with the possibility that the second modified code has a code defect. That is, the lower the risk value of the second modified code, the higher the possibility that the second modified code has a code defect; the higher the risk value of the second modified code, the lower the possibility that the second modified code has a code defect.

[0109] In some embodiments, different modification information stored in the computer device is used to represent different first modification codes. Determining the target code corresponding to the second modification code in the first modification code can also be understood as determining the target modification information corresponding to the second modification code in the modification information, and the first modification position in the target modification information is the same as the second modification position corresponding to the second modification code. Determining the risk value of the second modification code based on the target code can also be understood as determining the risk value of the second modification code based on the target modification information.

[0110] In some embodiments, the computer device determines the risk value of the second modified code according to the modification information corresponding to the target code, for example, according to the information other than the modification position in the modification information corresponding to the target code, to determine the risk value of the second modified code. Optionally, the computer device determines the risk value of the second modified code according to at least one of the modification time corresponding to the target code, the severity level of the code defect corresponding to the target code, the probability of recurrence of the code defect corresponding to the target code, and the sensitivity level of the modification position corresponding to the target code. The risk value of the second modified code is negatively correlated with the time difference corresponding to the target code, which is the difference between the modification time corresponding to the target code and the time for determining the risk value of the second modified code. The risk value of the second modified code is positively correlated with the severity level of the code defect corresponding to the target code. The risk value of the second modified code is positively correlated with the probability of recurrence of the code defect corresponding to the target code. The risk value of the second modified code is positively correlated with the sensitivity level of the modification position corresponding to the target code.

[0111] Optionally, the modification information corresponding to the target code includes the modification time corresponding to the target code (first modification code). In the case of determining the risk value of the second modification code according to the modification time corresponding to the target code, the computer device determines the time difference between the modification time corresponding to the target code and the target time, and determines the risk value of the second modification code according to the inverse of the time difference. The target time is the time for determining the risk value of the second modification code. In this case, the risk value determined by the computer device is positively correlated with the possibility that the second modification code has a code defect.

[0112] Since there is an effect that the location where a code defect occurred in the past is more likely to have a code defect again, and the code segment where the second modified code is located has had a code defect in the past (i.e., the code defect solved by the target code), the smaller the interval between the time when the code defect occurred in the past and the time when the risk value is determined, the higher the possibility of the code defect appearing again, because newer code defects are more likely to recur; the larger the interval between the time when the defect occurred in the past and the time when the risk value is determined, the lower the possibility of the code defect appearing again, because older code defects may have been completely resolved and will not recur.

[0113] In some embodiments, in the process of determining the risk value of the second modification code according to the modification time corresponding to the target code, the computer device also determines the risk value of the second modification code according to the product of the inverse of the time difference and the preset time length. The preset time length is used to make the risk value fall within a preset numerical interval, for example, the preset time length is used to make the risk value fall within the interval [0, 1]. The preset time length is a preset time length, and the preset time length used by the computer device to determine the risk value each time may be the same or different.

[0114] In some embodiments, in the process of determining the risk value of the second modification code according to the modification time corresponding to the target code, when the second modification code corresponds to multiple segments of target code, that is, when there are multiple segments of the first modification code having the same first modification position as the second modification position of the second modification code, the computer device will determine the risk value of the second modification code according to the sum of the reciprocals of the time differences corresponding to different target codes in the multiple segments of target code. The method for determining the time differences corresponding to different target codes can refer to the relevant content in the previous text, and the embodiments of the present application will not be repeated here.

[0115] For example, Figure 6 FIG. 1 is a schematic diagram of a process for determining a risk value provided by an exemplary embodiment of the present application. Figure 6As shown, the computer device determines the target code 1 and target code 2 corresponding to the second modification code 601 according to the modification position 1 corresponding to the second modification code 601 and the data stored in the knowledge database 602. Among them, the target code 1 corresponds to the modification information 603, and the target code 2 corresponds to the modification information 604. The computer device will determine the time difference 1 between the modification time 1 in the modification information 603 and the target time, and the time difference 2 between the modification time 2 in the modification information 604 and the target time. Then, the reciprocal 605 of the time difference 1 corresponding to the target code 1 can be determined according to the time difference 1, and the reciprocal 606 of the time difference 2 corresponding to the target code 2 can be determined according to the time difference 2. By summing the reciprocal 605 and the reciprocal 606, the risk value 607 corresponding to the second modification code 601 can be determined.

[0116] It should be noted that the above-mentioned method of determining the risk value of the second modification code according to the product of the reciprocal of the time difference and the preset time length can be implemented in combination with the method of determining the risk value of the second modification code according to the sum of the reciprocals of the time differences corresponding to different target codes in multiple target codes. For example, the computer device can obtain a candidate risk value by determining the sum of the reciprocals of the time differences corresponding to different target codes in multiple target codes. Then, the computer device determines the risk value of the second modification code according to the product of the candidate risk value and the preset time length.

[0117] In some embodiments, in the process of determining the risk value of the second modified code based on the inverse of the time difference corresponding to the target code, the computer device may also weight the inverse of the time difference corresponding to the target code, and determine the risk value of the second modified code in the above manner based on the weighted result (i.e., the inverse of the weighted time difference).

[0118] Optionally, in the case where the second modification code corresponds to multiple segments of target code, the computer device determines the number of repetitions of the repeated defect code corresponding to the same code defect in the multiple segments of target code corresponding to the second modification code. Optionally, the computer device obtains the defect identifier in the modification information of each target code in the multiple segments of target code, and determines whether there is a repeated defect identifier. In the case of repeated defect identifiers, the computer device determines the target code corresponding to the repeated defect identifier as a repeated defect code, thereby determining the number of repetitions according to the number of occurrences of the repeated defect code. For example, the second modification code corresponds to target code 1, target code 2, and target code 3, the defect identifier in the modification information of target code 1 is identifier 1, the defect identifier in the modification information of target code 2 is identifier 1, and the defect identifier in the modification information of target code 3 is identifier 2. In this case, the computer device determines target code 1 and target code 2 as repeated defect codes, and determines that the number of repetitions of the repeated defect code is 2. In the case where the number of repetitions is greater than the number threshold, the computer device weights the inverse of the time difference corresponding to the repeated defect code, and the weighted weight is positively correlated with the number of repetitions. Optionally, the weight with which the computer device weights the inverse of the time difference corresponding to the repeated defect code is equal to the number of repetitions of the repeated defect code. The computer device weights the time difference corresponding to the repeated defect code by determining the product of the number of repetitions of the repeated defect code and the inverse of the time difference corresponding to the repeated defect code.

[0119] For example, the repeated defect code includes target code 1, target code 2, target code 3, and target code 4, the number of repetitions is 4, the number threshold is 3, and the number of repetitions is greater than the number threshold. In this case, the result of the computer device weighting the reciprocal of the time difference corresponding to target code 1 is: the reciprocal of the time difference corresponding to target code 1 * 4. The result of the computer device weighting the reciprocal of the time difference corresponding to target code 2 is: the reciprocal of the time difference corresponding to target code 2 * 4. The result of the computer device weighting the reciprocal of the time difference corresponding to target code 3 is: the reciprocal of the time difference corresponding to target code 3 * 4. The result of the computer device weighting the reciprocal of the time difference corresponding to target code 4 is: the reciprocal of the time difference corresponding to target code 4 * 4.

[0120] Optionally, the weight used by the computer device to weight the inverse of the time difference corresponding to the target code is positively correlated with at least one of the severity level of the code defect corresponding to the target code, the probability of recurrence of the code defect corresponding to the target code, and the sensitivity level of the modification position corresponding to the target code. For example, the risk value of the second modification code determined by the computer device is: (1 / time difference corresponding to target code 1)*a+(1 / time difference corresponding to target code 2)*b+(1 / time difference corresponding to target code 3)*c. Wherein, target code 1 is the first segment of target code corresponding to the second modification code, target code 2 is the second segment of target code corresponding to the second modification code, and target code 3 is the third segment of target code corresponding to the second modification code. a is determined by multiplying the severity level of the code defect corresponding to target code 1 and the average value of the sensitivity level of the modification position corresponding to target code 1 by the probability of recurrence of the code defect corresponding to target code 1. b is determined by multiplying the severity level of the code defect corresponding to target code 2 and the average value of the sensitivity level of the modification position corresponding to target code 2 by the probability of recurrence of the code defect corresponding to target code 2. c is determined by the product of the severity level of the code defect corresponding to the target code 3 and the sensitivity level of the modification position corresponding to the target code 3, and the probability of recurrence of the code defect corresponding to the target code 3.

[0121] It should be noted that the above-mentioned method of weighting the inverse of the time difference according to the number of repetitions and the above-mentioned method of weighting the inverse of the time difference according to at least one of the severity level, recurrence probability and sensitivity level can be implemented separately or in combination, and the embodiments of the present application do not limit this.

[0122] In an illustrative example, the method provided in the embodiment of the present application includes two parts:

[0123] (1) Establishing a knowledge database of the correspondence between the resolved code defects and the first modified code (modification information of the first modified code).

[0124] When resolving a code defect, the computer device obtains the mapping relationship between the code defect and the first modification code (modification information of the first modification code) and stores it in the knowledge database. The data (modification information) stored in the knowledge database are: the defect identifier (Identity Document, ID) of the code defect, the modification time corresponding to the first modification code, the first file path corresponding to the first modification code, and the first modification method corresponding to the first modification code.

[0125] (2) Based on the knowledge database, predict the risk value of the new difference code (second modified code).

[0126] The computer device parses the new difference code to analyze the second file path and the second modification method corresponding to the new difference code. According to the second file path and the second modification method, the modification information of the corresponding first modification code (representing the code defects solved in the past) is found from the knowledge database. According to the modification information, the reciprocal of the number of days from the modification time of each code defect is added (the longer the history, the lower the priority), and then multiplied by the reference number of days (preset duration) to obtain the risk value of the second modification code. For example, the calculation formula is as follows:

[0127] The risk value of the second modified code = reference days * (1 / number of days since the modification of code defect 1 + 1 / number of days since the modification of code defect 2 + ...).

[0128] In summary, the method provided in this embodiment determines the risk value of the second modified code by obtaining the version of the updated code set, modifying the code set, and combining the modification information corresponding to the pre-stored first modified code. Since the first modified code includes the code modified to solve the code defect, the risk value of the second modified code is determined with reference to the modification information corresponding to the first modified code, which can evaluate the risk of the second modified code with reference to the code defects that occurred in the past, and accurately perform risk assessment on the second modified code. Since the above-mentioned process of risk assessment on the second modified code does not need to rely on manual experience analysis, it can improve the efficiency of risk assessment on the modified code.

[0129] The method provided in this embodiment also determines the target code with the same modification position as the second modification code, thereby determining the risk value of the second modification code according to the target code. The risk of the second modification code is evaluated by referring to the code defects solved by the target code in the past, and the risk assessment of the second modification code is achieved accurately. The risk value of the second modification code is determined according to the reciprocal of the time difference corresponding to the target code. The risk value can satisfy that the smaller the interval between the time when the code defect appeared in the past and the time when the risk value was determined, the higher the risk value; the larger the interval between the time when the code defect appeared in the past and the time when the risk value was determined, the lower the risk value, thereby accurately assessing the risk of the second modification code. By determining the risk value of the second modification code according to the product of the reciprocal of the time difference and the preset time length, the determined risk value can be located in the preset value range, thereby facilitating horizontal comparison. By determining the risk value of the second modification code according to the sum of the reciprocals of the time differences corresponding to different target codes in multiple segments of target code, the risk of the second modification code can be evaluated by referring to the code defects solved by different target codes in the past, and the risk assessment of the second modification code is achieved accurately. By weighting the inverse of the time difference corresponding to the repeated defect code according to the number of repetitions, the influence of the code defects that frequently occurred in the past on the determined risk value can be increased, thereby improving the accuracy of the risk assessment of the second modified code.

[0130] It should be noted that before collecting relevant data of users and during the process of collecting relevant data of users, this application can display a prompt interface, pop-up window or output voice prompt information, and the prompt interface, pop-up window or voice prompt information is used to prompt the user that its relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining relevant data of users after obtaining the confirmation operation issued by the user to the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user to the prompt interface or pop-up window is not obtained), the relevant steps of obtaining relevant data of users are terminated, that is, the relevant data of users are not obtained. In other words, all user data collected by this application are collected with the consent and authorization of the user, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of relevant countries and regions.

[0131] It should be noted that the sequence of the method steps provided in the embodiments of the present application can be appropriately adjusted, and the steps can be increased or decreased accordingly according to the circumstances. Any technician familiar with the technical field can easily think of the changed methods within the technical scope disclosed in the present application, and they should be included in the protection scope of the present application, so they will not be repeated here.

[0132] Figure 7 FIG. 1 is a schematic diagram of a device for determining code risk provided by an exemplary embodiment of the present application. Figure 7As shown, the device comprises:

[0133] A storage module 701 is used to store modification information corresponding to a first modification code in a code set, where the first modification code includes a code modified to solve a code defect;

[0134] An acquisition module 702 is used to acquire a second modification code corresponding to the code set, where the second modification code includes a code modified by updating a version of the code set;

[0135] The determination module 703 is used to determine a risk value of the second modified code according to the modification information, where the risk value is used to reflect the possibility that the second modified code has the code defect.

[0136] In an optional design, the modification information includes a first modification position corresponding to the first modification code; the determination module 703 is used to determine the second modification position corresponding to the second modification code by parsing the second modification code; according to the stored modification information, determine the target code corresponding to the second modification code in the first modification code, the first modification position corresponding to the target code is the same as the second modification position; determine the risk value of the second modification code according to the target code.

[0137] In an optional design, the modification information also includes the modification time corresponding to the first modification code; the determination module 703 is used to determine the time difference between the modification time corresponding to the target code and the target time, and the target time is the time for determining the risk value of the second modification code; according to the inverse of the time difference, the risk value of the second modification code is determined, and the risk value is positively correlated with the possibility that the second modification code contains the code defect.

[0138] In an optional design, the first modification location includes a first file path corresponding to the first modification code and a first modification device, the first file path is used to indicate the code file where the first modification code is located in the code set, and the first modification device is used to indicate the device modified by the first modification code;

[0139] The second modification location includes a second file path corresponding to the second modification code and a second modification device, the second file path is used to indicate the code file where the second modification code is located in the code set, and the second modification device is used to indicate the device modified by the second modification code.

[0140] In an optional design, the determination module 703 is used to determine the risk value of the second modification code based on the product of the inverse of the time difference and a preset time length; wherein the preset time length is used to make the risk value fall within a preset value range.

[0141] In an optional design, the determination module 703 is used to determine the risk value of the second modification code according to the sum of the inverses of time differences corresponding to different target codes in the multiple target codes when the second modification code corresponds to multiple target codes.

[0142] In an alternative design, such as Figure 8 As shown, the device also includes: the determination module 703, which is used to determine the number of repetitions of the repeated defect code corresponding to the same code defect in the multiple target code segments corresponding to the second modification code; the weighting module 704, which is used to weight the inverse of the time difference corresponding to the repeated defect code when the number of repetitions is greater than a number threshold, and the weighted weight is positively correlated with the number of repetitions.

[0143] In an optional design, the storage module 701 is used to store the modification information corresponding to the first modification code through a knowledge database.

[0144] In an optional design, the modification information includes at least one of the following information:

[0145] a defect identifier of a code defect corresponding to the first modification code;

[0146] The modification time corresponding to the first modification code;

[0147] The modification position corresponding to the first modification code.

[0148] It should be noted that the device for determining code risk provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for determining code risk provided in the above embodiment and the method for determining code risk are of the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0149] An embodiment of the present application also provides a computer device, which includes: a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the code risk determination method provided in the above-mentioned method embodiments.

[0150] For example, Fig. 9 It is a structural diagram of a computer device provided by an exemplary embodiment of the present application.

[0151] The computer device 900 includes a central processing unit (CPU) 901, a system memory 904 including a random access memory (RAM) 902 and a read-only memory (ROM) 903, and a system bus 905 connecting the system memory 904 and the central processing unit 901. The computer device 900 also includes a basic input / output system (I / O system) 906 for facilitating information transmission between various components in the computer device, and a large-capacity storage device 907 for storing an operating system 913, application programs 914, and other program modules 915.

[0152] The basic input / output system 906 includes a display 908 for displaying information and an input device 909 such as a mouse and a keyboard for user inputting information. The display 908 and the input device 909 are connected to the central processing unit 901 through an input / output controller 910 connected to the system bus 905. The basic input / output system 906 may also include an input / output controller 910 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 910 also provides output to a display screen, a printer, or other types of output devices.

[0153] The mass storage device 907 is connected to the central processing unit 901 via a mass storage controller (not shown) connected to the system bus 905. The mass storage device 907 and its associated computer-readable storage medium provide non-volatile storage for the computer device 900. That is, the mass storage device 907 may include a computer-readable storage medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0154] Without loss of generality, the computer-readable storage medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable storage instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid-state storage devices, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 904 and mass storage device 907 can be collectively referred to as memory.

[0155] The memory stores one or more programs, and the one or more programs are configured to be executed by one or more central processing units 901. The one or more programs contain instructions for implementing the above-mentioned method embodiments. The central processing unit 901 executes the one or more programs to implement the methods provided by the above-mentioned method embodiments.

[0156] According to various embodiments of the present application, the computer device 900 can also be connected to a remote computer device on a network through a network such as the Internet. That is, the computer device 900 can be connected to a network 912 through a network interface unit 911 connected to the system bus 905, or the network interface unit 911 can be used to connect to other types of networks or remote computer device systems (not shown).

[0157] The memory also includes one or more programs, which are stored in the memory and include steps executed by a computer device in the method provided in the embodiment of the present application.

[0158] A computer-readable storage medium is also provided in an embodiment of the present application, in which at least one instruction, at least one program, code set or instruction set is stored. When the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor of a computer device, the method for determining the code risk provided in the above-mentioned method embodiments is implemented.

[0159] The present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the code risk determination method provided by each of the above method embodiments.

[0160] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned readable storage medium may be a read-only memory, a disk or an optical disk, etc.

[0161] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent switching, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for determining code risk, characterized in that: The method comprises: storing modification information corresponding to a first modification code in a code set, wherein the first modification code includes a code modified to solve a code defect; Obtaining a second modification code corresponding to the code set, wherein the second modification code includes a code modified by updating a version of the code set; A risk value of the second modified code is determined according to the modification information, where the risk value is used to reflect the possibility that the second modified code has the code defect.

2. The method according to claim 1, characterized in that The modification information includes a first modification position corresponding to the first modification code; and determining the risk value of the second modification code according to the modification information includes: Determine a second modification position corresponding to the second modification code by parsing the second modification code; Determining, in the first modification code, a target code corresponding to the second modification code according to the stored modification information, wherein a first modification position corresponding to the target code is the same as the second modification position; A risk value of the second modified code is determined based on the target code.

3. The method according to claim 2, characterized in that The modification information also includes the modification time corresponding to the first modification code; and determining the risk value of the second modification code according to the target code includes: Determine a time difference between a modification time corresponding to the target code and a target time, wherein the target time is a time for determining a risk value of the second modification code; A risk value of the second modified code is determined according to the inverse of the time difference, where the risk value is positively correlated with the possibility that the second modified code has the code defect.

4. The method according to claim 2, characterized in that: The first modification location includes a first file path and a first modification method corresponding to the first modification code, the first file path is used to indicate the code file where the first modification code is located in the code set, and the first modification method is used to indicate the method of modifying the first modification code; The second modification location includes a second file path and a second modification method corresponding to the second modification code, the second file path is used to indicate the code file where the second modification code is located in the code set, and the second modification method is used to indicate the method by which the second modification code is modified.

5. The method according to claim 3, characterized in that: The step of determining the risk value of the second modification code according to the inverse of the time difference comprises: Determining a risk value of the second modification code according to the product of the reciprocal of the time difference and a preset time length; The preset time duration is used to make the risk value fall within a preset value range.

6. The method according to claim 3, characterized in that The step of determining the risk value of the second modification code according to the inverse of the time difference comprises: In the case where the second modification code corresponds to multiple target codes, the risk value of the second modification code is determined according to the sum of the reciprocals of the time differences corresponding to different target codes in the multiple target codes.

7. The method according to claim 6, characterized in that The method further comprises: Determining the number of repetitions of repeated defect codes corresponding to the same code defect in the multiple target code segments corresponding to the second modification code; When the number of repetitions is greater than the number threshold, the inverse of the time difference corresponding to the repeated defect code is weighted, and the weight is positively correlated with the number of repetitions.

8. The method according to any one of claims 1 to 7, characterized in that: The modification information corresponding to the first modification code in the storage code set includes: The modification information corresponding to the first modification code is stored in a knowledge database.

9. The method according to any one of claims 1 to 7, characterized in that: The modification information includes at least one of the following information: a defect identifier of a code defect corresponding to the first modification code; The modification time corresponding to the first modification code; The modification position corresponding to the first modification code.

10. A device for determining code risk, characterized in that: The device comprises: A storage module, used to store modification information corresponding to a first modification code in a code set, wherein the first modification code includes a code modified to solve a code defect; An acquisition module, configured to acquire a second modification code corresponding to the code set, wherein the second modification code includes a code modified by updating a version of the code set; A determination module is used to determine a risk value of the second modified code according to the modification information, wherein the risk value is used to reflect the possibility that the second modified code has the code defect.

11. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the method for determining code risk as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The readable storage medium stores at least one program, and the at least one program is loaded and executed by a processor to implement the method for determining code risk as described in any one of claims 1 to 9.

13. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method for determining code risks as described in any one of claims 1 to 9.