Risk assessment method, device and equipment
By calculating the change frequency and business correlation of the code module, combining the business weight and degree of change, and calculating the risk value, the problem of low accuracy in the evaluation of the code module is solved, and more accurate risk identification and evaluation efficiency is achieved.
Patent Information
- Application Number
- CN202411236719.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-27
AI Technical Summary
During the software development process, frequent refactoring and unreasonable design of code modules make it difficult to accurately evaluate potential risks, and the existing evaluation methods that rely on developer experience are relatively low in accuracy.
By calculating the change frequency and business correlation degree of the code module, combining the business weight and code change degree, the risk value is calculated using the time index, business index and initial reconstruction value, a risk assessment method and device are provided to improve the accuracy of the assessment.
It improves the accuracy of the potential risk assessment of code modules, can more effectively identify high-risk code modules, and improves the efficiency and accuracy of code reviews.
Smart Images

Figure CN119201219A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data analysis technology, and in particular to a risk assessment method, device and equipment. Background Art
[0002] In the process of software development, in order to improve the structural design or function of the code, the code module is usually refactored. However, if a code module is refactored multiple times during the development process, it also indicates that there are many unreasonable features or structural designs of this code module. In other words, this code module has potential risks. Therefore, during the code review stage, it is necessary to pay special attention to this type of code module.
[0003] Currently, developers usually judge whether a code module has potential risks based on their own experience. This judgment method relies too much on the experience of developers, resulting in low accuracy. Summary of the invention
[0004] The present application provides a risk assessment method, apparatus and device for improving the accuracy of determining the probability of potential risks in a code module.
[0005] In a first aspect, an embodiment of the present application provides a risk assessment method, comprising: determining a time index of a target code module based on change information of the target code module, wherein the time index is used to indicate the change frequency of the target code module; determining at least one service associated with the target code module based on configuration information of the target code module; and determining a risk value of the target code module based on the at least one service, the time index and the change information, wherein the risk value is used to indicate the probability that the target code module has a potential risk.
[0006] In the embodiment of the present application, the target code module carries the function of at least one business, that is, the target code module is associated with at least one business, and the more businesses it is associated with, the more important the target code module is in terms of business functions. In addition, the higher the change frequency of the target code module, the more the target code module is reconstructed in a short period of time, indicating that the target code module is highly unstable. Therefore, when conducting a risk assessment on the target code module, the change information, change frequency, and at least one business associated with the code module are taken into account, that is, the multiple factors affecting the risk value of the code module are taken into account, so that the risk value of the determined target code module can be more accurate.
[0007] In a possible implementation, determining the risk value of the target code module based on the at least one business, the time index and the change information includes: determining the business index of the target code module based on the correspondence between the at least one business and the business weight, the business index indicating the impact of the degree of change of the target code module relative to the at least one business, and the business weight indicating the importance of the business; determining the initial reconstruction value of the target code module based on the correspondence between the change information and a preset score, the initial reconstruction value indicating the degree of change of the code content of the target code module; determining the risk value of the target code module based on the product of the business index, the initial reconstruction value and the time index.
[0008] In this embodiment, the importance of each business in at least one business is different. Therefore, determining the business index of the target code module based on the business weight of at least one business can accurately measure the impact of the degree of change of the target code module relative to at least one business, which is conducive to improving the accuracy of determining the risk value.
[0009] In a possible implementation, the change information includes the number of changes to the target code module and the number of lines of code changed in the target code module; determining the initial reconstruction value of the target code module based on the correspondence between the change information and the preset score includes: determining that the product of the number of changes and the first preset score is a first value; determining that the product of the number of lines of code changed and the second preset score is a second value; and determining the result of the operation of the first value and the second value as the initial reconstruction value.
[0010] In this embodiment, the number of code change lines in the target code module can indicate the degree of change to the code content of the target code module during each refactoring. Therefore, considering the number of refactoring times and the number of code change lines of the target code module to calculate the initial reconstruction value of the target code module is conducive to improving the accuracy of determining the initial reconstruction value.
[0011] In a possible implementation, determining the time index of the target code module based on the change information includes: determining at least one time parameter of the target code module based on the change information, wherein a time parameter is used to indicate the time interval between two adjacent changes of the target code module; determining the number of changes of the target code module based on the change information; and determining the time index based on the number of changes, the at least one time parameter and a preset value.
[0012] In a possible implementation, the method further includes: receiving a code evaluation request, the code evaluation request being used to indicate a time range and a code project for the code evaluation; based on the code project, parsing from the code management tool to obtain a set of code modules within the code project and conforming to the time range; and determining the target code module based on the set of code modules.
[0013] In this implementation, risk assessment can be performed on a specified code project and a code module within a specified time range based on a code assessment request, which helps to improve the flexibility of risk assessment of code modules.
[0014] In a possible implementation, determining the target code module based on the code module set includes: obtaining historical submission information of each code module in the code module set from the code management tool; determining whether the historical submission information of each code module includes modification description information, the modification description information being used to indicate the modified code file in each code module; and determining the code module including the modification description information in the submission information as the target code module.
[0015] In this implementation, based on the historical submission information of each code module, it can be determined whether each code module involves substantial modification. Among them, code modules that do not involve substantial modification have little impact because there is no substantial modification to the code content. Therefore, this type of code modules are screened out and no risk assessment is performed, thereby improving the risk assessment efficiency of the code module set.
[0016] In a second aspect, an embodiment of the present application provides a risk assessment device, comprising: a determination module, used to determine a time index of a target code module based on change information of the target code module, wherein the time index is used to indicate the change frequency of the target code module; the determination module is also used to determine at least one business associated with the target code module based on configuration information of the target code module; an assessment module, used to determine a risk value of the target code module based on the at least one business, the time index and the change information, wherein the risk value is used to indicate the probability that the target code module has a potential risk.
[0017] In a possible implementation, the evaluation module is specifically used to: determine the business index of the target code module based on the correspondence between the at least one business and the business weight, the business index indicating the impact of the change degree of the target code module relative to the at least one business, and the business weight indicating the importance of the business; determine the initial reconstruction value of the target code module based on the correspondence between the change information and the preset score, the initial reconstruction value indicating the change degree of the code content of the target code module; determine the risk value of the target code module based on the product of the business index, the initial reconstruction value and the time index.
[0018] In one possible implementation, the change information includes the number of changes to the target code module and the number of lines of code changed in the target code module; the determination module is specifically used to: determine that the product of the number of changes and a first preset score is a first value; determine that the product of the number of lines of code changed and a second preset score is a second value; and determine the result of the operation of the first value and the second value as the initial reconstruction value.
[0019] In a possible implementation, the determination module is specifically used to: determine at least one time parameter of the target code module based on the change information, wherein a time parameter is used to indicate the time interval between two adjacent changes of the target code module; determine the number of changes of the target code module based on the change information; determine the time index based on the number of changes, the at least one time parameter and a preset value.
[0020] In a possible implementation, the determination module is further used to: receive a code evaluation request, the code evaluation request is used to indicate a time range and a code project for the code evaluation; based on the code project, parse from the code management tool to obtain a set of code modules within the code project and that meet the time range; and determine the target code module based on the set of code modules.
[0021] In a possible implementation, the determination module is specifically used to: obtain historical submission information of each code module in the code module set from the code management tool; determine whether the historical submission information of each code module includes modification description information, wherein the modification description information is used to indicate the modified code file in each code module; and determine the code module that includes the modification description information in the submission information as the target code module.
[0022] In a third aspect, an embodiment of the present application provides a risk assessment device, comprising: at least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the method described in the first aspect and any possible implementation manner above by executing the instructions stored in the memory.
[0023] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method described in the first aspect and any possible implementation manner above.
[0024] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed on a computer, enables the method described in the first aspect and any possible implementation manner as described above to be implemented.
[0025] Regarding the beneficial effects of the second to fifth aspects, reference can be made to the contents described in the first aspect above, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A schematic diagram of an application scenario of a risk assessment method provided in an embodiment of the present application;
[0027] Figure 2 A schematic diagram of a risk assessment method provided in an embodiment of the present application;
[0028] Figure 3 A schematic diagram of historical submission information provided in an embodiment of the present application;
[0029] Figure 4 A schematic diagram of the structure of a risk assessment device provided in an embodiment of the present application;
[0030] Figure 5 A schematic diagram of the structure of a risk assessment device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0032] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.
[0033] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0034] In the technical solution of this application, the acquisition, transmission, storage, and use of data are in compliance with the requirements of relevant national laws and regulations.
[0035] In order to better understand the technical solution provided by the embodiments of the present application, Figure 1 The application scenarios to which the embodiments of the present application are applicable are briefly described.
[0036] Please refer to Figure 1 , is a schematic diagram of an application scenario of a risk assessment method provided in an embodiment of the present application. Figure 1As shown, the scenario diagram includes a first device 110 and a second device 120. The first device 110 and the second device 120 can perform wired or wireless communication.
[0037] The first device 110 refers to a device with code management and code storage capabilities, such as a device or a server, and the device may be a terminal device, including but not limited to mobile phones, personal computers (PC), tablet computers, laptops, PDAs, and mobile internet devices (MID). The second device 120 refers to a device or a server with data processing and risk assessment capabilities, such as a terminal device, and the content of the terminal device may correspond to the content described above.
[0038] Exemplarily, the second device 120 may obtain change information and configuration information of the target code module from the first device 110, and determine the risk value of the target code module based on the change information and configuration information of the target code module. The specific content of the second device 120 determining the risk value of the target code module based on the change information and configuration information of the target code module will be described in detail below.
[0039] It should be noted that the above Figure 1 The scenario shown is only an example provided in an embodiment of the present application. In another case, it can also be implemented by a functional module in the first device 110, or a functional module in other devices. The embodiment of the present application is not limited to this.
[0040] Please refer to Figure 2 , is a flow chart of a risk assessment method provided in an embodiment of the present application. The following is a flow chart of a risk assessment method performed by a risk assessment device. Figure 2 The steps shown are used to illustrate the method, but in fact, other devices can also perform the following method, which is not limited in the present embodiment. Figure 2 The risk assessment device involved may be, for example, Figure 1 A second device 120 is shown.
[0041] S201, determining a time index of the target code module according to change information of the target code module, where the time index is used to indicate a change frequency of the target code module.
[0042] The target code module change information includes the number of changes, change time, the change content of each change, and the number of code lines changed in each change. The target code module change information can be obtained from other devices, such as Figure 1The first device 110 is shown. Specifically, the risk assessment apparatus may obtain the change information of the target code module from a code management tool at another device, where the code management tool is, for example, git.
[0043] Exemplarily, the risk assessment device obtains the historical submission information of the target code module from the code management tool. The historical submission information may be, for example, git submission record information, which may include the submission ID, the developer account of the submission, the submission date, the submission note information, and the modified code files involved in the submission. Each time the target code module is reconstructed, a corresponding historical submission information will be added to the code management tool. Therefore, the risk assessment device can determine the number of changes to the target code module based on the number of historical submission information. Furthermore, the historical submission information also includes the specific content of the code modification of the target code module. Therefore, the risk assessment device can parse the historical submission information to obtain the number of code change lines for each change of the target code module.
[0044] After the risk assessment device obtains the change information, the time index of the target code module can be determined according to the number of changes and the change time in the target code module.
[0045] As a possible implementation, the risk assessment device may determine at least one time parameter of the target code module based on the change information, wherein a time parameter is used to indicate the time interval between two adjacent changes of the target code module. And determine the number of changes of the target code module based on the change information. Finally, the risk assessment device may determine the time index based on the number of changes, at least one time parameter and a preset value. The preset value is pre-configured in the risk assessment device, and the preset value may be a better value calculated by the developer after multiple experiments, for example, the preset value may be 0.3.
[0046] For example, the number of changes to the target code module is n, and at least one time parameter is t1, t2, ..., t n-1 , taking the preset value as 0.3 as an example, a calculation formula for determining the time index of a target code module by a risk assessment device is as follows:
[0047] z=0.3×n×(1 / t1+1 / t2……+1 / t n-1 )
[0048] Where z is the time index.
[0049] As a possible implementation, the target code module may be determined by the risk assessment device based on receiving a code assessment request, where the code assessment request is used to indicate a time range and code items for the code assessment. In layman's terms, the risk assessment device may receive a code assessment request for the target code module, thereby performing a risk assessment on the target code module.
[0050] In this implementation, the risk assessment device can parse the code project indicated by the code assessment request from the code management tool to obtain a set of code modules within the code project and within the time range indicated by the code assessment request, and determine the target code module based on the code module set. The code module set within the code project is a pre-divided code module, and the division method can be functional division or other division methods, which is not limited in this embodiment of the present application. The code management tool can be, for example, git.
[0051] As a possible implementation, the code module set includes code modules that have not been modified or have not involved substantial modifications. In order to improve the efficiency of risk assessment of code projects, the risk assessment device can filter out this type of code modules from the code module set. Specifically, the risk assessment device can obtain the historical submission information of each code module in the code module set from the code management tool, determine whether the historical submission information of each code module includes modification description information, and the modification description information is used to indicate the modified code files in each code module, and then the risk assessment device can determine the code module including the modification description information in the historical submission information as the target code module.
[0052] For example, please refer to Figure 3 , is a schematic diagram of historical submission information provided in an embodiment of the present application. Figure 3 As shown, the diagram includes Submission 1 and Submission 2. Submission 1 includes the submission ID, the developer account of the submission, the date of submission, the submission notes, and the module involved in the submission (i.e., the modified code file involved). Submission 2 includes the submission ID, the developer account of the submission, the date of submission, and the submission notes. It can be seen that Submission 2 does not include the modified code file involved in the submission, indicating that the code module corresponding to Submission 2 does not involve the modification of substantive content.
[0053] It should be noted that if the risk assessment device determines that there are multiple code modules including modification description information in the historical submission information, these multiple code modules can be determined as target code modules, or one of the multiple code modules can be determined as the target code module. This embodiment of the present application is not limited to this.
[0054] S202: Determine at least one service associated with the target code module according to configuration information of the target code module.
[0055] The configuration information of the target code module includes the name of the target code module and the functional description information of at least one service carried by the target code module. The configuration information of the target code module can be obtained from other devices, such as Figure 1 A first device 110 is shown.
[0056] Each code module can carry the functions of at least one business, or in other words, each business requires multiple code modules to complete the entire business process, and the importance of each code module is closely related to the importance of each business associated with it. Specifically, the higher the importance of the business, the higher the importance of the code module that carries the functions of the business. Therefore, when conducting code reviews on code modules, it is necessary to focus on code modules with higher importance. Furthermore, when conducting risk assessments on target code modules, it is also necessary to take into account at least one business associated with the target code module.
[0057] Therefore, the risk assessment device can determine at least one business associated with the target code module from the configuration information. Specifically, the risk assessment device can perform natural language processing on the functional description information of at least one business in the configuration information, thereby analyzing and obtaining at least one business associated with the target code module. Alternatively, the risk assessment device pre-stores information such as the names of all businesses, the functions involved, and business processes, and the risk assessment device can query and match from the configuration information based on this information to obtain at least one business associated with the target code module.
[0058] As a possible implementation, after the risk assessment device determines at least one business associated with the target code module, it is necessary to measure the degree of change of the target code module relative to the impact of the at least one business. Therefore, in the risk assessment device, a correspondence between all businesses and business weights can be pre-configured, where the business weight is used to indicate the importance of the business. Exemplarily, taking business 1, business 2 and business 3 as examples, a correspondence between at least one business and business weight is shown in Table 1 below.
[0059] Table 1
[0060] Business Name Business Weight Business 1 0.8 Business 2 1.2 Business 3 1.5
[0061] As shown in Table 1 above, the business weight corresponding to business 1 is 0.8, the business weight corresponding to business 2 is 1.2, and the business weight corresponding to business 3 is 1.5.
[0062] It should be understood that in the embodiment of the present application, the greater the business weight, the higher the importance of the business.
[0063] The risk assessment device may determine the business index of the target code module according to the correspondence between the at least one business and the business weight, and the business index is used to indicate the degree of impact of the change degree of the target code module relative to the at least one business. The risk assessment device may specifically determine the product result of the business weight of the at least one business as the business index of the target code module.
[0064] Exemplarily, continuing to refer to the above Table 1, taking at least one business associated with the target code module as business 1, business 2, and business 3 as an example, a calculation formula for determining the business index of the target code module is as follows:
[0065] y=0.8*1.2*15
[0066] Wherein, y represents the business index of the target code module.
[0067] S203, determining a risk value of the target code module according to at least one business, a time index and change information, where the risk value is used to indicate a probability that the target code module has a potential risk.
[0068] The specific contents of the time index and change information may refer to the contents described above, and will not be repeated here.
[0069] Specifically, the risk assessment device can determine the risk value of the target code module based on the business index, time index and initial reconstruction value corresponding to the change information of at least one business, wherein the initial reconstruction value is used to indicate the degree of change of the code content of the target code module. The risk assessment device can specifically determine the product of the business index, time index and initial reconstruction value as the risk value of the target code module. Exemplarily, a calculation formula for determining the risk value of the target code module is as follows:
[0070] Q = business index * time index * initial reconstruction value
[0071] Where Q represents the risk value of the target code module.
[0072] The following is a detailed description of the manner in which the risk assessment device determines the initial reconstruction value of the target code module according to the change information.
[0073] The risk assessment device can determine the initial reconstruction value of the target code module according to the correspondence between the change information and the preset score. Among them, the preset score may include a first preset score and a second preset score, and the first preset score and the second preset score are respectively used to calculate the reconstruction values corresponding to different change information, which will be described in detail below. The first preset score and the second preset score are both pre-configured in the risk assessment device. The first preset score and the second preset score can be set according to actual needs. For example, the first preset score is 5 and the second preset score is 0.5. This embodiment of the present application is not limited to this.
[0074] Since the number of changes and the content of changes to the target code module can both indicate the degree of change to the target code module, in order to improve the accuracy of determining the risk value, in an embodiment of the present application, the number of changes and the content of changes to the target code module are taken into account to calculate the initial reconstruction value of the target code module.
[0075] Specifically, the risk assessment device can determine that the product of the number of changes to the target code module and the first preset score is a first value, determine that the product of the number of code change lines and the second preset score is a second value, and determine the calculation result of the first value and the second value as the initial reconstruction value of the target code module, wherein the calculation result can specifically be the sum of the first value and the second value.
[0076] For example, taking the target code module as having changed 3 times, the number of code lines changed in the first change being 5, the number of code lines changed in the second change being 14, the number of code lines changed in the third change being 6, the first preset score being 5, and the second preset score being 0.5, a method for determining the initial reconstruction value of the target code module is as follows.
[0077] x=(3*5)+0.5*(5+14+6)
[0078] Where x represents the initial reconstructed value of the target code module.
[0079] As a possible embodiment, after the risk assessment device determines the risk values of the multiple code modules, the risk values of the multiple code modules may be sorted in descending order, wherein the higher the risk value, the higher the probability that the code module has potential risks. Therefore, the risk assessment device may send the sorted multiple code modules to the code reviewer, and the code reviewer may perform code reviews on the multiple code modules respectively based on the risk values of the multiple code modules.
[0080] It should be noted that the manner in which the risk assessment device determines the risk values of other code modules may correspond to the contents described in the above steps S201-S203, and will not be elaborated in detail in the embodiments of the present application.
[0081] In the embodiment of the present application, the more times the code is refactored, the more the code is modified, and the more frequent the code is refactored, the worse the stability of the code module is. The more businesses the code module is associated with or the higher the business weight is, the more important the code module is in terms of business. Therefore, in the embodiment of the present application, the above-mentioned various influencing factors are taken into consideration to measure the risk value of the code module, so that the determined risk value is more accurate, which is also conducive to the subsequent review of the code module, and the code modules with higher risk values are reviewed in detail.
[0082] Based on the same inventive concept, an embodiment of the present application provides a risk assessment device, which is used to implement any of the above risk assessment methods, for example Figure 2 The risk assessment method shown, and the device can also realize the functions of the risk assessment device mentioned above.
[0083] Please refer to Figure 4 , is a schematic diagram of the structure of a risk assessment device provided in an embodiment of the present application. Figure 4 As shown, the risk assessment device 400 includes a determination module 401 and an assessment module 402 .
[0084] Exemplarily, determination module 401 is used to determine a time index of a target code module based on change information of the target code module, where the time index is used to indicate the change frequency of the target code module; determination module 401 is also used to determine at least one business associated with the target code module based on configuration information of the target code module; and evaluation module 402 is used to determine a risk value of the target code module based on at least one business, the time index and change information, where the risk value is used to indicate the probability that a potential risk exists in the target code module.
[0085] In one possible implementation, the evaluation module 402 is specifically used to: determine the business index of the target code module based on the correspondence between at least one business and the business weight, where the business index indicates the impact of the change degree of the target code module relative to at least one business, and the business weight indicates the importance of the business; determine the initial reconstruction value of the target code module based on the correspondence between the change information and the preset score, where the initial reconstruction value indicates the change degree of the code content of the target code module; determine the risk value of the target code module based on the product of the business index, the initial reconstruction value and the time index.
[0086] In one possible implementation, the change information includes the number of changes to the target code module and the number of lines of code changed in the target code module; the determination module 401 is specifically used to: determine the product of the number of changes and a first preset score as a first value; determine the product of the number of lines of code changed and a second preset score as a second value; and determine the result of the operation of the first value and the second value as an initial reconstruction value.
[0087] In a possible implementation, the determination module 401 is specifically used to: determine at least one time parameter of the target code module based on the change information, wherein one time parameter is used to indicate the time interval between two adjacent changes of the target code module; determine the number of changes of the target code module based on the change information; determine the time index based on the number of changes, at least one time parameter and a preset value.
[0088] In a possible implementation, the determination module 401 is further used to: receive a code evaluation request, the code evaluation request is used to indicate the time range and code project of the code evaluation; according to the code project, parse from the code management tool to obtain a set of code modules within the code project and that meet the time range; and determine the target code module according to the set of code modules.
[0089] In one possible implementation, the determination module 401 is specifically used to: obtain historical submission information of each code module in the code module set from a code management tool; determine whether the historical submission information of each code module includes modification description information, the modification description information is used to indicate the modified code file in each code module; and determine the code module including the modification description information in the submission information as the target code module.
[0090] Based on the same inventive concept, an embodiment of the present application provides a risk assessment device, which is used to implement any of the above risk assessment methods, for example Figure 2 The risk assessment method shown, and the device can also realize the function of the risk assessment device mentioned above.
[0091] Please refer to Figure 5 , is a schematic diagram of the structure of a risk assessment device provided in an embodiment of the present application. Figure 5 As shown, the risk assessment device 500 includes at least one processor 501, and a memory 502 communicatively connected to the at least one processor 501;
[0092] The processor 501 may be a general-purpose processor or a dedicated processor. The processor 501 may include, for example, a baseband processor or a central processing unit. The baseband processor may be used to process communication protocols and communication data. The central processing unit may be used to control the risk assessment device 500, execute software programs and / or process data. Different processors may be independent devices or may be arranged in one or more processing circuits, for example, integrated in one or more dedicated integrated circuits.
[0093] In one embodiment, the memory 502 stores instructions that can be executed by at least one processor 501. The at least one processor 501 implements the functions of the risk assessment device as described above by executing the instructions stored in the memory 502, and accordingly, can also implement the steps performed by the risk assessment device as described above.
[0094] In this embodiment, the risk assessment device 500 may also implement the functions of the risk assessment apparatus 400 described above, and the at least one processor 501 in the risk assessment device 500 may also implement the functions of the determination module 401 and the assessment module 402 described above.
[0095] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes any of the risk assessment methods described above, for example, Figure 2 The risk assessment method shown.
[0096] Based on the same inventive concept, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed on a computer, enables any of the above risk assessment methods, for example, Figure 2 The risk assessment method shown is implemented.
[0097] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0098] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0099] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0100] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0101] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A risk assessment method, characterized in that: include: Determining a time index of the target code module according to the change information of the target code module, where the time index is used to indicate a change frequency of the target code module; Determining at least one service associated with the target code module according to the configuration information of the target code module; A risk value of the target code module is determined according to the at least one service, the time index and the change information, where the risk value is used to indicate a probability that a potential risk exists in the target code module.
2. The method according to claim 1, characterized in that: The determining the risk value of the target code module according to the at least one business, the time index and the change information includes: Determine a business index of the target code module according to the correspondence between the at least one business and the business weight, wherein the business index indicates the impact of the degree of modification of the target code module relative to the at least one business, and the business weight indicates the importance of the business; Determining an initial reconstruction value of the target code module according to a correspondence between the change information and a preset score, wherein the initial reconstruction value indicates a degree of change in code content of the target code module; The risk value of the target code module is determined according to the product of the business index, the initial reconstruction value and the time index.
3. The method according to claim 2, characterized in that The change information includes the number of changes to the target code module and the number of lines of code changed in the target code module; The determining the initial reconstruction value of the target code module according to the correspondence between the change information and the preset score includes: Determine that the product of the number of changes and the first preset score is a first value; Determine the product of the number of code modified lines and a second preset score as a second value; The operation result of the first value and the second value is determined as the initial reconstruction value.
4. The method according to any one of claims 1 to 3, characterized in that: Determining the time index of the target code module according to the change information includes: Determine at least one time parameter of the target code module according to the change information, wherein one time parameter is used to indicate the time interval between two adjacent changes of the target code module; Determining the number of changes of the target code module according to the change information; The time index is determined according to the number of changes, the at least one time parameter and a preset value.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: receiving a code evaluation request, wherein the code evaluation request is used to indicate a time range and a code project for the code evaluation; According to the code project, a set of code modules within the code project and in accordance with the time range is obtained by parsing from the code management tool; The target code module is determined according to the code module set.
6. The method according to claim 5, characterized in that The step of determining the target code module according to the code module set includes: Acquire historical submission information of each code module in the code module set from the code management tool; Determine whether the historical submission information of each code module includes modification description information, where the modification description information is used to indicate the modified code file in each code module; The code module including the modification description information in the submission information is determined as the target code module.
7. A risk assessment device, characterized in that: include: A determination module, configured to determine a time index of the target code module according to the change information of the target code module, wherein the time index is used to indicate a change frequency of the target code module; The determination module is further used to determine at least one service associated with the target code module according to the configuration information of the target code module; An evaluation module is used to determine a risk value of the target code module according to the at least one business, the time index and the change information, wherein the risk value is used to indicate a probability that the target code module has a potential risk.
8. The device according to claim 7, characterized in that The evaluation module is specifically used for: Determine a business index of the target code module according to the correspondence between the at least one business and the business weight, wherein the business index indicates the impact of the degree of modification of the target code module relative to the at least one business, and the business weight indicates the importance of the business; Determining an initial reconstruction value of the target code module according to a correspondence between the change information and a preset score, wherein the initial reconstruction value indicates a degree of change in code content of the target code module; The risk value of the target code module is determined according to the product of the business index, the initial reconstruction value and the time index.
9. The device according to claim 8, characterized in that The change information includes the number of changes to the target code module and the number of lines of code changed in the target code module; The determining module is specifically used for: Determine that the product of the number of changes and the first preset score is a first value; Determine the product of the number of code modified lines and a second preset score as a second value; The operation result of the first value and the second value is determined as the initial reconstruction value.
10. The device according to any one of claims 7 to 9, characterized in that: The determining module is specifically used for: Determine at least one time parameter of the target code module according to the change information, wherein one time parameter is used to indicate the time interval between two adjacent changes of the target code module; Determining the number of changes of the target code module according to the change information; The time index is determined according to the number of changes, the at least one time parameter and a preset value.
11. The device according to any one of claims 7 to 9, characterized in that: The determining module is further used for: receiving a code evaluation request, wherein the code evaluation request is used to indicate a time range and a code project for the code evaluation; According to the code project, a set of code modules within the code project and in accordance with the time range is obtained by parsing from the code management tool; The target code module is determined according to the code module set.
12. The device according to claim 11, characterized in that The determining module is specifically used for: Acquire historical submission information of each code module in the code module set from the code management tool; Determine whether the historical submission information of each code module includes modification description information, where the modification description information is used to indicate the modified code file in each code module; The code module including the modification description information in the submission information is determined as the target code module.
13. A risk assessment device, characterized in that: include at least one processor, and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the method according to any one of claims 1 to 6 by executing the instructions stored in the memory.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 6.
15. A computer program product, characterized in that The method comprises computer instructions, which, when executed on a computer, enable the method according to any one of claims 1 to 6 to be implemented.