Risk assessment method and device for code change and electronic equipment
By building a knowledge graph for changing code and using big models for risk assessment, the problem of low risk assessment after code changes is solved, and automated risk assessment is achieved and evaluation accuracy and efficiency is improved.
Patent Information
- Application Number
- CN202411505395.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-03-04
AI Technical Summary
During the software system development process, code changes will cause uncertainty after submitting, resulting in low efficiency and complexity in risk assessment.
By building a knowledge graph of the change code, obtain call association information, and input the change code, call association information and preset prompt words into the big model for risk assessment, and automatically analyze the risks of changing code.
Automatic risk assessment of changing codes is realized, which improves the accuracy and efficiency of risk assessment and reduces the complexity of manual analysis.
Smart Images

Figure CN119556965A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to the field of code change technology for financial software, medical and health software, e-commerce software, cloud computing services, and industrial Internet. Background Art
[0002] In the process of software system development, when code changes are submitted, many uncertainties are often triggered. Therefore, in order to accurately assess the risks caused by the input and output differences (diff) involved in the code changes, multiple developers and testers are usually required to analyze and locate the changed code to determine the risks of this code change and assess the risks, which results in low overall efficiency and high complexity. Summary of the invention
[0003] The present disclosure provides an information processing method, device and electronic device for solving at least one of the above technical problems.
[0004] According to a first aspect of the present disclosure, a risk assessment method for code changes is provided, wherein the method comprises:
[0005] Based on the changed code, build a knowledge graph of the changed code;
[0006] Acquire call association information of the changed code from the knowledge graph;
[0007] The change code, call-related information of the change code, and preset prompt words are input into the big model for risk assessment to obtain a risk assessment result for the change code.
[0008] According to a second aspect of the present disclosure, a risk assessment device for changing codes is provided, wherein the device comprises:
[0009] The graph module is used to build a knowledge graph of the changed code based on the changed code;
[0010] A calling module, used to obtain calling association information of the change code from the knowledge graph;
[0011] The evaluation module is used to input the change code, the call-related information of the change code, and the preset prompt words into the big model for risk evaluation to obtain the risk evaluation result for the change code.
[0012] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0013] at least one processor; and
[0014] a memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the above method.
[0016] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the above method.
[0017] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.
[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0020] Figure 1 It is a flowchart of a risk assessment method for code changes provided by the first embodiment of the present disclosure;
[0021] Figure 2 is a flowchart of a risk assessment method for code changes provided by the second embodiment of the present disclosure;
[0022] Figure 3 is an exemplary flow chart of S201;
[0023] Figure 4 is an exemplary flow chart of S210;
[0024] Figure 5 is an exemplary flow chart of S211;
[0025] Figure 6 is a schematic structural diagram of a risk assessment device for code changes provided by the third embodiment of the present disclosure;
[0026] Figure 7 The block diagram is a block diagram of an electronic device for implementing the method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0028] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0029] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0030] The terminology used herein is for describing particular embodiments only and is not intended to limit the present disclosure.As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0031] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined as such herein.
[0032] The risk assessment method for code changes according to the present disclosure can be executed by an electronic device such as a terminal device or a server. The terminal device can be a vehicle-mounted device, a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The method can be implemented by a processor calling a computer-readable program instruction stored in a memory. Alternatively, the risk assessment method for code changes provided by the present disclosure can be executed by a server.
[0033] In the first embodiment disclosed, see Figure 1 , Figure 1 A flow chart of a risk assessment method for code changes provided by the first embodiment of the present disclosure is shown, the method comprising:
[0034] S101. Build a knowledge graph of the change code based on the change code.
[0035] S102. Obtain call association information of the change code from the knowledge graph.
[0036] S103: Input the change code, the call-related information of the change code, and the preset prompt words into the big model for risk assessment to obtain the risk assessment result for the change code.
[0037] The knowledge graph includes the nodes of the code and the relationships between the nodes, including structured information about the function call chain of the code and / or the impact range of the hypertext transfer protocol interface. The semantics of the changed code is parsed to obtain structured information, and then a knowledge graph containing call association relationships is obtained based on the structured information.
[0038] Among them, submitting code in the software system, that is, changing the code, will affect other nodes in the function call chain, or will affect the call of the hypertext transfer protocol interface. Therefore, the information on the function call chain that will be affected by executing the changed code, and / or the association between the changed code and the hypertext transfer protocol interface is called call association information.
[0039] Among them, the big model is a deep machine learning model with large-scale model parameters, which has professional code understanding, code generation and other capabilities based on the training of hundreds of millions of professional code data, and usually contains hundreds of millions, tens of billions, hundreds of billions, trillions or even more than ten trillion model parameters. The big model can also be called the cornerstone model / foundation model (Foundation Model), which is pre-trained by large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks, and the model has good generalization ability, such as large-scale language model (LargeLanguage Model, LLM), multi-modal pre-training model (multi-modal pre-training model), etc. For example, the big model involved in the method provided in the embodiment of this specification can be a neural network model with tens of billions of parameters represented by the GPT (Generative Pre-Trained Transformer, generative pre-training Transformer model) architecture.
[0040] Among them, the big model will perform logical reasoning based on the change code, the call-related information of the change code, and the preset prompt words to analyze the scope of impact of the change code and the differences in the input / output of the software system after the code change, so as to evaluate the possible risk factors and obtain the risk assessment results.
[0041] The present invention adopts the above-mentioned method, builds a knowledge graph of the change code based on the change code, obtains the call association information of the change code from the knowledge graph, and inputs the change code, the call association information of the change code, and the preset prompt words into the big model for risk assessment, so as to obtain the risk assessment result for the change code, thereby being able to automatically analyze the call association information of the change code, and perform risk analysis on the change code and its call association through the big model, thereby realizing automated risk assessment of the change code and improving the accuracy and efficiency of risk assessment.
[0042] In disclosing the second embodiment, see Figure 2 , Figure 2 A flow chart of a risk assessment method for code changes provided by the second embodiment of the present disclosure is shown, and the method includes:
[0043] S201. Perform data cleansing on the change code to obtain a cleaned change code.
[0044] The code usually contains some information that is irrelevant to risk assessment. Data cleaning is performed on the change code to filter out invalid information, so as to obtain the filtered change code and then execute the subsequent steps. This can reduce the amount of data to be processed and reduce interference items, thereby improving the analysis efficiency. Invalid information includes at least one of the following: comment paragraphs, blank paragraphs, etc.
[0045] For some examples, see Figure 3 , Figure 3 An exemplary flow chart of S201 is shown, where S201 includes:
[0046] S2011. Determine the comment section in the change code.
[0047] S2012. Remove the comment paragraphs to obtain the cleaned change code.
[0048] In this embodiment, a syntax parser may be used to determine the comment sections in the changed code, and then the located comment sections may be deleted to obtain the cleaned changed code.
[0049] It should be noted that, in some cases, any step of S201 (including S2011-S2012) can be omitted, which is not limited here.
[0050] S202: Obtain historical versions and change records of the changed code.
[0051] S203: Based on the changed code, the historical version of the changed code and the change record, perform a syntax compliance check on the changed code.
[0052] If the grammatical compliance check passes, S204 is executed.
[0053] In the process of historical code changes, historical versions and change records of the changed codes will be generated. The change records include information such as the changed sections of the changed code. By obtaining the historical versions and change records, we can perform a grammatical compliance check on the changed code based on the historical data and then use the grammar parser to combine the historical information and the grammar library of the current grammar parser, that is, static code checking, to ensure the accuracy of the grammar compliance check.
[0054] Among them, historical versions and change records can be stored in the database, which is not limited here.
[0055] In some examples, S202 may be omitted, that is, historical versions and change records are not introduced, and the syntax compliance check is directly performed on the current change code.
[0056] In some examples, the grammatical compliance check in S203 includes at least one of the following:
[0057] (1) Determine whether there are any syntax errors in the changed code.
[0058] (2) Determine whether there is an infinite loop in the execution of the changed code.
[0059] (3) Determine whether the execution of the changed code references a null pointer.
[0060] The above (1)-(3) can be combined in any form, and some items can be omitted. Through (1)-(3), the correctness of the change code in terms of format and execution logic can be determined, and the risks within the change code can be identified. In this way, the change code can be initially controlled for risks and assessment errors can be avoided.
[0061] S204: Based on the change code, the historical version of the change code and the change record, perform syntax analysis on the change code to obtain the syntax structure of the change code.
[0062] S205. Construct a knowledge graph of the change code based on the grammatical structure of the change code.
[0063] In S204 and S205, the historical version and change record of the code are introduced, and the current change code is parsed in combination with the historical version and change record to obtain a structured grammatical structure, and then an abstract code tree is constructed based on the grammatical structure, in which the call relationship between each node of the abstract code tree is parsed, the function call chain is formed, and the impact range of the hypertext transfer protocol interface is determined, and then the abstract code tree is converted into a knowledge graph. In this way, the change node of the change code can be determined later, and the impact range of the code change can be determined according to the function call chain information in the knowledge graph and the impact range of the hypertext transfer protocol interface.
[0064] The knowledge graph includes the nodes of the code and the relationships between the nodes, including structured information about the function call chain of the code and / or the impact range of the hypertext transfer protocol interface. The semantics of the changed code is parsed to obtain structured information, and then a knowledge graph containing call association relationships is obtained based on the structured information.
[0065] It should be noted that S201-S205 is one implementation of S101, and S101 also has other implementations, which are not limited here.
[0066] S206, determining a change node of the change code;
[0067] S207. Based on the knowledge graph, obtain call association information associated with the change node in the call relationship.
[0068] The change node of the change code is the node of the functional module corresponding to the change code. Based on the knowledge graph, the call association information involved in the change node can be determined according to the relationship between the change node and other nodes in the knowledge graph.
[0069] In some examples, the call association information includes at least one of the following: function call chain information, hypertext transfer protocol interface impact range information. Of course, the call association information may also include other information associated with the changed code, which is not limited here.
[0070] It should be noted that S206-S207 is one implementation of S102, and S102 also has other implementations, which are not limited here.
[0071] S208, assembling the preset prompt words.
[0072] S209: Input the assembled prompt words, change codes, and call-related information of the change codes into the large model for risk assessment to obtain a risk analysis result including the impact range of the change codes.
[0073] Among them, the prompt words are guiding prompt words of the large model. The large model has sufficient generalization ability, and the prompt words can guide the large model to output accurate and targeted output results. In this method, one or more prompt words can be preset according to the risk factors that need special attention in the change code, and input into the large model when performing risk assessment. In the example of multiple prompt words, multiple prompt words can be assembled and the assembled prompt words can be output, thereby improving the accuracy and comprehensiveness of risk assessment.
[0074] In some examples, the preset prompt words include at least one of the following:
[0075] (1) Determine whether the change code is related to the prompt word of the sort.
[0076] (2) Determine whether the change code contains hints for new features.
[0077] (3) Determine whether the change code contains a reminder word for modification and recall.
[0078] (4) Determine whether the change code contains a hint for a new filter condition.
[0079] In S208, at least any two items in (1)-(4) are assembled to obtain an assembled prompt word.
[0080] Among them, some codes may affect the sorting after being changed, so (1) is used to check whether the changed code will have an impact on the sorting; after adding new features, the new features may affect the evaluation results, so (2) is used to prompt the large model to pay attention to the new features; if the changed code involves modification recall, it may affect the evaluation results, so (3) is used to prompt the large model to pay attention to the changed code section with modification recall function; after adding new filtering conditions, the new filtering conditions may affect the evaluation results, so (4) is used to prompt the large model to pay attention to the new filtering conditions.
[0081] It should be noted that S208-S209 is one implementation of S103, and S103 also has other implementations, which are not limited here.
[0082] S210: Based on the test plan in the historical code information, the current changed code is tested to obtain a test result.
[0083] In this method, a historical change code library can be set up in advance. After each change code and its risk assessment result are obtained, in some cases, the test plan corresponding to the change code is also included to generate a mapping relationship between change code-risk assessment result-test plan, and the three are generated into a historical change code information and stored in the historical change code library. When the change code is tested later, the historical change code information corresponding to the historical change code with a high degree of similarity to the current change code can be obtained from the historical change code library as reference information for the test and introduced into the automatic test, thereby realizing automated and accurate change code testing. When the historical change code is first entered into the library, the test plan of the historical change code can be automatically output by the test model or set by relevant personnel, which is not set here.
[0084] For some examples, see Figure 4 , Figure 4 An exemplary flow chart of S210 is shown, where S210 includes:
[0085] S2101. Determine, from a historical change code library, target historical change code information whose similarity to a current change code is higher than a preset threshold.
[0086] The target historical change code information includes the target historical change code, the risk assessment result corresponding to the target historical change code, and the test plan corresponding to the target historical change code. The similarity threshold can be set as needed, for example, 90% is set as the similarity threshold. Through retrieval and comparison, the target historical change code with a similarity higher than the preset threshold is retrieved in the library, and the target historical change code information corresponding to the target historical change code is obtained through the mapping relationship.
[0087] S2102. Obtain a test plan for the target historical change code from the target historical change code information as a recommended test plan for the current change code.
[0088] Since the changed codes are similar, they can be tested with the same test plan, which saves the step of determining a new test plan and simplifies the process.
[0089] S2103. Input the recommended test plan, the current change code, and the risk assessment result of the current change code into the large model for testing to obtain the test result of the current change code.
[0090] Based on the test plan of similar historical changed codes, that is, the recommended test plan, combined with the risk assessment results, that is, introducing the risk factors of the changed codes, the changed codes are tested, so that the code testing is carried out under the consideration of risk factors, so that the obtained test results are more accurate.
[0091] S211. Store the current change code and its corresponding recommended test solution into the historical change code library.
[0092] For some examples, see Figure 5 , Figure 5 An exemplary flow chart of S211 is shown, where S211 includes:
[0093] S2111. Generate change code information of the current change code based on the recommended test plan, the current change code and its risk assessment result.
[0094] S2112. Store the change code information of the current change code into a historical change code library.
[0095] Each time a change code and its risk assessment result, as well as the test plan corresponding to the change code, are obtained, a mapping relationship of change code-risk assessment result-test plan is generated, and the three are generated into a historical change code information and stored in the historical change code library, so that the current change code is used as the historical change code for the next change code.
[0096] In some examples, the historical change code information stored in the historical change code library may be in vector form to facilitate retrieval, which is not limited here.
[0097] It should be noted that, in some cases, any step of S210 (including S2101-S2103)-S211 (including S02111-S2112) can be omitted, and this is not limited here.
[0098] In disclosing the third embodiment, see Figure 6 ,like Figure 1 The principle shown, Figure 6 A schematic diagram of the structure of a risk assessment device 60 for code changes provided in the third embodiment of the present disclosure is shown, and the device includes:
[0099] A graph module 601 is used to construct a knowledge graph of the changed code based on the changed code;
[0100] A calling module 602 is used to obtain call association information of the change code from the knowledge graph;
[0101] The evaluation module 603 is used to input the change code, the call-related information of the change code, and the preset prompt words into the big model for risk evaluation to obtain the risk evaluation result for the change code.
[0102] In some examples, the graph module is specifically used to:
[0103] Get the historical version and change records of the changed code;
[0104] Based on the change code, the historical version of the change code and the change record, the change code is parsed to obtain the grammatical structure of the change code;
[0105] Based on the grammatical structure of the change code, a knowledge graph of the change code is constructed.
[0106] In some examples, the apparatus further comprises:
[0107] A compliance check module is used to perform syntax compliance checks on the changed code based on the changed code, historical versions of the changed code, and change records;
[0108] When the syntax compliance check passes, a syntax analysis is performed on the change code based on the change code, the historical version of the change code, and the change record to obtain the syntax structure of the change code.
[0109] In some examples, the grammatical compliance check includes at least one of the following:
[0110] Determine if there are any syntax errors in the changed code;
[0111] Determine if there is an infinite loop in the execution of the changed code;
[0112] Determine whether the execution of the altered code dereferences a null pointer.
[0113] In some examples, the calling module is specifically used to:
[0114] Determine the change node of the change code;
[0115] Based on the knowledge graph, call association information associated with the change node in the call relationship is obtained.
[0116] In some examples, the call association information includes at least one of the following: function call chain information, hypertext transfer protocol interface impact scope information.
[0117] In some examples, the evaluation module is specifically configured to:
[0118] Assemble the preset prompt words;
[0119] The assembled prompt words, change codes, and call-related information of the change codes are input into the large model for risk assessment to obtain risk analysis results including the impact range of the change codes.
[0120] In some examples, the preset prompt words include at least one of the following:
[0121] A prompt word to determine whether the change code is associated with the sort;
[0122] Determine whether the change code contains hints for newly added features;
[0123] Determine whether the change code contains reminder words for modification recall;
[0124] Determine whether the change code contains hint words for newly added filtering conditions.
[0125] In some examples, the apparatus further comprises:
[0126] A testing module is used to determine, from the historical change code library, target historical change code information whose similarity with the current change code is higher than a preset threshold;
[0127] Obtain the test plan of the target historical change code from the target historical change code information as the recommended test plan for the current change code;
[0128] The recommended test plan, the current change code and the risk assessment result of the current change code are input into the large model for testing to obtain the test result of the current change code.
[0129] In some examples, the apparatus further comprises:
[0130] A storage module, for generating change code information of a current change code based on a recommended test plan, a current change code and a risk assessment result thereof;
[0131] The change code information of the current change code is stored in the historical change code library.
[0132] In some examples, the apparatus further comprises:
[0133] The data cleaning module is used to clean the changed code to obtain the cleaned changed code.
[0134] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0135] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, a computer program product and an autonomous driving vehicle.
[0136] The computer instructions of the non-transitory computer readable storage medium storing computer instructions are used to make a computer execute the above method.
[0137] A computer program product comprises a computer program, which implements the above method when executed by a processor.
[0138] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0139] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0140] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0141] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as a risk assessment method for changing code. For example, in some embodiments, the risk assessment method for changing code may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the risk assessment method for changing code described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured as a risk assessment method for changing code in any other appropriate manner (e.g., by means of firmware).
[0142] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0143] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0144] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0145] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0146] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0147] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0148] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0149] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A risk assessment method for code changes, wherein: The method comprises: Based on the changed code, build a knowledge graph of the changed code; Acquire call association information of the changed code from the knowledge graph; The change code, call-related information of the change code, and preset prompt words are input into the big model for risk assessment to obtain a risk assessment result for the change code.
2. The method according to claim 1, wherein: The step of constructing a knowledge graph of the changed code based on the changed code includes: Get the historical version and change records of the changed code; Based on the change code, the historical version of the change code and the change record, the change code is parsed to obtain the grammatical structure of the change code; Based on the grammatical structure of the change code, a knowledge graph of the change code is constructed.
3. The method according to claim 2, wherein: After acquiring the historical version and the change record of the change code, and before performing syntax analysis on the change code based on the change code, the historical version and the change record of the change code and obtaining the syntax structure of the change code, the method further includes: Based on the change code, the historical version of the change code and the change record, performing a syntax compliance check on the change code; When the grammatical compliance check passes, the grammatical analysis of the change code based on the change code, the historical version of the change code and the change record is performed to obtain the grammatical structure of the change code.
4. The method according to claim 3, wherein: The syntax compliance check includes at least one of the following: Determine whether the change code has a syntax error; Determining whether there is an infinite loop in the execution of the changed code; Determine whether the execution of the changed code references a null pointer.
5. The method according to any one of claims 1 to 4, wherein: The acquiring the call association information of the change code from the knowledge graph includes: Determining a change node of the change code; Based on the knowledge graph, call association information associated with the change node in a call relationship is obtained.
6. The method according to any one of claims 1 to 5, wherein: The call association information includes at least one of the following: function call chain information and hypertext transfer protocol interface impact range information.
7. The method according to any one of claims 1 to 6, wherein: The step of inputting the change code, the call-related information of the change code, and the preset prompt words into the big model for risk assessment to obtain the risk assessment result for the change code includes: Assembling the preset prompt words; The assembled prompt words, the change code, and the call-related information of the change code are input into a large model for risk assessment to obtain a risk analysis result including the impact range of the change code.
8. The method according to claim 7, wherein: The preset prompt words include at least one of the following: Determining whether the change code is associated with a prompt word for sorting; Determine whether the change code contains a hint of a newly added feature; Determine whether the change code contains a reminder word for modification and recall; It is determined whether the change code contains a prompt word for a newly added filtering condition.
9. The method according to any one of claims 1 to 8, wherein: After inputting the change code, the call-related information of the change code, and the preset prompt words into the big model for risk assessment and obtaining the risk assessment result for the change code, the method further includes: Determine, from the historical change code library, target historical change code information whose similarity to the current change code is higher than a preset threshold; Acquire a test plan for a target historical change code from the target historical change code information as a recommended test plan for the current change code; The recommended test scheme, the current change code and the risk assessment result of the current change code are input into the big model for testing to obtain the test result of the current change code.
10. The method according to claim 9, wherein: After inputting the test scheme of the target historical change code, the current change code and the risk assessment result of the current change code into the big model for testing and obtaining the test result of the current change code, the method further includes: Based on the recommended test scheme, the current change code and its risk assessment result, generating change code information of the current change code; The change code information of the current change code is stored in the historical change code library.
11. The method according to any one of claims 1 to 10, wherein: Before constructing the knowledge graph of the changed code based on the changed code, the method further includes: Data cleaning is performed on the change code to obtain a cleaned change code.
12. The method according to claim 11, wherein: The step of performing data cleaning on the change code to obtain a cleaned change code includes: Determining a comment section in the changed code; The comment section is removed to obtain the cleaned change code.
13. A risk assessment device for changing code, wherein: The device comprises: The graph module is used to build a knowledge graph of the changed code based on the changed code; A calling module, used to obtain calling association information of the change code from the knowledge graph; The evaluation module is used to input the change code, the call-related information of the change code, and the preset prompt words into the big model for risk evaluation to obtain the risk evaluation result for the change code.
14. The device according to claim 13, wherein: The atlas module is specifically used for: Get the historical version and change records of the changed code; Based on the change code, the historical version of the change code and the change record, the change code is parsed to obtain the grammatical structure of the change code; Based on the grammatical structure of the change code, a knowledge graph of the change code is constructed.
15. The device according to claim 14, wherein: The device also includes: A compliance checking module, configured to perform a syntax compliance check on the change code based on the change code, historical versions of the change code, and change records; When the grammatical compliance check passes, the grammatical analysis of the change code based on the change code, the historical version of the change code and the change record is performed to obtain the grammatical structure of the change code.
16. The device according to claim 15, wherein: The syntax compliance check includes at least one of the following: Determine whether the change code has a syntax error; Determining whether there is an infinite loop in the execution of the changed code; Determine whether the execution of the changed code references a null pointer.
17. The device according to any one of claims 13 to 16, wherein: The calling module is specifically used for: Determining a change node of the change code; Based on the knowledge graph, call association information associated with the change node in a call relationship is obtained.
18. The device according to any one of claims 13 to 17, wherein: The call association information includes at least one of the following: function call chain information and hypertext transfer protocol interface impact range information.
19. The device according to any one of claims 13 to 18, wherein: The evaluation modules are specifically used to: Assembling the preset prompt words; The assembled prompt words, the change code, and the call-related information of the change code are input into a large model for risk assessment to obtain a risk analysis result including the impact range of the change code.
20. The device according to claim 19, wherein The preset prompt words include at least one of the following: Determining whether the change code is associated with a prompt word for sorting; Determine whether the change code contains a hint of a newly added feature; Determine whether the change code contains a reminder word for modification and recall; It is determined whether the change code contains a prompt word for a newly added filtering condition.
21. The device according to any one of claims 13 to 20, wherein: The device also includes: A testing module is used to determine, from a historical change code library, target historical change code information whose similarity with the current change code is higher than a preset threshold; Acquire a test plan for a target historical change code from the target historical change code information as a recommended test plan for the current change code; The recommended test scheme, the current change code and the risk assessment result of the current change code are input into the big model for testing to obtain the test result of the current change code.
22. The device according to claim 21, wherein The device also includes: A storage module, used for generating change code information of the current change code based on the recommended test scheme, the current change code and its risk assessment result; The change code information of the current change code is stored in the historical change code library.
23. The device according to any one of claims 13 to 22, wherein: The device also includes: The data cleaning module is used to clean the data of the change code to obtain the cleaned change code.
24. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 12.
25. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-12.
26. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 12.
Citation Information
Cited By
Credit risk information determination method and system, electronic equipment and storage medium
CN120181986A
Risk assessment method and device, storage medium, electronic equipment and product
CN120803887A
A risk assessment method and device, a storage medium, an electronic device and a product
CN120803887B