Code change analysis method and device, equipment and storage medium

Through static analysis and semantic analysis of large models, the function source and dependency link of code changes are determined, which solves the problem that existing tools are difficult to analyze the impact of code changes, and achieves rapid and comprehensive analysis of code changes, ensuring business stability.

CN118885178APending Publication Date: 2024-11-01WEBANK (CHINA)
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411148958.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

Existing version control tools and static analysis tools are difficult to analyze the potential impact of code changes on the business in a comprehensive and rapid manner, especially in large applications where code changes can lead to functional failures, performance degradation or data inconsistency.

Method used

By static analysis of the project code, combined with the semantic analysis ability of the big model, the source of the function is determined and the dependency link is formed, and a comprehensive analysis of code changes is completed, the limitations of static analysis are compensated, and the efficiency of function source determination is improved and accuracy.

Benefits of technology

It realizes a fast and comprehensive analysis of code changes, ensures business stability and reliability, avoids the problem of undetermining the dependency link after the function of unknown origin changes, and improves the perfection of code dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885178A_ABST
    Figure CN118885178A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a code change analysis method and device, equipment and a storage medium, and relates to the technical field of artificial intelligence, and the method comprises the steps: carrying out the static analysis of a first project code, and obtaining the related information of each first function in the first project code; for any first function, determining the source of the first function according to the related information of the first function; if the first function with the unknown source exists, determining the source of the first function with the unknown source through a large model; according to the first item code and the second item code, determining a second function subjected to code change from the first functions; the first project code is obtained by performing code change on the second project code; according to the method, the dependency link of the second function in the first item code is determined according to the source of any second function, and code change analysis is performed on the second function through the dependency link, so that the dependency relationship and change influence of the code can be comprehensively and quickly analyzed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a code change analysis method, device, equipment and storage medium. Background Art

[0002] In software development, code changes may have unexpected impacts on the entire business, especially in large applications where code modifications involve multiple modules and functions. If the impact analysis of code changes is not in place, it may lead to functional failures, performance degradation, or data inconsistency. To ensure the stability and reliability of the business, an efficient and reliable monitoring solution is needed to detect code changes and prevent them from having a negative impact on the business.

[0003] Current version control tools can only show the before-and-after comparison of a single file, and cannot clearly show the potential impact of the change on other codes. Some static analysis tools also have limitations in evaluating the impact of code changes. They rely on the static structure of the code. For programming languages ​​with flexible grammatical structures, static analysis tools cannot exhaust all possible situations, making it difficult to comprehensively and quickly analyze code dependencies and the impact of changes. Summary of the invention

[0004] The embodiments of the present application provide a code change analysis method, apparatus, device and storage medium for comprehensively and quickly analyzing code dependencies and change impacts.

[0005] In a first aspect, an embodiment of the present application provides a code change analysis method, including:

[0006] Obtain relevant information of each first function in the first project code by performing static analysis on the first project code;

[0007] For any first function, determining a source of the first function according to relevant information of the first function;

[0008] If there is a first function of unknown source, the source of the first function of unknown source is determined by a large model; the large model is to derive the source of the function by reasoning about the context information of the function;

[0009] Determining a second function having a code change from each first function by using the first project code and the second project code; the first project code is obtained by performing a code change on the second project code;

[0010] According to the source of any second function, a dependency link of the second function in the first project code is determined, and code change analysis is performed on the second function through the dependency link.

[0011] In the embodiment of the present application, static analysis is first performed on the first project code to obtain the source of the first function. However, at this time, there are still first functions of unknown origin. The semantic analysis capability of the large model is used to complete the first functions of unknown origin to obtain the sources of nearly all first functions. Then, based on the code analysis capability of the large model, the dependency link of the changed function is determined, thereby completing the analysis of all code changes in the first project code. The sources of most functions can be determined through static analysis, which improves the efficiency and accuracy of determining the source of functions. The sources of functions of unknown origin are completed by the large model, which makes up for the problem of incomplete static analysis and avoids the inability to determine the dependency link of the first function of unknown origin after the change, thereby further improving and completing the complex code dependency relationship.

[0012] Optionally, obtaining relevant information of each first function in the first project code by statically analyzing the first project code includes:

[0013] Performing static analysis on each file in the first project code to obtain each first function in each file, as well as call information and import information of each first function;

[0014] Determining a source of the first function according to relevant information of the first function includes:

[0015] The source of the first function is determined according to the calling information and the import information of the first function.

[0016] In an embodiment of the present application, function information and import information of the first function are determined through static analysis, and the source of the first function is determined based on the function information and import information, thereby ensuring the accuracy of the source of the first function and improving the efficiency of determining the source of the first function.

[0017] Optionally, determining the source of the first function according to the calling information and the import information of the first function includes:

[0018] Determining whether the source of the first function is a local function or an inherited function according to the calling information in the function information of the first function; and / or

[0019] According to the import information of the first function, it is determined whether the source of the first function is an imported function.

[0020] In an embodiment of the present application, through the calling information in the first function, it can be determined whether the first function is a local or inherited function, thereby determining the source of the first function; through the import information, it can be determined whether the first function is a function imported from other files, thereby determining which file the first function comes from, and then determining the source of the first function.

[0021] Optionally, the context information of the function includes at least one of the following context information items: function content, code snippets before and after the function call, import information and file information; the function content includes function name, parameters and function body code; the file information includes file path and structure information of project code.

[0022] Optionally, the priorities of the context information items are, from high to low, function content, code snippets before and after the function call, import information, and file information;

[0023] In order of priority of each context information item from high to low, context information items are added in sequence during the training process of the large model until a large model that meets the training requirements is obtained.

[0024] In the embodiment of the present application, by inputting the context information items into the large model in sequence according to the priority of the context information items, the large model is made more accurate during the training process, thereby improving the generalization ability and accuracy of the model.

[0025] Optionally, determining the second function with code change from each first function by using the first project code and the second project code includes:

[0026] Determining, by a version control system, a change code between the first project code and the second project code;

[0027] Analyze the code before and after the change to determine the third functions where the code change occurs;

[0028] The modified first function is determined from among the third functions, and the modified first function is used as the second function.

[0029] In an embodiment of the present application, the function where code changes occur can be determined through the version control system, thereby improving the efficiency and accuracy of confirming the changed code; by taking the first function that is modified in the change as the second function, the research on other functions is saved, the efficiency of change analysis of function dependency links is improved, and the waste of resources caused by analyzing other changed functions that have no impact is avoided.

[0030] Optionally, determining the dependency link of the second function in the first project code includes:

[0031] Determining in the first project code a fourth function that calls the second function and a fifth function that is called by the second function;

[0032] A dependency link of the second function having a function call relationship is formed through the fourth function and the fifth function.

[0033] In an embodiment of the present application, the dependency chain of the second function is determined by calling the fourth function of the second function in the first project code and the fifth function called by the second function, so that the dependency chain of the second function is more complete, which facilitates the subsequent code change analysis of the second function.

[0034] Optionally, performing code change analysis on the second function through the dependency link includes:

[0035] Determining whether a code change in the second function affects other functions in the dependency link;

[0036] If so, a test case is generated and a simulation run is performed on the test case to determine the impact of the code change.

[0037] In an embodiment of the present application, by determining the impact of the second function on other functions from the number of dependency links in the second function, the impact of the second function on other functions in the dependency link can be quickly analyzed, thereby improving the efficiency of code change analysis; by generating test cases for simulation operation, it is possible to determine whether the second function has an impact on the code change, thereby improving the accuracy of code change analysis.

[0038] In a second aspect, an embodiment of the present application provides a code change analysis device, including:

[0039] An analysis module, used for performing static analysis on the first project code to obtain relevant information of each first function in the first project code;

[0040] a determination module, configured to determine, for any first function, a source of the first function according to relevant information of the first function;

[0041] A processing module, configured to determine the source of the first function of unknown source by using a large model if there is a first function of unknown source; the large model is configured to derive the source of the function by inferring context information of the function;

[0042] A change module, used for determining, from each first function, a second function in which a code change occurs, by using the first project code and the second project code; the first project code is obtained by performing a code change on the second project code;

[0043] The analysis module is further used to determine a dependency link of any second function in the first project code according to a source of the second function, and perform code change analysis on the second function through the dependency link.

[0044] Optionally, the analysis module is specifically used for:

[0045] Performing static analysis on each file in the first project code to obtain each first function in each file, and function information and import information of each first function;

[0046] Determining a source of the first function according to relevant information of the first function includes:

[0047] The source of the first function is determined according to the function information and import information of the first function.

[0048] Optionally, the analysis module is specifically used for:

[0049] Determining whether the source of the first function is a local function or an inherited function according to the calling information in the function information of the first function; and / or

[0050] According to the import information of the first function, it is determined whether the source of the first function is an imported function.

[0051] Optionally, the context information of the function includes at least one of the following context information items: function content, code snippets before and after the function call, import information and file information; the function content includes function name, parameters and function body code; the file information includes file path and structure information of project code.

[0052] Optionally, the priorities of the context information items are, from high to low, function content, code snippets before and after the function call, import information, and file information;

[0053] The analysis module is specifically used for:

[0054] In order of priority of each context information item from high to low, context information items are added in sequence during the training process of the large model until a large model that meets the training requirements is obtained.

[0055] Optionally, the analysis module is specifically used for:

[0056] Determining, by a version control system, a change code between the first project code and the second project code;

[0057] Analyze the code before and after the change to determine the third functions where the code change occurs;

[0058] The modified first function is determined from among the third functions, and the modified first function is used as the second function.

[0059] Optionally, the analysis module is specifically used for:

[0060] Determining in the first project code a fourth function that calls the second function and a fifth function that is called by the second function;

[0061] A dependency link of the second function having a function call relationship is formed through the fourth function and the fifth function.

[0062] Optionally, the analysis module is specifically used for:

[0063] Determining whether a code change in the second function affects other functions in the dependency link;

[0064] If so, a test case is generated and a simulation run is performed on the test case to determine the impact of the code change.

[0065] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-mentioned methods when executing the program.

[0066] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program executable by a computer device, wherein when the program is run on the computer device, the computer device executes the steps of any of the above-described methods.

[0067] In a fifth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the methods of the various embodiments of the first aspect described above.

[0068] In the embodiment of the present application, static analysis is first performed on the first project code to obtain the source of the first function. However, at this time, there are still first functions of unknown origin. The semantic analysis capability of the large model is used to complete the first functions of unknown origin to obtain the sources of nearly all first functions. Then, based on the code analysis capability of the large model, the dependency link of the changed function is determined, thereby completing the analysis of all code changes in the first project code. The sources of most functions can be determined through static analysis, which improves the efficiency and accuracy of determining the source of functions. The sources of functions of unknown origin are completed by the large model, which makes up for the problem of incomplete static analysis and avoids the inability to determine the dependency link of the first function of unknown origin after the change, thereby further improving and completing the complex code dependency relationship. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0070] Figure 1A system architecture diagram provided for an embodiment of the present application;

[0071] Figure 2 A flowchart of a code change analysis method provided in an embodiment of the present application;

[0072] Figure 3 It is a schematic diagram of the structure of various function nodes in different forms;

[0073] Figure 4 A schematic diagram of a flow chart for determining a second function provided in an embodiment of the present application;

[0074] Figure 5 A schematic diagram of the structure of a code change analysis device provided in an embodiment of the present application;

[0075] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0076] In order to make the purpose, technical solution and beneficial effects of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0077] For ease of understanding, the terms involved in the embodiments of the present invention are explained below.

[0078] Abstract Syntax Tree (AST) is an abstract representation of the grammatical structure of source code. It represents the grammatical structure of a programming language in a tree form, and each node on the tree represents a structure in the source code.

[0079] Git is an open source distributed version control system, commonly used in scenarios such as code management and file management.

[0080] Big models, that is, big artificial intelligence models, refer to machine learning models with ultra-large-scale parameters (usually more than one billion) and complex computing structures. They can process massive amounts of data and complete various complex tasks, such as natural language processing and image recognition.

[0081] To facilitate understanding of this solution, the application scenario of this solution is introduced below.

[0082] In software development, code changes are often involved, and code changes can affect the entire project. In large applications, code changes can also have unexpected effects on the entire business system. Therefore, in software development, it is necessary to analyze the modules and functions that may be involved in code changes to ensure the normal and stable operation of the entire business system. If the code changes are not analyzed in place, it may lead to functional failures of the entire business system, performance degradation, or data inconsistency.

[0083] At present, version control tools are usually used to analyze code changes. However, version control tools can only show the before-and-after comparison of code changes in a single file, and cannot list the context information of the function corresponding to the referenced changed code, and thus cannot evaluate the impact of the changed code on the entire business system; or static analysis tools are used to analyze code changes, but static analysis tools rely on the static structure of the code. For programming languages ​​with flexible grammatical structures, such as JavaScript, there are many similar complex grammatical forms in JavaScript syntax, such as optional chaining operators, arrow functions, deconstruction assignments, etc. If you try to exhaust all these rules during static analysis, not only will the workload be huge, but it is also easy to miss some special cases. Therefore, it is not realistic to rely on static analysis to accurately track the source of function calls. This requires the combination of more intelligent analysis tools, such as the semantic analysis capabilities of large models, to more comprehensively understand and track the dependencies in the code to supplement the deficiencies of static analysis; manual review and testing of code changes is currently a common means of analyzing code changes, but this method has obvious limitations, is prone to omissions, and the evaluation results of the changed code vary from person to person, and is inefficient. Therefore, the embodiment of the present application proposes a code change analysis method, which can perform a comprehensive and detailed analysis of code changes. The specific implementation steps of the embodiment of the present application are described below:

[0084] First, the first project code is analyzed through static analysis to obtain the source of the first function, where the first project code is the changed code. Then, for the unknown source of the function in the first function, the context of the function is inferred through the large model to determine the source of the first function of unknown source. Then, by comparing the first project code and the second project code, the second function with code change is determined, where the second project code is the code before the change. Finally, the dependency link of the second function is determined according to the source of the second function, so as to perform code change analysis on the second function.

[0085] See also Figure 1 , is a system architecture diagram provided in an embodiment of the present application, the system architecture includes a terminal device 101 and a server 102.

[0086] The terminal device 101 is pre-installed with a service application for text matching, wherein the service application is a client application, a web application, a small program application, etc. The terminal device 101 can be a smart phone, a POS machine, a desktop notebook, a computer, etc., but is not limited thereto.

[0087] Server 102 is the backend server for business applications. Server 102 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), as well as big data and artificial intelligence platforms.

[0088] See also Figure 2 , is a flow chart of a code change analysis method provided in an embodiment of the present application, comprising the following steps:

[0089] Step 201: Obtain relevant information of each first function in the first project code by statically analyzing the first project code.

[0090] Specifically, the first project code is the latest code, and the first function is the function containing the first project code, that is, the latest function, and there is at least one first function. A project generally contains multiple files, and code changes may occur in each file. Therefore, the first project code exists in multiple files. Static analysis is performed on the first project code to obtain relevant information of each first function in the first project code. The relevant information of the first function includes function information and import information of the first function. Static analysis is a method of analyzing code structure and behavior without executing the code. Static analysis finds potential problems and code optimization points by checking the syntax and logical structure of the code. By statically analyzing the first code, relevant information of the first function where the first project code is located can be obtained.

[0091] Step 202: For any first function, determine the source of the first function according to relevant information of the first function.

[0092] Specifically, the relevant information of the first function can determine the source of the first function, where the source of the first function is information such as which file the first function comes from, which function calls the first function, or which function the first function calls.

[0093] Step 203: If there is a first function of unknown source, the source of the first function of unknown source is determined by a large model; the large model derives the source of the function by inferring context information of the function.

[0094] Specifically, static analysis cannot determine the relevant information of all first functions due to its own limitations, and thus cannot capture the sources of all first functions through static analysis. Therefore, after the first function is statically analyzed, there may still be first functions of unknown origin. For the first function of unknown origin, the embodiment of the present application uses a large model for further analysis. The context information of the first function of unknown origin is input into the large model, and the large model uses its own learning and computing capabilities to infer the context information and obtain the source of the first function of unknown origin.

[0095] At present, there are some large models in the industry that have demonstrated powerful capabilities in the field of code analysis, such as GPT-3 and Code LLM (Code Llama). These models are pre-trained on large-scale code bases and can perform a variety of tasks, such as code completion, syntax correction, code generation, etc. They can not only handle traditional programming language features, but also understand the semantics and context of the code, thereby providing more accurate and intelligent code analysis capabilities.

[0096] In the embodiment of the present application, the Code Llama model can be selected. Code Llama is pre-trained on a large-scale code dataset and has a strong ability to understand the semantics of natural language and programming language. By learning a large number of code patterns and paradigms, the model can understand the meaning of function names, parameters, calling contexts, and comments, thereby inferring the possible source of the function. However, the present application does not specifically limit the selection of large models.

[0097] Step 204: Determine the second function in which the code is changed from each first function by using the first project code and the second project code; the first project code is obtained by changing the code of the second project code.

[0098] Specifically, the second project code is the code before the first project code is iterated, and the second function is the function before the iteration. By comparing the first project code and the second project code, the changed code can be determined, and thus the function corresponding to the changed code can be determined.

[0099] Step 205: Determine a dependency link of the second function in the first project code according to the source of any second function, and perform code change analysis on the second function through the dependency link.

[0100] Specifically, the dependency link of a function is the function call and the called situation. If a function calls a second function, then the function is the upstream function of the second function; if the second function calls a certain function, then the function is the downstream function of the second function. There is at least one second function. According to any second function, the upstream function and downstream function of the second function are determined, thereby determining the dependency link of the second function. According to the dependency link of the second function, the code change analysis of the second function can be performed, such as the impact of the second function on the upstream function or downstream function.

[0101] In some embodiments, by performing static analysis on the first project code, relevant information of each first function in the first project code is obtained, including:

[0102] Static analysis is performed on each file in the first project code to obtain each first function in each file, and function information and import information of each first function.

[0103] Specifically, when performing static analysis on each file, it is first necessary to construct an abstract syntax tree according to the first project code in each file, so that the syntax structure of the first project code can be clearly captured; then, the nodes of each abstract syntax tree are traversed to determine the function node; in the nodes of the abstract syntax tree, there are many types of nodes, such as function nodes, import nodes, expression nodes, statement nodes, etc., among which function nodes have many forms, such as function declaration, function expression, arrow function, etc. Figure 3 As shown in the figure, there are different forms of various function nodes. The import node defines the import information of the function, such as which file the function comes from, or which function the function calls, etc. Then in the function node, search for the calling function node, such as searching the callexpression node, to obtain the calling status of each function inside the function node, but the callexpression node cannot search for the callback function, so the callback function is traversed again specifically, and the callback function is deeply parsed to ensure that all nested calls of the function are traversed; when traversing the abstract syntax tree, all function nodes are ensured to be accessible by combining algorithms such as depth-first search and breadth-first search; finally, after determining the calling status of each function inside the function node, the function information and import information corresponding to the function node are extracted (including the callback function node).

[0104] After static analysis of the first project code, the first function in each file and the function information and import information of the first function can be obtained, wherein the function information includes: function name, file path, calling information, and the import information is the source of the first function, that is, which file the first function comes from, etc.

[0105] In order to extract the function information and import information of the first function according to the requirements and the unified format, the embodiment of the present application pre-constructs a file tree for storing each function, so that the function information extracted from the first function is stored according to the structure of the file tree. The structural framework of the file tree is shown in Example 1:

[0106] -File Tree

[0107] -File 1

[0108] - File details

[0109] -File 2

[0110] File details

[0111] -…

[0112] Each node in the file tree represents a file. Each node contains the function information and import information of the file. As shown in Example 2, the node attributes of each file are defined as:

[0113] file: file path, for example src / 1.vue.

[0114] allFuncsInfo: all function information in this file.

[0115] importPkgs: The dependencies imported by this file, i.e. the import information.

[0116] ·mixin: The mixin file used in this (Vue) file, which is also the import information.

[0117] The specific content is shown in Example 3:

[0118]

[0119]

[0120] When constructing the abstract syntax tree of the first project code, import nodes such as ImportDeclaration nodes are generated. The source of the first function is extracted from the ImportDeclaration node and stored in importPkgs. ImportDeclaration records the imported package and its path. The imported content may be of different types, including named import, default import, or namespace import, so it is necessary to process each type separately as much as possible to ensure that the correct import dependency is extracted.

[0121] In some embodiments, determining the source of the first function according to relevant information of the first function includes: determining the source of the first function according to calling information and import information of the first function.

[0122] Specifically, after obtaining the above-mentioned file tree structure, the call information and import information extracted from the first function are filled in the file tree, and the source of the first function can be quickly determined from the file tree based on the call information in the function information of the first function and the import information of the first function.

[0123] In some embodiments, determining the source of the first function according to the call information and the import information of the first function includes:

[0124] Determine whether the source of the first function is a local function or an inherited function according to the calling information in the function information of the first function; and / or determine whether the source of the first function is an imported function according to the import information of the first function.

[0125] Specifically, the composition of the function source of different code languages ​​is divided into different situations. Taking JavaScript language as an example, the source of the function can be preliminarily divided into the following situations.

[0126] 1) Local functions:

[0127] Rules: Functions defined in the current file.

[0128] Judgment method: Check whether the function exists in allFuncsInfo of the current file.

[0129] 2) Import functions:

[0130] Rules: Functions imported from other files.

[0131] Judgment method: Check whether the function exists in importPkgs and obtain its import information.

[0132] 3) Inherited functions:

[0133] Rules: Functions inherited from mixed-in objects.

[0134] Judgment method: Check the file in the mixin attribute, merge its allFuncsInfo into the allFuncsInfo of the current file, and then determine whether the function exists in the merged allFuncsInfo.

[0135] The embodiment of the present application can also determine JavaScript built-in functions or global functions:

[0136] Rules: JavaScript's built-in functions or global functions.

[0137] Judgment method: If the function does not belong to any of the above cases, mark its source as un_know.

[0138] Through the above method, the source of the first function can be determined, including the function name and file path of the first function. According to "callFnList", which functions are called in the function can be known; according to "calledFnFrom", the source of the called function can be known.

[0139] In some embodiments, the context information of a function includes at least one of the following context information items: function content, code snippets before and after the function call, import information, and file information; function content includes function name, parameters, and function body code; file information includes file path and structure information of project code.

[0140] Specifically, in the above method, static analysis is used to analyze the first project code. However, due to the flexibility of the language, the specific sources of some first functions cannot be determined. Therefore, the embodiment of the present application combines a large model to determine the first function of unknown source.

[0141] By reasoning about the context information of the first function of unknown source based on the big model, the specific source of the first function of unknown source can be obtained. When using the big model to infer the source of the function, it is necessary to collect sufficient context information so that the model can make accurate inferences.

[0142] In some embodiments, the priorities of each context information item are, from high to low, function content, code snippets before and after the function call, import information, and file information; in order of the priority of each context information item from high to low, the context information items are added in sequence during the training process of the large model until a large model that meets the training requirements is obtained.

[0143] Specifically, since large models usually have token limitations, they cannot accurately recognize long passages, so a reasonable balance needs to be made when collecting contextual information. To this end, the collected information is prioritized to ensure that the most important information can be processed by the model:

[0144] Priority 1: Function content

[0145] Collect function names and function parameter information in the content.

[0146] For example: `function submit(param1,param2){...}`->`submit(param1,param2)`.

[0147] Extract the entire function body code so that the big model can understand the operations and logic inside the function.

[0148] For example: `function submit(param1,param2){if(isExistRef()){console.log('Reference exists');}$ok();}`

[0149] Priority 2: Code snippets before and after function calls

[0150] Collect code snippets before and after the first function call, such as a few lines of code before and after.

[0151] For example: `if(isExistRef()){...}` and `$ok()`.

[0152] Priority 3: Import information

[0153] Collect import information in files, including imported modules and packages, to understand external dependencies.

[0154] For example: `import{isExistRef}from'. / utils';

[0155] Priority 4: File Information

[0156] Collect file information, including file paths and project structure information, so that the big model can understand the overall organizational structure of the project.

[0157] The sample code for collecting context is as follows:

[0158] / / Example function and its context

[0159] const filecontent = '

[0160] import{isExistRef}from'. / utils';

[0161] function submit(paraml,param2){

[0162] if(isExistRef()){

[0163] console.log('Reference exists');

[0164] }

[0165] $OK();

[0166] }'

[0167] / / Code snippets before and after the context

[0168] someOtherFunction();

[0169] submit(data1,data2);

[0170] anotherFunction();

[0171] Among them, fileContent in the figure is a piece of code. In this code, a function submit is first defined. The submit method has two input parameters param1 and param2. The content between the two curly brackets is the function body. The input parameters and the function body are both to be collected by the function context. / / Code snippets before and after the context, there are three lines of code under this comment. The submit(data1, data2) in the middle is to execute the submit method defined above. There are other functions executed before and after submit, someOtherFunction in front and anotherFunction in the back. These two functions belong to the context of submit. The codes of someOtherFunction and anotherFunction are enough to become the code of the context of submit. By calling the API interface of the big model, the input of context information and the output of results are realized, ensuring that the information transmitted to the big model covers key contents such as function content, code snippets before and after the function call, import information, and file information, so that the model can accurately parse the source of the function and its dependencies. Train the big model in order of priority from high to low until a big model that meets the requirements is obtained. Priority 1 is the highest and priority 4 is the lowest.

[0172] Developers further process and apply the inference results of the large model. When the inference results are accurate, they can be marked as available; when they are inaccurate, they are marked as inference errors. These errors can be used to improve the training of the large model through feedback mechanisms, or to re-infer after adjusting the context information.

[0173] Developers can manually analyze the context information of the first function call of the unknown source to accurately determine the source of the first function of the unknown source. This includes checking the file where the function is defined, checking the import path, and understanding the specific purpose of the function. The results of manual analysis can be used as feedback information to help the large model learn and adjust in subsequent reasoning.

[0174] If the error rate of the large model inference results is high, more context information can be added, such as calling secondary priority, lesser priority, etc. This additional information can provide more clues to help the large model make more accurate inferences.

[0175] Finally, through the inference result of the first function of unknown source by the large model, the file tree obtained by static analysis is corrected, and the source of the first function of unknown source in the file tree is completed, thereby improving the accuracy and completeness of the function dependency link.

[0176] In some embodiments, the second function having a code change is determined from each first function by using the first project code and the second project code, such as Figure 4 As shown, the following steps are included:

[0177] Step 401: Determine the changed code between the first project code and the second project code through a version control system.

[0178] Specifically, after completing the static analysis of the dependency link and the completion of the large model, the next step is to conduct precise code change analysis. By analyzing the changes in the code, the impact of the change code on the entire project can be accurately assessed. The version control system can track the changes in the code, and the change code can be determined by recording each change in the code, including the time of the change, the content of the change, etc. The embodiment of the present application uses the GIT version control system to identify the change code, and according to the function of GIT to restore the file, it is easy to get the code before the change. Git uses three main data objects to manage and store the history of the project: commit object, tree object, and file object. The tree id can be obtained through the commit id, the blob id can be obtained through the tree id, and then the file content can be read through the blob id. Git provides a recursive command that can obtain all blob information in one step, and then obtain the file before the change. Other version control systems can also be used, and this application is not limited.

[0179] Step 402: Analyze the codes before and after the change to determine the third functions where the code changes occur.

[0180] Specifically, the function corresponding to the changed code is the third function, that is, the third function is the function that has changed. The code before and after the change corresponding to the changed code is converted into a new abstract syntax tree, the function nodes of the new abstract syntax tree are traversed, the third function before and after the change are compared, the change of the third function is determined, and the new and old sets of the third function are constructed. The new set is the function after the change, and the old set is the function before the change, for example:

[0181] If the third function does not exist in the new set, it indicates that the third function deletes the function.

[0182] If the third function only exists in the new set, it means that the third function is a newly added function.

[0183] If the third function exists in both sets but has different text contents, it means that the third function is a modified function.

[0184] Step 403: Determine from each third function the first function that has been modified, and use the modified first function as the second function.

[0185] Specifically, since the third function includes three types: deletion, addition, and modification, it is necessary to determine the first function that is a modification from the third function, and use the first function that is a modification as the second function. So far, in the embodiment of the present application, the second function is only a function that has code changes and is a modification.

[0186] In some embodiments, determining a dependency link of the second function in the first project code includes:

[0187] A fourth function that calls the second function and a fifth function that is called by the second function are determined in the first project code; a dependency link of the second function having a function calling relationship is formed through the fourth function and the fifth function.

[0188] Specifically, the fourth function is a function that calls the second function, that is, the upstream function of the second function, and the fifth function is a function called by the second function, that is, the downstream function of the second function. The search is carried out in the file tree by propagating upward and downward. Upward propagation is to find the upper-level code that calls the second function, and downward propagation is to find the lower-level code called by the second function. Finally, based on the dependency link of the first project code, further search and processing are performed to obtain multiple dependency links for each second function. For example, assuming that the second function is C, the following two dependency links can be obtained:

[0189] 1.A1->B1->C->D1->E1;

[0190] 2.A2->B2->C->D2->E2.

[0191] In some embodiments, performing code change analysis on the second function through the dependency link includes:

[0192] Determine whether the code change in the second function affects other functions in the dependent link; if so, generate a test case and simulate the test case to determine the impact of the code change.

[0193] Specifically, after obtaining multiple dependency links for each second function, the big model is used to further analyze the specific content of the change and evaluate its impact on these dependency links. This step applies the powerful semantic understanding and reasoning capabilities of the big model to code change analysis. The specific method is as follows:

[0194] First, let’s analyze the changes to the second function:

[0195] The large model identifies specific changes and features by comparing the code snippets before and after the second function change. These features include, but are not limited to:

[0196] · Log printing: Adding or removing log records in the function. For example, adding console.log("Starting process...") or deleting console.log("Process completed.").

[0197] · Modifying conditional statements: Modifying the judgment conditions of conditional statements. For example, changing if(x>10) to if(x>=10).

[0198] · Modifying loop statements: Changing the termination conditions of loops. For example, changing for(let i=0; i<n; i++) to for(let i=0; i<=n; i++).

[0199] · Changes in function input and output parameters: Modifying the parameter list or return value of the function. For example, changing the function parameters from function processData(data,options) to function processData(data,config), or changing the type and content of the function's return value.

[0200] Then, analyze the impact of the second function on the dependency chain.

[0201] Use the large model to analyze the changes and evaluate their impact on the dependency chain.

[0202] · Changes with no impact: For changes that have nothing to do with business logic, such as log printing and buried point reporting, the large model only needs to confirm that these changes will not affect other functions in the dependency chain. For example, adding or deleting log printing statements and buried point reporting code will not affect the execution or output of other functions.

[0203] · Changes with an impact: For changes that affect business logic, such as changes in conditional statements, loop statements, and function input and output parameters, the model needs to analyze their impact on the dependency chain in detail.

[0204] For impactful changes, the reasoning capabilities of the large model are used to evaluate the potential side effects and chain reactions of the changes on the dependent links. For example, a change in the parameter type of function C may cause the type check in the D1 function to fail, causing a runtime error and further affecting the processing logic of E1. To verify the impact of the change, the model can generate test cases for each node in the link. These test cases are based on the changed code logic and cover all execution paths that may be triggered by the change. By simulating the execution of test cases, the execution of the program and potential exceptions are evaluated. For example:

[0205] Generate a test case for D1 to check whether it can process normally when receiving the return value of the new function C.

[0206] Generate test cases for E1 to verify whether it can execute correctly when receiving data processed by D1.

[0207] Generate test cases for A1 and B1 to ensure that they maintain expected behavior when the entire call chain changes.

[0208] For example, suppose the second function C is in src / util.js, and it has a dependency link of A1->B1->C->D1->E1. The second function C is a function isExistRef that determines whether an object attribute exists. It is located in the src / util.js file. The code before and after the change is as follows:

[0209] Code before change:

[0210] / / src / util.js

[0211] export function isExistRef(obj,ref){

[0212] return obj.hasOwnProperty(ref);

[0213] }

[0214] Code after change:

[0215]

[0216] The changed isExistRef function adds a check on the ref parameter type in the src / util.js file. If ref is not a string, an error will be thrown. This will affect various functions on the dependency chain, especially D1.

[0217] Dependency link code:

[0218]

[0219] / / Do something

[0220] }

[0221] }

[0222] File E1.js

[0223] / / E1.js

[0224] import {process} from '. / D1';

[0225] const data = {userId: 123};

[0226] process(data);

[0227] Analysis and Results:

[0228] Direct impact:

[0229] When the isExistRef function is called in the process function in the D1.js file, an error will be thrown if ref is not a string. The developer needs to ensure that a string is passed when calling isExistRef.

[0230] Communication impact:

[0231] The error catching logic in the process function may affect other functions that depend on process, such as E1. When calling process in E1.js, you need to check whether errors are caused by the new parameter type check.

[0232] Generate test cases:

[0233] Generate test cases for the process function in D1.js, verifying its behavior when receiving arguments of the correct and incorrect types.

[0234] In some embodiments, after obtaining the results of the large model analysis, developers conduct in-depth assessments of the actual impact of code changes on the system through code review and empirical analysis, and compare and supplement them with the results of the large model analysis. If developers find important dependencies or potential impacts that the model fails to capture, they will record and add them to the analysis results. At the same time, they may point out possible deviations or blind spots in the model and make suggestions for improving the model. Combining model analysis and developer experience judgment, a comprehensive change impact assessment conclusion is drawn.

[0235] The embodiment of the present application also has a real-time monitoring and feedback stage. The goal of the real-time monitoring and feedback stage is to integrate the impact assessment results of code changes into the continuous integration and deployment process to achieve timely monitoring and feedback. This process includes quickly analyzing the effects of the introduced changes, identifying and feeding back potential problems in a timely manner, and generating a detailed impact analysis report to help the development team quickly understand the specific impact and potential risks of the changes.

[0236] The main part of the impact analysis report includes the following aspects: First, direct impact analysis, which details how the change affects directly called and called functions, such as functions B and D. The second is propagation impact analysis, such as functions A and E, which shows how the change propagates up and down through dependency links, affecting a wider range of functional modules and code areas. The report summarizes the results of the large model analysis, including the understanding and prediction of the impact of the change. Describe the coverage and results of the generated test cases, and evaluate the actual behavior and possible abnormal situations in the execution of the test cases. Finally, the report summarizes the actual impact and potential risks of the change on the dependency link, and puts forward management and repair suggestions, covering code corrections, test strategy optimization, or further analysis and monitoring measures to ensure the stability and reliability of the system after the change. The analysis report is specifically divided into the following aspects:

[0237] 1. Report Overview

[0238] This report analyzes the code changes of the C functions in the project in detail, aiming to evaluate the impact and potential risks of the changes on the dependency chain. The analysis covers the impact of the changes on directly called and called functions, as well as the impact of their propagation in the dependency chain, and proposes management and repair suggestions.

[0239] 2. Direct impact analysis

[0240] Changed function: `isExistRef` (file: `src / util.js`)

[0241] Impact Analysis:

[0242] Upstream caller: Function `B1` calls `isExistRef`. Modifying the content may change the parameter passing method. It is necessary to check whether it affects the original logic.

[0243] Downstream callee: Function `D1` depends on the return value of `isExistRef`. Modification may cause changes in its logical processing method. Its impact on `E1` needs to be checked.

[0244] 3. Analysis of communication impact

[0245] Start with `isExistRef` and analyze how changes propagate through dependency chains to affect wider functional modules and code areas.

[0246] Transmission path:

[0247] `C->D1->E1`: The logic of `D1` depends on the return value of `isExistRef`. Modification may affect its output result, which in turn affects the function of `E1`.

[0248] `C->B1`: Modifying the parameter passing method of `isExistRef` may affect the calling logic of `B1`. Its impact on the upstream function `A1` needs to be evaluated.

[0249] 4. Large Model Reasoning and Test Case Evaluation

[0250] 4.1 Large Model Reasoning

[0251] Analysis results: The change of isExistRef involves the modification of parameter type checking and return value processing logic. The possible impact paths are predicted to be: B1->isExistRef and isExistRef->D1. Potential risks include incorrect parameter passing method, return value type mismatch, downstream logic processing exception, etc.

[0252] 4.2 Test Case Evaluation

[0253] Test case 1:

[0254] Use case description: Test B1 passing different types of parameters when calling isExistRef.

[0255] Execution result: When a string parameter is passed, the return value is as expected; when a non-string parameter is passed, a type error occurs.

[0256] Potential exception: Non-string parameters lead to logic processing errors.

[0257] Test case 2:

[0258] Use case description: Test D1's logic processing based on the return value of isExistRef.

[0259] Execution result: When the return value is a string, D1 processes normally; when the return value type does not match, D1 logic is abnormal.

[0260] Potential exception: Changes in the return value type lead to logic processing exceptions.

[0261] 5. Conclusions and recommendations

[0262] Conclusion: The change of `isExistRef` may affect multiple functional modules and requires further testing and correction.

[0263] Recommendation: Comprehensive regression testing is recommended to ensure system stability and functional integrity. Optimize test measurements to cover all potential impact paths.

[0264] In the embodiment of the present application, static analysis is first performed on the first project code to obtain the source of the first function. However, at this time, there are still first functions of unknown origin. The semantic analysis capability of the large model is used to complete the first functions of unknown origin to obtain the sources of nearly all first functions. Then, based on the code analysis capability of the large model, the dependency link of the changed function is determined, thereby completing the analysis of all code changes in the first project code. The sources of most functions can be determined through static analysis, which improves the efficiency and accuracy of determining the source of functions. The sources of functions of unknown origin are completed by the large model, which makes up for the problem of incomplete static analysis and avoids the inability to determine the dependency link of the first function of unknown origin after the change, thereby further improving and completing the complex code dependency relationship.

[0265] Based on the same technical concept, the embodiment of the present application provides a code change analysis device, such as Figure 5 As shown, the device 500 includes:

[0266] An analysis module 501 is used to perform static analysis on the first project code to obtain relevant information of each first function in the first project code;

[0267] A determination module 502, configured to determine, for any first function, a source of the first function according to relevant information of the first function;

[0268] The processing module 503 is used to determine the source of the first function of unknown source by using a large model if there is a first function of unknown source; the large model is to derive the source of the function by reasoning about the context information of the function;

[0269] A changing module 504 is used to determine a second function having a code change from each first function by using the first project code and the second project code; the first project code is obtained by performing a code change on the second project code;

[0270] The analysis module 501 is further configured to determine a dependency link of any second function in the first project code according to a source of the second function, and perform code change analysis on the second function through the dependency link.

[0271] Optionally, the analysis module 501 is specifically used for:

[0272] Performing static analysis on each file in the first project code to obtain each first function in each file, and function information and import information of each first function;

[0273] Determining a source of the first function according to relevant information of the first function includes:

[0274] The source of the first function is determined according to the function information and import information of the first function.

[0275] Optionally, the analysis module 501 is specifically used for:

[0276] Determining whether the source of the first function is a local function or an inherited function according to the calling information in the function information of the first function; and / or

[0277] According to the import information of the first function, it is determined whether the source of the first function is an imported function.

[0278] Optionally, the context information of the function includes at least one of the following context information items: function content, code snippets before and after the function call, import information and file information; the function content includes function name, parameters and function body code; the file information includes file path and structure information of project code.

[0279] Optionally, the priorities of the context information items are, from high to low, function content, code snippets before and after the function call, import information, and file information;

[0280] The analysis module 501 is specifically used for:

[0281] In order of priority of each context information item from high to low, context information items are added in sequence during the training process of the large model until a large model that meets the training requirements is obtained.

[0282] Optionally, the analysis module 501 is specifically used for:

[0283] Determining, by a version control system, a change code between the first project code and the second project code;

[0284] Analyze the code before and after the change to determine the third functions where the code change occurs;

[0285] The modified first function is determined from among the third functions, and the modified first function is used as the second function.

[0286] Optionally, the analysis module 501 is specifically used for:

[0287] Determining in the first project code a fourth function that calls the second function and a fifth function that is called by the second function;

[0288] A dependency link of the second function having a function call relationship is formed through the fourth function and the fifth function.

[0289] Optionally, the analysis module 501 is specifically used for:

[0290] Determining whether a code change in the second function affects other functions in the dependency link;

[0291] If so, a test case is generated and a simulation run is performed on the test case to determine the impact of the code change.

[0292] Based on the same technical concept, the embodiment of the present application provides a computer device, which may be a terminal or a server, such as Figure 6 As shown, it includes at least one processor 601 and a memory 602 connected to the at least one processor. The specific connection medium between the processor 601 and the memory 602 is not limited in the embodiment of the present application. Figure 6 For example, the processor 601 and the memory 602 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, and the like.

[0293] In the embodiment of the present application, the memory 602 stores instructions that can be executed by at least one processor 601. The at least one processor 601 can execute the steps included in the above-mentioned cosmic ray removal method by executing the instructions stored in the memory 602.

[0294] The processor 601 is the control center of the computer device, and can use various interfaces and lines to connect various parts of the computer device, by running or executing instructions stored in the memory 602 and calling data stored in the memory 602. Optionally, the processor 601 may include one or more processing units, and the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.

[0295] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.

[0296] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 602 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 602 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 602 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0297] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program executable by a computer device. When the program runs on the computer device, the computer device executes the steps of the above-mentioned cosmic ray removal method.

[0298] Based on the same inventive concept, an embodiment of the present application provides a computer program product, characterized in that the computer program product includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer device, the computer device executes the steps of the above-mentioned cosmic ray removal method.

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

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

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

[0302] 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 in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0303] 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 code change analysis method, It is characterized in that include: Obtain relevant information of each first function in the first project code by performing static analysis on the first project code; For any first function, determining a source of the first function according to relevant information of the first function; If there is a first function of unknown origin, determining the source of the first function of unknown origin by means of a large model; The large model derives the source of the function by reasoning about the context information of the function; Determining a second function having a code change from each first function by using the first project code and the second project code; the first project code is obtained by performing a code change on the second project code; According to the source of any second function, a dependency link of the second function in the first project code is determined, and code change analysis is performed on the second function through the dependency link.

2. The method according to claim 1, It is characterized in that The step of obtaining the call information and import information of each first function in the first project code by statically analyzing the first project code includes: Performing static analysis on each file in the first project code to obtain each first function in each file, as well as call information and import information of each first function; Determining a source of the first function according to relevant information of the first function includes: The source of the first function is determined according to the calling information and the import information of the first function.

3. The method according to claim 2, It is characterized in that The determining the source of the first function according to the calling information and the import information of the first function includes: Determining whether the source of the first function is a local function or an inherited function according to the calling information in the function information of the first function; and / or According to the import information of the first function, it is determined whether the source of the first function is an imported function.

4. The method according to any one of claims 1 to 3, It is characterized in that The context information of the function includes at least one of the following context information items: function content, code snippets before and after the function call, import information and file information; the function content includes function name, parameters and function body code; the file information includes file path and structure information of project code.

5. The method according to claim 4, It is characterized in that The priorities of each context information item are, from high to low, function content, code snippets before and after the function call, import information, and file information; In order of priority of each context information item from high to low, context information items are added in sequence during the training process of the large model until a large model that meets the training requirements is obtained.

6. The method according to any one of claims 1 to 3, It is characterized in that The determining, from each first function, the second function with code change by using the first project code and the second project code comprises: Determining, by a version control system, a change code between the first project code and the second project code; Analyze the code before and after the change to determine the third functions where the code change occurs; The modified first function is determined from among the third functions, and the modified first function is used as the second function.

7. The method according to any one of claims 1 to 3, It is characterized in that The determining the dependency link of the second function in the first project code includes: Determining in the first project code a fourth function that calls the second function and a fifth function that is called by the second function; A dependency link of the second function having a function call relationship is formed through the fourth function and the fifth function.

8. The method according to any one of claims 1 to 3, It is characterized in that The performing code change analysis on the second function through the dependency link includes: Determining whether a code change in the second function affects other functions in the dependency link; If so, a test case is generated and a simulation run is performed on the test case to determine the impact of the code change.

9. A code change analysis device, It is characterized in that include: An analysis module, configured to obtain relevant information of each first function in the first project code by performing static analysis on the first project code; a determination module, configured to determine, for any first function, a source of the first function according to relevant information of the first function; a processing module, configured to determine the source of the first function of unknown source by using a large model if the first function of unknown source exists; The large model derives the source of the function by reasoning about the context information of the function; A change module, used for determining, from each first function, a second function in which a code change occurs, by using the first project code and the second project code; the first project code is obtained by performing a code change on the second project code; The analysis module is further used to determine a dependency link of any second function in the first project code according to a source of the second function, and perform code change analysis on the second function through the dependency link.

10. A computer device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the steps of the method according to any one of claims 1 to 8 are implemented when the processor executes the program.

11. A computer-readable storage medium, It is characterized in that It stores a computer program executable by a computer device, and when the program is run on the computer device, the computer device executes the steps of any method described in claims 1 to 8.

Citation Information

Cited By

  • Dependence graph generation method, risk assessment method, device, equipment and medium

    CN120315725A

  • Dependency graph generation method, risk assessment method, device, equipment and medium

    CN120315725B