Code migration analysis methods, apparatus, equipment, storage media, and program products

By breaking down code changes into source difference blocks and filtering target code based on change features, combined with similarity calculation and large-scale model semantic reasoning, the problem of quantitatively assessing code migration status in financial software version updates is solved, enabling efficient and accurate provision of migration progress data.

CN122332240APending Publication Date: 2026-07-03INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610321817.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-17
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

During the update process of financial software, existing technologies are unable to quantitatively assess the status of code migration, are prone to missing fragmented changes, cannot provide objective migration progress data, and have limited ability to judge the semantic equivalence of logical refactoring.

Method used

The code changes are broken down into multiple source difference blocks. Target code is selected from candidate code based on change features. Similarity is calculated and state mapping rules are used to determine the code migration state. Semantic reasoning is then performed using a large model to improve the accuracy of the analysis.

Benefits of technology

It enables quantitative assessment of code migration status, avoids missing fragmented changes, improves the objectivity and accuracy of migration progress data, and reduces the false judgment rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122332240A_ABST
    Figure CN122332240A_ABST
Patent Text Reader

Abstract

This application provides a code migration analysis method, apparatus, device, storage medium, and program product, which can be applied to the field of financial technology. The method includes: splitting code change content into multiple source difference blocks; filtering multiple candidate codes based on multiple change features corresponding to the multiple source difference blocks to obtain multiple target codes, each candidate code having a multi-level index corresponding to a change feature, the change feature indicating at least one of the code content, change location, and change type of the corresponding source difference block; calculating multiple similarities between the multiple source difference blocks and the corresponding target codes; obtaining multiple code migration states corresponding to the multiple source difference blocks based on multiple similarity levels and a preset state mapping rule; and obtaining a code migration coverage rate based on the multiple code migration states, the state mapping rule indicating the correspondence between similarity levels and code migration states.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of financial technology, and more specifically to a code migration analysis method, apparatus, device, storage medium, and program product. Background Technology

[0002] During the version update process of financial software, it is necessary to migrate the changed code from the source repository to the target repository to ensure the logical consistency and functional integrity of the financial software in the continuous evolution process.

[0003] In related technologies, code migration analysis is performed by comparing differences between code texts using difference analysis tools. However, this method is prone to missing fragmented changes, cannot achieve quantitative assessment of code migration status, and is difficult to provide operations and maintenance personnel with objective migration progress data. Summary of the Invention

[0004] In view of the above problems, embodiments of this application provide a code migration analysis method, apparatus, device, storage medium, and program product.

[0005] According to a first aspect of this application, a code migration analysis method is provided, comprising: splitting code change content into multiple source difference blocks, wherein the code change content represents all code differences within a preset time range; filtering multiple candidate codes based on multiple change features corresponding to the multiple source difference blocks to obtain multiple target codes, wherein each of the multiple candidate codes has a multi-level index corresponding to the change features, and the change features indicate the code change information of the corresponding source difference blocks; calculating multiple similarities between the multiple source difference blocks and the corresponding target codes; obtaining multiple code migration states corresponding to the multiple source difference blocks based on multiple similarity levels corresponding to the multiple similarities and a preset state mapping rule; obtaining a code migration coverage based on the multiple code migration states; wherein the state mapping rule indicates the correspondence between the similarity levels and the code migration states.

[0006] According to an embodiment of this application, the method further includes: guiding a large model to process multiple source difference blocks and multiple target codes based on a preset code migration analysis process indicated by multiple first prompt words and constraints indicated by multiple second prompt words, thereby obtaining multiple code migration analysis results corresponding to multiple source difference blocks.

[0007] According to an embodiment of this application, the method further includes: obtaining multiple comprehensive judgment results based on multiple similarities, multiple code migration analysis results and preset state judgment rules, wherein the state judgment rules indicate the comprehensive judgment results under different combinations of similarities and different code migration analysis results; and using the multiple comprehensive judgment results as updated multiple code migration states.

[0008] According to an embodiment of this application, splitting code change content into multiple source difference blocks includes: splitting code change content into multiple change unit identifiers based on multiple change unit identifiers indicated by code change content, wherein each of the multiple change units has a matching business function; merging change units with the same business function among the multiple change units, and using the merged change unit and change units with different business functions among the multiple change units as multiple source difference blocks.

[0009] According to embodiments of this application, the change features include at least one of change type, change content, and change location. Multiple change features are obtained using the following methods: based on the logical levels corresponding to the code change before and after the change indicated by multiple code syntax structures, semantic analysis is performed on multiple source difference blocks to obtain change intentions corresponding to multiple source difference blocks. Change intentions include at least one of method body modification, class definition change, and variable declaration; multiple change intentions are classified to obtain change types corresponding to multiple source difference blocks. Change types include at least one of business logic adjustment, code framework adaptation, and code refactoring; multiple change contents are obtained based on multiple change entries of code change content, and multiple change entries have content hash values ​​corresponding to multiple source difference blocks; multiple change locations are obtained based on the first line number range and the second line number range corresponding to multiple source difference blocks, where the first line number range represents the line number range before the code change, and the second line number range represents the line number range after the code change.

[0010] According to embodiments of this application, the process of selecting multiple target codes from multiple candidate codes based on multiple change features corresponding to multiple source difference blocks includes: performing structured parsing on multiple candidate codes to obtain multiple candidate code indices, wherein the multiple candidate code indices indicate the change features possessed by the multiple candidate codes; searching in the multiple candidate code indices based on multiple change types corresponding to multiple source difference blocks and centering on multiple change locations to obtain multiple search results; calculating the relevance scores between multiple change contents corresponding to multiple source difference blocks and multiple search results; and selecting multiple target codes from the multiple search results based on the multiple relevance scores.

[0011] According to embodiments of this application, calculating multiple similarities between multiple source difference blocks and corresponding target code includes: calculating lexical similarities between multiple source difference blocks and multiple target codes, wherein lexical similarity indicates the degree of textual similarity between source difference blocks and corresponding target codes; obtaining multiple syntactic similarities based on multiple syntactic structures corresponding to multiple source difference blocks and multiple syntactic structures corresponding to multiple target codes, wherein syntactic similarity indicates the degree of structural similarity between source difference blocks and corresponding target codes; obtaining multiple business similarities based on multiple business features corresponding to multiple source difference blocks and multiple business features corresponding to multiple target codes, wherein business similarity indicates the degree of functional similarity between source difference blocks and corresponding target codes; and fusing the multiple lexical similarities, multiple syntactic similarities, and multiple business similarities to obtain multiple similarities.

[0012] According to an embodiment of this application, obtaining code migration coverage based on multiple code migration states includes: obtaining code migration coverage based on the number of migrated states among the multiple code migration states and the total number of multiple code migration states.

[0013] According to a second aspect of this application, a code migration analysis apparatus is provided, comprising: a parsing module for splitting code change content into multiple source difference blocks, wherein the code change content represents all code differences within a preset time range; a filtering module for filtering multiple candidate codes based on multiple change features corresponding to the multiple source difference blocks to obtain multiple target codes, wherein each of the multiple candidate codes has a multi-level index corresponding to the change features, and the change features indicate the code change information of the corresponding source difference block; and an analysis module for calculating multiple similarities between the multiple source difference blocks and the corresponding target codes, obtaining multiple code migration states corresponding to the multiple source difference blocks based on multiple similarity levels corresponding to the multiple similarities and a preset state mapping rule, and obtaining a code migration coverage based on the multiple code migration states, wherein the state mapping rule indicates the correspondence between the similarity levels and the code migration states.

[0014] According to a third aspect of this application, an electronic device is provided, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.

[0015] According to a fourth aspect of this application, a computer-readable storage medium is also provided, on which a computer program or instructions are stored, wherein the computer program or instructions, when executed by a processor, implement the steps of the above-described method.

[0016] According to a fifth aspect of this application, a computer program product is also provided, comprising a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.

[0017] According to the code migration analysis method, apparatus, device, storage medium, and program product provided in the embodiments of this application, the code change content representing all code differences within a preset time range is split into multiple source difference blocks before further code migration analysis is performed, avoiding the omission of fragmented changes or cumulative changes within a specified time period; multiple candidate codes are screened based on the change characteristics that reflect the core information of the source difference blocks to obtain multiple target codes, improving the efficiency of target code screening; multiple similarities between multiple source difference blocks and multiple target codes, as well as preset state mapping rules, are used to quickly and accurately determine multiple code migration states corresponding to each source difference block, and then based on multiple code migration states, code migration coverage is obtained, realizing a quantitative evaluation of code migration status and providing developers with objective migration progress data. Attached Figure Description

[0018] The above-mentioned contents, other objects, features and advantages of this application will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:

[0019] Figure 1 The illustrations depict application scenarios of the code migration analysis method, apparatus, device, storage medium, and program product according to embodiments of this application.

[0020] Figure 2 A flowchart illustrating a code migration analysis method according to an embodiment of this application is shown schematically.

[0021] Figure 3 A flowchart illustrating the process of obtaining target code according to an embodiment of this application is shown schematically;

[0022] Figure 4 This illustration schematically shows a flowchart of calculating the similarity between multiple source difference blocks and corresponding object code according to an embodiment of this application;

[0023] Figure 5 This schematic diagram illustrates the structural block diagram of a code migration analysis apparatus according to an embodiment of the present application;

[0024] Figure 6 A block diagram schematically illustrates an electronic device suitable for implementing a code migration analysis method according to an embodiment of this application. Detailed Implementation

[0025] The embodiments of this application will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this application. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this application for ease of explanation. However, it will be apparent that one or more embodiments may be implemented without these specific details. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.

[0026] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0027] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0028] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0029] During the version update process of financial software, it is necessary to migrate the code changes from the source repository containing the source code and the changes of each version to the target repository located on the code hosting platform to ensure the logical consistency and functional integrity of the financial software in the continuous evolution process.

[0030] In related technologies, developers use standard diff tools in version control systems to compare code text differences between single commits or fixed commit points, checking migration integrity line by line. However, this approach is prone to missing fragmented changes, cannot achieve quantitative assessment of code migration status, and struggles to provide objective migration progress data for operations personnel. Furthermore, while this method can capture changes from a single commit, it cannot cover cumulative changes over a specified time period; it has low sensitivity to code structure adjustments (such as renaming or logic reorganization), easily leading to misjudgments, and struggles to identify semantically equivalent but differently implemented code migrations (such as equivalent implementations after algorithm optimization).

[0031] In addition, there are analysis methods based on abstract syntax trees or using code clone detection technology for comparison, but these rely on the textual or structural similarity between the source code and the target code, have limited ability to judge the semantic equivalence of logical reconstruction, and have high computational overhead.

[0032] To address at least one of the aforementioned problems, embodiments of this application provide a code migration analysis method. This method breaks down all code changes within a specified time period into multiple source difference blocks before performing code migration analysis. This expands the time frame of the code migration analysis and refines the granularity of the analysis, avoiding the omission of cumulative or fragmented changes within the specified time period. Based on change characteristics that reflect the core information of the source difference blocks, multiple candidate codes are selected to obtain multiple target codes, improving the efficiency of target code selection. Utilizing multiple similarities between multiple source difference blocks and multiple target codes, as well as preset state mapping rules, multiple code migration states corresponding to each source difference block are quickly and accurately determined. Based on these multiple code migration states, code migration coverage is obtained, achieving a quantitative assessment of the code migration state and providing objective migration progress data for operations and maintenance personnel.

[0033] Figure 1 The diagram illustrates an application scenario of the code migration analysis method according to an embodiment of this application. For example... Figure 1 As shown, application scenario 100 according to an embodiment of this application may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables. For example, a user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send information, etc.

[0034] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be electronic devices such as smartphones, wearable devices, personal computers, intelligent voice interaction devices, smart home appliances, intelligent vehicles, in-vehicle terminals, aircraft, unmanned vending terminals, and extended reality devices. Extended reality devices can include virtual reality devices, augmented reality devices, and mixed reality devices. A client application for the target application can be installed and run on the terminal devices. This target application can include, but is not limited to, financial transaction applications, payment applications, shopping applications, web browser applications, search applications, instant messaging tools, email clients, and social media platform software (these are just examples). Furthermore, this application embodiment does not limit the form of the target application, and it can include, but is not limited to, applications, mini-programs, etc., installed on the terminal devices, and can also be in the form of web pages.

[0035] Server 105 can be a server providing various services, such as a backend management server supporting websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process received user requests and other data, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services such as cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks, and basic cloud computing services such as big data. The server can be the backend server of the aforementioned target application, used to provide backend services to the clients of the target application.

[0036] It should be noted that the code migration analysis method provided in this application embodiment can generally be executed by server 105 and / or terminal devices 101-103. Accordingly, the code migration analysis device provided in this application embodiment can generally be set in server 105 and / or terminal devices 101-103.

[0037] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0038] Figure 2 A flowchart illustrating a code migration analysis method according to an embodiment of this application is shown schematically. Figure 2 As shown, the code migration analysis method 200 according to the embodiments of this application may include steps S210 to S230.

[0039] In step S210, the code change content is split into multiple source difference blocks.

[0040] According to embodiments of this application, the code change content represents all code differences within a preset time range. The source difference block can refer to a logically independent code change unit, such as a modification to a function or a code segment.

[0041] According to an embodiment of this application, firstly, in response to receiving a code difference analysis command, a set of code differences covering all changes within a preset time range is filtered in the source repository and used as the code change content; then, the code change content is parsed and split into multiple source difference blocks.

[0042] For example, in response to receiving a code diff analysis command, the system retrieves a set of code diffs covering all changes within a preset time range, starting with the earliest commit within that time range and ending with the latest commit within that range. The code diff analysis command can refer to a command in a distributed version control system used to display code differences between different versions.

[0043] The code changes can be broken down into multiple change units based on the code segments where the code changes are made. For example, one code segment can be a source difference segment.

[0044] By following the steps above, changes are filtered within the source code repository based on a time frame, providing a data foundation for subsequent code migration analysis and facilitating the identification of cumulative changes within a specified time period. Breaking down code changes into source difference blocks allows for fine-grained code migration analysis.

[0045] In step S220, based on multiple change features corresponding to multiple source difference blocks, multiple candidate codes are filtered to obtain multiple target codes.

[0046] According to embodiments of this application, multiple candidate codes each have a multi-level index corresponding to a change feature. The change feature indicates the code change information of the corresponding source difference block.

[0047] According to an embodiment of this application, for each of the multiple source difference blocks, the search is iteratively performed in multiple multi-level indexes based on the change features corresponding to each source difference block until a multi-level index matching the change features is obtained, and the candidate code corresponding to the index is used as the target code.

[0048] For example, change features may include change type, change location, and change content, and multi-level indexes may include change type index, change location index, and change content index.

[0049] By taking into account the change type, change location, and change content, and utilizing multi-level indexes, the target code can be filtered from multiple candidate codes, thereby improving the accuracy and efficiency of target code filtering.

[0050] In step S230, multiple similarities between multiple source difference blocks and their corresponding target code are calculated. Based on multiple similarity levels corresponding to multiple similarities and preset state mapping rules, multiple code migration states corresponding to multiple source difference blocks are obtained. Based on multiple code migration states, code migration coverage is obtained.

[0051] According to embodiments of this application, the state mapping rules indicate the correspondence between similarity levels and code migration states. For example, similarity levels may include low, primary, intermediate, and high. Code migration states may include migrated, partially migrated, not migrated, and conflicted.

[0052] For example, for each of the multiple source difference blocks, the similarity between each difference block and the corresponding target code is calculated. Based on the correspondence between the similarity value range and the similarity level, the similarity level corresponding to that similarity is obtained. Based on the correspondence between the similarity level and the code migration status, the code migration status corresponding to that source difference block is obtained. Based on the proportion of migrated statuses among the multiple code migration statuses corresponding to multiple source difference blocks, the code migration coverage is obtained.

[0053] For example, if the similarity is greater than or equal to the first threshold, the similarity level is high and the code migration status is migrated; if the similarity is less than the first threshold but greater than or equal to the second threshold, the similarity level is medium and the code migration status is partially migrated; if the similarity is less than the second threshold but greater than or equal to the third threshold, the similarity level is low and the code migration status is conflicted.

[0054] In the embodiments of this application, the code change content representing all code differences within a preset time range is split into multiple source difference blocks before further code migration analysis is performed, avoiding the omission of fragmented changes or cumulative changes within a specified time period; multiple candidate codes are screened based on the change characteristics that reflect the core information of the source difference blocks to obtain multiple target codes, improving the efficiency of target code screening; multiple similarities between multiple source difference blocks and multiple target codes, as well as preset state mapping rules, are used to quickly and accurately determine multiple code migration states corresponding to each source difference block, and then based on multiple code migration states, code migration coverage is obtained, realizing the quantitative evaluation of code migration status and providing developers with objective migration progress data.

[0055] In some embodiments, the method further includes: guiding a large model to process multiple source difference blocks and multiple target codes based on a pre-defined code migration analysis process indicated by multiple first prompt words and constraints indicated by multiple second prompt words, thereby obtaining multiple code migration analysis results corresponding to the multiple source difference blocks.

[0056] According to embodiments of this application, when the similarity between the source difference blocks and the target code is lower than a preset threshold or there is ambiguity in the judgment, a pre-trained large model is introduced to process multiple source difference blocks and corresponding multiple target codes. The code migration analysis process characterizes the role positioning and reasoning steps of the large model in semantic reasoning of multiple source difference blocks and corresponding multiple target codes. Constraints characterize the limitations in the semantic reasoning process, such as format verification.

[0057] Large models can represent deep learning models with a massive number of parameters, ranging from hundreds of millions to billions, trillions, or even tens of trillions. Also known as foundational or basic models, large models are pre-trained on large-scale unlabeled corpora, producing pre-trained models with hundreds of millions of parameters. These models are adaptable to a wide range of downstream tasks and exhibit good generalization ability; examples include large language models and multimodal pre-trained models.

[0058] It should be understood that in practical applications, large models only require a small number of samples to fine-tune the pre-trained model before they can be applied to different tasks. Large models can be widely used in fields such as natural language processing and computer vision. Specifically, they can be applied to computer vision tasks such as visual question answering, image description, and image generation, as well as natural language processing tasks such as text-based sentiment classification, text summarization, and machine translation. The main application scenarios of large models can include digital assistants, intelligent robots, search, online education, office software, e-commerce, and intelligent design.

[0059] For example, multiple first prompt words could include: "You are a professional code migration analysis expert, responsible for analyzing code migration from the source repository to the target repository."

[0060] Job Responsibilities:

[0061] 1. Compare and analyze the business logic equivalence between the source difference blocks and the corresponding target code;

[0062] 2. Identify the type of code modification (framework refactoring, business logic refactoring, syntax adaptation, direct migration, etc.);

[0063] 3. Determine whether the business logic has been correctly overridden.

[0064] Multiple secondary cue words can include:

[0065] "The returned content must be in a valid JSON format. Verify that the required fields exist and are of the correct type. Automatically correct common formatting errors (such as extra commas and unclosed parentheses)."

[0066] Focus on business rules and data transformation logic, ignoring non-business differences such as code formatting and comment style.

[0067] In the embodiments of this application, a pre-trained large model is introduced to perform semantic reasoning on the business intent expressed by the source difference block and the implementation status of the target code, to help determine whether the target code has implemented the corresponding function, to provide auxiliary judgment for code migration analysis, and to improve the accuracy of code migration analysis.

[0068] In some embodiments, the method further includes:

[0069] Based on multiple similarity scores, multiple code migration analysis results, and preset state determination rules, multiple comprehensive determination results are obtained; these multiple comprehensive determination results are used as the updated multiple code migration states.

[0070] According to embodiments of this application, the state determination rule indicates the comprehensive determination result under different combinations of similarity and different code migration analysis results, that is, the correspondence between different combinations and different comprehensive determination results.

[0071] For example, the state determination rule can be expressed as:

[0072]

[0073] In the embodiments of this application, the code migration status corresponding to each source difference block is determined by combining the similarity corresponding to each source difference block and the code migration analysis results, and the code migration status calculated in the aforementioned steps is updated to improve the code migration analysis capability and reduce the misjudgment rate in complex migration scenarios.

[0074] In some embodiments, splitting code changes into multiple source difference blocks includes:

[0075] First, based on the multiple change unit identifiers indicating the code change content, the code change content is broken down into multiple change units.

[0076] According to embodiments of this application, a change unit identifier may refer to the code of a change unit, used to distinguish different change units. Multiple change units each have matching business functions and change unit identifiers.

[0077] Furthermore, the code change content can be composed of multiple change units, each with a change unit identifier. By identifying the change unit identifiers in the code change content, the code change content is broken down into multiple change units.

[0078] For example, a change unit can be a code diff block (Hunk block). The change unit identifier can be the Hunk block start marker within the Hunk block.

[0079] Then, change units with the same business functions among multiple change units are merged, and the merged change unit and change units with different business functions among the multiple change units are used as multiple source difference blocks.

[0080] For example, multiple change units with the same code change content that share the same business function are merged into a group, and the merged change unit and change units with different business functions are treated as multiple source difference blocks. The business function can be determined by the code layer in which the change unit is located. The code layer may include the controller layer for handling HTTP requests, the service layer that embodies the business logic, the data access layer, etc.

[0081] In the embodiments of this application, considering business functions and initial identifiers, the code change unit is split into multiple source difference blocks to ensure the rationality of the code change content splitting.

[0082] Furthermore, before splitting the code change content, the method also includes: preprocessing the code change content.

[0083] For example, preprocessing operations may include: using file extension filters to exclude non-source code files, such as binary files, configuration files, etc.; filtering files with specific path patterns using regular expression matching; filtering statistics; and uniformly handling line ending characters (CRLF / LF) across different operating systems and forcibly converting them to UTF-8 encoding to eliminate the impact of environmental differences on subsequent parsing.

[0084] In some embodiments, the change feature includes at least one of change type, change content, and change location, and multiple change features are obtained using the following methods:

[0085] First, based on the logical levels before and after the code changes indicated by multiple code syntax structures, semantic analysis is performed on multiple source difference blocks to obtain the change intentions corresponding to multiple change units.

[0086] According to embodiments of this application, the change characteristics may include change type, change content, and change location. The change intent may include at least one of method body modification, class definition change, and variable declaration, used to indicate the type of program element affected by the change.

[0087] For example, for each source difference block, the code syntax structure can be obtained as follows: First, based on the file path corresponding to the source difference block, retrieve the corresponding source code file before and after the change from the version control repository. Then, select the corresponding language parser according to the file extension of the code file, and use the language parser to process the code file to generate the corresponding abstract syntax tree; the file extension is, for example, .java, .py, .js, and the language parser is, for example, an abstract syntax tree module, a development tool, etc. The abstract syntax tree includes multiple nodes, each node has corresponding line number range information, node type, and source code fragment information, etc. The line number range information is the start line and the end line, for subsequent location.

[0088] For example, for each source difference block, firstly, using the changed line number range, the innermost node whose line number range completely covers the changed line number range in the changed abstract syntax tree is found; similarly, using the original line number range, the innermost node whose line number range completely covers the original line number range in the original abstract syntax tree is found, thus establishing the association between the source difference block and the abstract syntax tree. Then, the abstract syntax tree difference algorithm is used to compare the original and changed abstract syntax trees, outputting fine-grained change operations. Each change operation can include operation type, node type, node content, and line number, etc. Operation types can include insertion, deletion, movement, update, etc., and node types can include method declarations, field declarations, statements, and expressions. Then, based on the correspondence between node types and node intents, the nodes are classified to obtain their intents; for example, if the node type is a method declaration, the node intent can be for modifying the method body; if the node type is a class declaration, the node intent can be for changing the class definition.

[0089] Secondly, the multiple change intentions are classified to obtain the change types corresponding to multiple source difference blocks.

[0090] According to embodiments of this application, the change type includes at least one of business logic adjustment, code framework adaptation, and code refactoring.

[0091] Furthermore, multiple change intentions are classified based on preset classification rules to obtain multiple change types.

[0092] For example, the classification rules may include: when the change intent is to modify the method body, the method signature remains unchanged, the change involves internal logic such as control flow, expressions, and assignments, and no new framework annotations or changes in external API call patterns are introduced, and no obvious signs of refactoring (such as renaming or extracting methods) appear, the change type is business logic adjustment; when the change intent is to change the class definition or method body, the way the framework-specific API is called within the method body changes, and the change matches a predefined framework pattern library, the change type is framework adaptation; when the change intent is to modify the method body or change the variable declaration or name while other parts remain unchanged and all reference points are updated synchronously, the change type can be code refactoring.

[0093] Then, based on multiple change entries for the code changes, multiple changes are obtained.

[0094] According to embodiments of this application, multiple change entries have content hash values ​​corresponding to multiple source difference blocks.

[0095] For example, after displaying the code differences between different versions through a distributed version control system, a list of corresponding change entries can be obtained. This list records multiple change entries, along with the file paths and content hash values ​​before and after the change. The content hash value is then used as the change content of the corresponding source difference block.

[0096] Finally, based on the first and second row number ranges corresponding to multiple source difference blocks, multiple change locations are obtained.

[0097] According to an embodiment of this application, the first line number range represents the line number range before the code change, that is, the starting and ending line numbers before the code change. The second line number range represents the line number range after the code change, that is, the starting and ending line numbers after the code change.

[0098] For example, based on the line type of each line of code within the first and second line number ranges, the line number of the line with the line type of deletion or addition is used as the change location. The line type can be indicated by the line prefix of the code line. For example, a line prefix of "-" indicates a line deleted from the source file; a line prefix of "+" indicates a line added to the target file; and a line prefix of "space" indicates an unchanged context line.

[0099] In the embodiments of this application, semantic analysis of the source difference blocks is performed using the code syntax structure to obtain the change type, and the code change location is determined by the line number range before and after the code change. This achieves accurate identification of the change type, change content, and change location, and fully reflects the change information of each source difference block.

[0100] Figure 3 A flowchart illustrating the process of obtaining target code according to an embodiment of this application is shown.

[0101] Combination Figure 3 In some embodiments, the process of filtering multiple candidate codes 301 to obtain multiple target codes 304 based on multiple change features corresponding to multiple source difference blocks includes the following steps:

[0102] First, a structured parsing is performed on multiple candidate codes 301 to obtain multiple candidate code indices 302.

[0103] According to an embodiment of this application, a plurality of candidate codes 301 are stored in a target repository. A plurality of candidate code indexes 302 indicate the change features of the plurality of candidate codes.

[0104] For example, firstly, multiple candidate codes 301 can be processed using the aforementioned method for obtaining change features to obtain change features corresponding to multiple candidate codes 301; then, the change positions corresponding to multiple candidate codes 301 are used as multiple position indices, for example, the mapping relationship between line numbers and code blocks is used as a position index; the change types corresponding to multiple candidate codes 301 are used as multiple semantic indices; and the change content corresponding to multiple candidate codes 301 is used as a syntax index or lexical index, for example, keywords, identifiers, etc. in the change content are used as lexical indices, and class inheritance trees in the change content are used as lexical indices.

[0105] Based on this, the complexity of target code retrieval is reduced by constructing an index, avoiding real-time traversal of all files and improving search efficiency.

[0106] Then, based on the multiple change types corresponding to multiple source difference blocks, and centered on multiple change locations, multiple search results 303 are obtained by searching in multiple candidate code indices 302.

[0107] For example, for each source difference block, the search can be performed within a certain context, centered on the change location, in the candidate code index with the same change type, to obtain the search results. The context can be 10-20 lines of code before and after, covering the entire method body.

[0108] Finally, the relevance scores between the multiple changes corresponding to the multiple source difference blocks and the multiple search results 303 are calculated. Based on the multiple relevance scores, multiple target codes 304 are obtained by filtering among the multiple search results 303.

[0109] For example, for each source difference block, a relevance score can be obtained by calculating the Pearson correlation coefficient between the changed content corresponding to the source difference block and the corresponding multiple search results. The target code corresponding to the source difference block is then selected from the multiple search results with the highest relevance score.

[0110] In the embodiments of this application, a secondary screening mechanism for target code is designed, taking into account the change type, change location, and change content, to improve the accuracy of target code search; by combining indexing and multi-level search, both performance and accuracy are taken into account.

[0111] Figure 4 A flowchart illustrating the calculation of similarity between multiple source difference blocks and corresponding object code according to an embodiment of this application is shown.

[0112] Combination Figure 4 In some embodiments, calculating multiple similarities 409 between multiple source difference blocks and corresponding object code includes:

[0113] First, calculate multiple lexical similarities 402 between multiple source difference blocks 401 and multiple target codes.

[0114] According to an embodiment of this application, lexical similarity 402 indicates the degree of textual similarity between the source difference block and the corresponding target code.

[0115] For example, for each source difference block, the edit distance between the source difference block and the corresponding target code can be calculated, and the edit distance can be used as lexical similarity to reflect the degree of similarity between the code text in terms of lexical composition.

[0116] Secondly, based on the multiple syntactic structures 403 corresponding to multiple source difference blocks and the multiple syntactic structures 404 corresponding to multiple target codes, multiple syntactic similarities 405 are obtained.

[0117] According to an embodiment of this application, syntactic similarity 405 indicates the degree of structural similarity between the source difference block and the corresponding object code.

[0118] Furthermore, the tree edit distance between the multiple abstract syntax trees corresponding to the multiple source difference blocks and the multiple abstract syntax trees corresponding to the multiple target codes is calculated to obtain multiple syntax similarities of 405.

[0119] For example, for each source difference block, the syntax similarity is... Represented as:

[0120] ;

[0121] In the formula, This indicates that the abstract syntax tree will be used. Convert to abstract syntax tree Minimum required insertion, deletion, and replacement cost Representing an abstract syntax tree The total number of nodes, Representing an abstract syntax tree The total number of nodes.

[0122] Then, based on the multiple business features 406 corresponding to the multiple source difference blocks 401 and the multiple business features 407 corresponding to the multiple target codes 304, multiple business similarities 408 are obtained.

[0123] According to an embodiment of this application, business similarity 408 indicates the degree of functional similarity between the source difference block and the corresponding object code.

[0124] For example, for each source difference block, firstly, business feature vectors are extracted from the source difference block and the corresponding target code. For instance, programming language keywords (such as if, for), identifiers (variable names, method names, class names), literals (strings, numbers), and business descriptions in comments are extracted from the source difference block and the corresponding target code, and this information is converted into numerical vectors as business feature vectors. Then, the cosine similarity between the two business feature vectors is calculated and used as the business similarity.

[0125] Finally, multiple lexical similarities (402), multiple syntactic similarities (405), and multiple business similarities (408) are merged to obtain multiple similarities (409).

[0126] For example, for each source difference block, the corresponding lexical similarity, syntactic similarity and business similarity are weighted and fused to obtain the similarity.

[0127] In the embodiments of this application, lexical similarity is calculated at the text level, syntactic similarity is calculated at the syntactic structure level, and functional similarity is calculated at the business function level. This comprehensive evaluation of the similarity between the source difference block and the target code improves the accuracy of similarity calculation.

[0128] In some embodiments, obtaining code migration coverage based on multiple code migration states includes:

[0129] Code migration coverage is obtained based on the number of migrated states in multiple code migration states and the total number of multiple code migration states.

[0130] According to embodiments of this application, the number of migrated states among multiple code migration states can characterize the number of source difference blocks that have completed migration. The number of multiple code migration states is also the total number of source difference blocks.

[0131] For example, code migration coverage Represented as:

[0132] ;

[0133] In the formula, This indicates the number of migrated states out of multiple code migration states. This represents the total number of code migration states.

[0134] In the embodiments of this application, the migration coverage of code change content is quantified by utilizing the code migration status of the source difference block, thereby achieving a quantitative evaluation of the migration status of code change content.

[0135] Based on the above-described code migration analysis method, embodiments of this application also provide a code migration analysis apparatus. The following will be combined with... Figure 5 The device is described in detail.

[0136] Figure 5 A schematic block diagram of a code migration analysis apparatus according to an embodiment of this application is shown.

[0137] like Figure 5 As shown, the code migration analysis device 500 of this embodiment includes a parsing module 510, a filtering module 520, and an analysis module 530.

[0138] The parsing module 510 is used to split the code change content into multiple source difference blocks, whereby the code change content represents all code differences within a preset time range. In one embodiment, the parsing module 510 can be used to perform step S210 described above, which will not be repeated here.

[0139] The filtering module 520 is used to filter multiple candidate codes based on multiple change features corresponding to multiple source difference blocks, thereby obtaining multiple target codes. In one embodiment, the filtering module 520 can be used to perform step S220 described above, which will not be repeated here.

[0140] The analysis module 530 is used to calculate multiple similarities between multiple source difference blocks and their corresponding target code. Based on multiple similarity levels corresponding to the multiple similarities and preset state mapping rules, multiple code migration states corresponding to the multiple source difference blocks are obtained, and code migration coverage is obtained based on the multiple code migration states. In one embodiment, the analysis module 530 can be used to execute step S230 described above, which will not be repeated here.

[0141] According to an embodiment of this application, the device further includes a processing module, which is used to guide a large model to process multiple source difference blocks and multiple target codes based on a preset code migration analysis process indicated by multiple first prompt words and constraints indicated by multiple second prompt words, so as to obtain multiple code migration analysis results corresponding to multiple source difference blocks.

[0142] According to an embodiment of this application, the device further includes an acquisition module, which is used to obtain multiple comprehensive judgment results based on multiple similarities, multiple code migration analysis results and preset state judgment rules. The state judgment rules indicate the comprehensive judgment results under different combinations of similarities and different code migration analysis results; and use the multiple comprehensive judgment results as updated multiple code migration states.

[0143] According to an embodiment of this application, the parsing module 510 includes a splitting submodule, which is used to split the code change content into multiple change units based on multiple change unit identifiers indicated by the code change content. Each of the multiple change units has a matching business function. The change units with the same business function among the multiple change units are merged, and the merged change unit and the change units with different business functions among the multiple change units are used as multiple source difference blocks.

[0144] According to an embodiment of this application, the filtering module 520 includes a first acquisition submodule. The first acquisition submodule is used to perform semantic analysis on multiple source difference blocks based on the logical hierarchy before and after the code change indicated by the code syntax structure, to obtain the change intentions corresponding to the multiple source difference blocks. The change intentions include at least one of method body modification, class definition change, and variable declaration. The multiple change intentions are classified to obtain the change types corresponding to the multiple source difference blocks. The change types include at least one of business logic adjustment, code framework adaptation, and code refactoring. Based on multiple change entries of the code change content, multiple change contents are obtained. The multiple change entries have content hash values ​​corresponding to the multiple source difference blocks. Based on the first line number range and the second line number range corresponding to the multiple source difference blocks, multiple change positions are obtained. The first line number range represents the line number range before the code change, and the second line number range represents the line number range after the code change.

[0145] According to an embodiment of this application, the filtering module 520 further includes a second acquisition submodule, which is used to perform structured parsing on multiple candidate codes to obtain multiple candidate code indices, the multiple candidate code indices indicating the change features of the multiple candidate codes; based on multiple change types corresponding to multiple source difference blocks, and centered on multiple change locations, to search in the multiple candidate code indices to obtain multiple search results; to calculate the relevance score between the multiple change contents corresponding to multiple source difference blocks and the multiple search results, and to filter in the multiple search results based on the multiple relevance scores to obtain multiple target codes.

[0146] According to an embodiment of this application, the analysis module 530 includes a first calculation submodule, which is used to calculate lexical similarity between multiple source difference blocks and multiple target codes, wherein lexical similarity indicates the degree of textual similarity between the source difference blocks and the corresponding target codes; based on multiple syntactic structures corresponding to the multiple source difference blocks and multiple syntactic structures corresponding to the multiple target codes, multiple syntactic similarities are obtained, wherein syntactic similarities indicate the degree of structural similarity between the source difference blocks and the corresponding target codes; based on multiple business features corresponding to the multiple source difference blocks and multiple business features corresponding to the multiple target codes, multiple business similarities are obtained, wherein business similarities indicate the degree of functional similarity between the source difference blocks and the corresponding target codes; and multiple lexical similarities, multiple syntactic similarities and multiple business similarities are fused to obtain multiple similarities.

[0147] According to an embodiment of this application, the analysis module 530 further includes a second calculation submodule, which is used to obtain the code migration coverage based on the number of migrated states in the multiple code migration states and the number of multiple code migration states.

[0148] According to embodiments of this application, any plurality of modules among the parsing module 510, the filtering module 520, and the analysis module 530 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least a portion of the functionality of one or more of these modules can be combined with at least a portion of the functionality of other modules and implemented in one module. According to embodiments of this application, at least one of the parsing module 510, the filtering module 520, and the analysis module 530 can be at least partially implemented as a hardware circuit, such as a field-programmable gate array, a programmable logic array, a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit, or any other reasonable means of integrating or packaging the circuit, or implemented in software, hardware, or firmware, or in any appropriate combination of any of these three implementation methods. Alternatively, at least one of the parsing module 510, the filtering module 520, and the analysis module 530 can be at least partially implemented as a computer program module, which can perform corresponding functions when the computer program module is run.

[0149] Figure 6 A block diagram schematically illustrates an electronic device suitable for implementing a code migration analysis method according to an embodiment of this application.

[0150] like Figure 6As shown, an electronic device 600 according to an embodiment of this application includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory 602 or a program loaded from a storage portion 608 into a random access memory 603. The processor 601 may include, for example, a general-purpose microprocessor, an instruction set processor and / or an associated chipset and / or a dedicated microprocessor. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for executing different steps of the method flow according to an embodiment of this application.

[0151] Random access memory 603 stores various programs and data required for the operation of electronic device 600. Processor 601, read-only memory 602, and random access memory 603 are interconnected via bus 604. Processor 601 executes various steps of the method flow according to embodiments of this application by executing programs in read-only memory 602 and / or random access memory 603. It should be noted that the programs may also be stored in one or more memories other than read-only memory 602 and random access memory 603. Processor 601 may also execute various steps of the method flow according to embodiments of this application by executing programs stored in said one or more memories.

[0152] According to embodiments of this application, the electronic device 600 may further include an input / output interface 605, which is also connected to a bus 604. The electronic device 600 may also include one or more of the following components connected to the input / output interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube, liquid crystal display, etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card, such as a local area network card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 610 as needed so that computer programs read from it can be installed into the storage section 608 as needed.

[0153] Embodiments of this application also provide a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.

[0154] According to embodiments of this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including but not limited to: portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof. In embodiments of this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this application, the computer-readable storage medium may include the read-only memory 602 described above, and / or random access memory 603, and / or one or more memories other than read-only memory 602 and random access memory 603.

[0155] Embodiments of this application also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of this application.

[0156] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0157] In embodiments of this application, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by processor 601, it performs the functions defined in the system of embodiments of this application. According to embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0158] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0159] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0160] Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, the features described in the various embodiments of this application can be combined and / or combined in various ways without departing from the spirit and teachings of this application. All such combinations and / or combinations fall within the scope of this application.

Claims

1. A code migration analysis method characterized by, The method includes: The code changes are broken down into multiple source difference blocks, which represent all code differences within a preset time range; Based on the multiple change features corresponding to the multiple source difference blocks, multiple candidate codes are filtered to obtain multiple target codes. Each of the multiple candidate codes has a multi-level index corresponding to the change features, and the change features indicate the code change information of the corresponding source difference block. Calculate multiple similarities between the multiple source difference blocks and the corresponding target code. Based on the multiple similarity levels corresponding to the multiple similarities and the preset state mapping rules, obtain multiple code migration states corresponding to the multiple source difference blocks. Based on the multiple code migration states, obtain the code migration coverage. The state mapping rules indicate the correspondence between similarity levels and code migration states.

2. The method of claim 1, wherein, The method further includes: Based on a pre-defined code migration analysis process indicated by multiple first prompt words and constraints indicated by multiple second prompt words, the large model is guided to process the multiple source difference blocks and the multiple target codes, thereby obtaining multiple code migration analysis results corresponding to the multiple source difference blocks.

3. The method according to claim 2, characterized in that, The method further includes: Based on the multiple similarities, the multiple code migration analysis results, and the preset state determination rules, multiple comprehensive determination results are obtained. The state determination rules indicate the comprehensive determination results under different combinations of similarities and different code migration analysis results. The multiple comprehensive judgment results are used as the updated multiple code migration states.

4. The method according to claim 1, characterized in that, The step of splitting the code change content into multiple source difference blocks includes: Based on the multiple change unit identifiers indicated by the code change content, the code change content is divided into multiple change units, each of which has a matching business function; The change units with the same business functions among the multiple change units are merged, and the merged change unit and the change units with different business functions among the multiple change units are used as multiple source difference blocks.

5. The method according to claim 1, characterized in that, The change features include at least one of change type, change content, and change location, and the multiple change features are obtained using the following method: Based on the logical hierarchy before and after code changes indicated by multiple code syntax structures, semantic analysis is performed on the multiple source difference blocks to obtain the change intentions corresponding to the multiple source difference blocks. The change intentions include at least one of method body modification, class definition change, and variable declaration. Multiple change intentions are classified to obtain the change types corresponding to the multiple source difference blocks. The change types include at least one of business logic adjustment, code framework adaptation, and code refactoring. Based on multiple change entries of the code change content, multiple change contents are obtained, and the multiple change entries have content hash values ​​corresponding to the multiple source difference blocks; Based on the first line number range and the second line number range corresponding to the multiple source difference blocks, multiple change locations are obtained. The first line number range represents the line number range before the code change, and the second line number range represents the line number range after the code change.

6. The method according to claim 1, characterized in that, The change features include at least one of change type, change content, and change location. The process of filtering from multiple candidate codes based on the multiple change features corresponding to the multiple source difference blocks to obtain multiple target codes includes: The multiple candidate codes are subjected to structured parsing to obtain multiple candidate code indices, which indicate the change characteristics of the multiple candidate codes; Based on the multiple change types corresponding to the multiple source difference blocks, and taking multiple change locations as the center, multiple search results are obtained by searching in multiple candidate code indices. Calculate the relevance scores between the multiple changes corresponding to the multiple source difference blocks and the multiple search results, and filter the multiple search results based on the multiple relevance scores to obtain multiple target codes.

7. The method according to claim 1, characterized in that, The calculation of multiple similarities between the multiple source difference blocks and the corresponding target code includes: Calculate the lexical similarity between the plurality of source difference blocks and the plurality of target codes, wherein the lexical similarity indicates the degree of text similarity between the source difference blocks and the corresponding target codes; Based on the multiple syntactic structures corresponding to the multiple source difference blocks and the multiple syntactic structures corresponding to the multiple target codes, multiple syntactic similarities are obtained, and the syntactic similarities indicate the degree of structural similarity between the source difference blocks and the corresponding target codes; Based on the multiple business features corresponding to the multiple source difference blocks and the multiple business features corresponding to the multiple target codes, multiple business similarities are obtained, and the business similarities indicate the degree of functional similarity between the source difference blocks and the corresponding target codes; The multiple lexical similarities, the multiple syntactic similarities, and the multiple business similarities are fused to obtain the multiple similarities.

8. The method according to any one of claims 1 to 7, characterized in that, The process of obtaining code migration coverage based on the multiple code migration states includes: The code migration coverage is obtained based on the number of migrated states among the multiple code migration states and the total number of multiple code migration states.

9. A code migration analysis device, characterized in that, The device includes: The parsing module is used to break down the code change content into multiple source difference blocks, wherein the code change content represents all code differences within a preset time range; A filtering module is used to filter multiple candidate codes based on multiple change features corresponding to the multiple source difference blocks to obtain multiple target codes. Each of the multiple candidate codes has a multi-level index corresponding to a change feature, and the change feature indicates the code change information of the corresponding source difference block. The analysis module is used to calculate multiple similarities between the multiple source difference blocks and the corresponding target code, and based on the multiple similarity levels corresponding to the multiple similarities and the preset state mapping rules, to obtain multiple code migration states corresponding to the multiple source difference blocks, and to obtain the code migration coverage based on the multiple code migration states. The state mapping rules indicate the correspondence between similarity levels and code migration states.

10. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 8.

12. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 8.