Code adoption rate determination method and device, medium, electronic equipment and product
By acquiring the code of a distributed version control system and an intelligent programming assistant, and using multi-dimensional feature similarity and code evolution relationship modeling, the problem of difficulty in quantifying the contribution of AI-generated code was solved, and accurate code adoption rate assessment and in-depth analysis were achieved.
Patent Information
- Application Number
- CN202511607523.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-11-05
AI Technical Summary
The existing technology has the problem of difficulty in accurately quantifying and evaluating the actual contribution of artificial intelligence to code generation in the software development process. Traditional methods cannot distinguish the source of the code, have a single evaluation dimension, and cannot deeply analyze the subsequent evolution process of the code.
By acquiring the modified code from the distributed version control system and the response code generated by the intelligent programming assistant, and utilizing multi-dimensional feature similarity calculation and code evolution relationship modeling, the homology between code pairs can be determined, thereby enabling an accurate assessment of the code adoption rate.
It enables accurate quantitative assessment of the contribution of AI-generated code, identifies code adoption patterns and provides in-depth insights, thus improving the scientific rigor and comprehensiveness of the assessment.
Smart Images

Figure CN121050713B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of software engineering, and in particular to a code adoption rate determination method and device, a medium, an electronic device and a product. BACKGROUND
[0002] In recent years, with the rapid development of deep learning technology, artificial intelligence (AI), especially large language models (LLM), has been increasingly widely applied in the field of software engineering. AI programming assistants represented by GitHub Copilot and Tongyi Ling Code can automatically generate code snippets, functions and even entire modules based on context, greatly changing the traditional software development paradigm. Developers can significantly improve coding efficiency and shorten development cycles by collaborating with AI.
[0003] However, this new human-machine collaboration mode also brings new challenges. After introducing AI-assisted programming tools, enterprises and R&D teams urgently need a scientific and objective method to quantify the real value brought by them. Therefore, the related art has the problem that the actual contribution of the code generated by artificial intelligence in the software development process is difficult to accurately quantify and evaluate.
[0004] Therefore, the problem that the actual contribution of the code generated by artificial intelligence in the software development process is difficult to accurately quantify and evaluate in the related art has not been effectively solved. SUMMARY
[0005] The present application provides a code adoption rate determination method and device, a medium, an electronic device and a product to at least solve the problem that the actual contribution of the code generated by artificial intelligence in the software development process is difficult to accurately quantify and evaluate in the related art.
[0006] The present application provides a code adoption rate determination method, comprising: obtaining first changed code of a distributed version control system in a first time range, and obtaining first response code corresponding to the first changed code generated by an intelligent programming assistant; in the first response code, determining a candidate set related to each line of code in the first changed code, and determining a code pair having a homologous relationship between the first changed code and the first response code through each line of code in the first changed code and the candidate set; and determining a code adoption rate of the first response code through the code pair.
[0007] The application further provides a code adoption rate determination device, comprising: an acquisition module, configured to acquire first changed code of a distributed version control system within a first time range and acquire first response code corresponding to the first changed code generated by an intelligent programming assistant; a first determination module, configured to determine a candidate set related to each line of code in the first changed code in the first response code, and determine a code pair having a homologous relationship between the first changed code and the first response code through each line of code in the first changed code and the candidate set; and a second determination module, configured to determine a code adoption rate of the first response code through the code pair.
[0008] The application further provides an electronic device, comprising: a memory configured to store a computer program; and a processor configured to implement steps of the code adoption rate determination method when executing the computer program.
[0009] The application further provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is configured to implement steps of the code adoption rate determination method when executed by a processor.
[0010] The application further provides a computer program product, comprising a computer program, and the computer program is configured to implement steps of the code adoption rate determination method when executed by a processor.
[0011] According to the application, the first changed code of the distributed version control system within the first time range is acquired, and the first response code corresponding to the first changed code generated by the intelligent programming assistant is acquired; the candidate set related to each line of code in the first changed code is determined in the first response code, and the code pair having the homologous relationship between the first changed code and the first response code is determined through each line of code in the first changed code and the candidate set; and the code adoption rate of the first response code is determined through the code pair. According to the application, the problem that the actual contribution of the code generated by the artificial intelligence in the software development process is difficult to accurately quantify and evaluate in the related art is solved, and the effect of accurately evaluating the contribution of the code generated by the artificial intelligence is achieved. BRIEF DESCRIPTION OF DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the application, the drawings required to be used in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0013] Figure 1 FIG. 1 is a hardware structure block diagram of a computer terminal of a code adoption rate determination method according to an embodiment of the application.
[0014] Figure 2 is a flow chart of a code adoption rate determination method according to an embodiment of the present application;
[0015] Figure 3 is a system architecture diagram according to an optional embodiment of the present application;
[0016] Figure 4 is a framework diagram of a code adoption rate determination apparatus according to an embodiment of the present application. DETAILED DESCRIPTION
[0017] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0018] It should be noted that, in the description of the present application, the terms “comprise”, “contain” or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. The terms “first”, “second” and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0019] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0020] In combination with the specific application environment architecture or specific hardware architecture on which the code adoption rate determination method is executed, the specific application environment architecture or specific hardware architecture is described here.
[0021] The method embodiments provided in the embodiments of the present application can be executed in a server device, a mobile terminal, a computer terminal or similar computing device. Taking the case of running on a computer terminal, Figure 1 is a hardware structure block diagram of a computer terminal of a code adoption rate determination method according to an embodiment of the present application. As Figure 1 shown, the computer terminal can include one or more ( Figure 1The computer terminal shown in FIG. 1 includes one processor 102 (the processor 102 can include, but is not limited to, a processing device such as a Central Processing Unit (CPU), a MicroProcessor Unit (MPU), or a Programmable Logic Device (PLD)), and a memory 104 for storing data. The computer terminal can also include a transmission device 106 for communication functions, and an input / output device 108. Those skilled in the art can understand that Figure 1 The structure shown in FIG. 1 is merely illustrative, and does not limit the structure of the computer terminal. For example, the computer terminal can include more or fewer components than those shown in FIG. 1, or have a different configuration than that shown in FIG. 1. Figure 1 Figure 1 The structure shown in FIG. 1 is merely illustrative, and does not limit the structure of the computer terminal. For example, the computer terminal can include more or fewer components than those shown in FIG. 1, or have a different configuration than that shown in FIG. 1.
[0022] The memory 104 can be used to store computer programs, such as software programs of application software and modules, such as a computer program corresponding to the method for determining an interaction state in the embodiments of the present application. The processor 102 can execute various functional applications and data processing by running the computer programs stored in the memory 104, i.e., implement the method described above. The memory 104 can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, a flash memory, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor 102, and the remote memory can be connected to the computer terminal through a network. Examples of the network can include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0023] The transmission device 106 is used to receive or send data via a network. Specific examples of the network can include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a network adapter (NIC) that can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module used to communicate with the Internet in a wireless manner.
[0024] Figure 2 FIG. 2 is a flowchart of a method for determining a code adoption rate according to an embodiment of the present application, which can be applied to the computer terminal shown in FIG. 1, and the flowchart includes the following steps: Figure 1 Figure 2
[0025] In step S202, first changed code of the distributed version control system in a first time range is obtained, and first response code corresponding to the first changed code generated by the intelligent programming assistant is obtained.
[0026] Optionally, the intelligent programming assistant is also referred to as an AI programming assistant.
[0027] In step S204, in the first response code, a candidate set related to each line of code in the first changed code is determined, and a code pair having a homologous relationship between the first changed code and the first response code is determined through each line of code in the first changed code and the candidate set.
[0028] In step S206, a code adoption rate of the first response code is determined through the code pair.
[0029] Through the above steps, the first changed code of the distributed version control system in the first time range is obtained, and the first response code corresponding to the first changed code generated by the intelligent programming assistant is obtained; in the first response code, a candidate set related to each line of code in the first changed code is determined, and a code pair having a homologous relationship between the first changed code and the first response code is determined through each line of code in the first changed code and the candidate set; and a code adoption rate of the first response code is determined through the code pair. Through the present application, the problem that the actual contribution of the code generated by artificial intelligence in the software development process is difficult to accurately quantify and evaluate in the related art is solved, and the effect of accurately evaluating the contribution of the code generated by artificial intelligence is achieved.
[0030] In one exemplary embodiment, obtaining the first changed code of the distributed version control system in the first time range includes: determining second changed code in original code through a state machine parsing algorithm, wherein the original code is original code of the distributed version control system in the first time range, and the second changed code is changed code in one submission to the same file; and inserting a preset separator between a plurality of second changed codes to obtain the first changed code.
[0031] Further, determining the second changed code in the original code through the state machine parsing algorithm includes: identifying meta-information lines in the original code based on a preset field through the state machine parsing algorithm; and performing line prefix identification on code lines in the original code except the meta-information lines to obtain the second changed code.
[0032] Optionally, the original code (also referred to as original data) of a distributed version control system (Git) is obtained. Meta information lines in the original code are ignored, wherein preset fields used to identify the meta information lines include `diff --git`, `index`, `---`, `+++`. Line prefixes are identified for the original code excluding the meta information lines, the line prefixes being specific line prefixes in patch format, which can be `+` representing addition, `-` representing deletion, and ` ` (space) representing context, etc.
[0033] Through the above first change code extraction scheme, all change codes of one commit in Git can be accurately extracted, and the change codes of different commits can be clearly distinguished through delimiters, thereby laying a solid data foundation for efficient code analysis.
[0034] In an example embodiment, the first response code corresponding to the first change code generated by the intelligent programming assistant is obtained, including: determining log data corresponding to the first change code generated by the intelligent programming assistant; identifying a code block in the log data in a preset format; and performing a standardization processing procedure on code lines in the code block in the preset format to obtain the first response code.
[0035] That is, a code block in a document markup format (Markdown, equivalent to the preset format in the above embodiment) is identified from the log data. The code block in the document markup format is usually wrapped by three back ticks (`\`\` `). The standardization processing procedure includes: removing white spaces at the beginning and end of a line; replacing multiple consecutive white spaces (spaces, tabs) with a single space; and removing blank lines and pure comment lines (configurable). This standardization operation ensures that only the valid content of the code itself is used for subsequent analysis.
[0036] In an example embodiment, in the first response code, a candidate set related to each code line in the first change code is determined, including: obtaining second response code in a time window corresponding to a second time range in the first response code, wherein the first time range includes the second time range, and the second time range is a preset time granularity for determining the candidate set related to each code line in the first change code; constructing an inverted index corresponding to the second response code; and retrieving K code lines with the highest relevance to each code line in the third change code in the inverted index to obtain the candidate set related to each code line in the first change code, wherein K is a positive integer, and the third change code is code in the first change code within the second time range.
[0037] Optionally, the second time range can be 1 day. For the first response code, the basic semantic unit (Token) of the first response code can be extracted and stored in the "global line storage" in the memory. When analyzing each day, the system will first filter out the second response code in the time window from the "global line storage" according to the current date, and then build an inverted index of the second response code. For each line of code in the third change code of each day, the K code lines with the highest relevance to each line of code in the third change code are retrieved from the inverted index, so that the candidate set of each line of code in the third change code includes the K code lines.
[0038] The above candidate set determination scheme quickly finds AI-generated code lines highly relevant to code changes by building an inverted index and using a time window, greatly accelerating the code matching process and improving the efficiency of data analysis.
[0039] In an exemplary embodiment, determining the code pairs having homologous relationship between the first change code and the first response code through each line of code in the first change code and the candidate set comprises: determining the multi-dimensional feature representation corresponding to each line of code in the first change code and each line of code in the candidate set, respectively, wherein the multi-dimensional feature representation comprises at least one of the following: code text, structural pattern and semantic element; determining the multi-dimensional similarity between each line of code in the first change code and each line of code in the candidate set through the multi-dimensional feature representation, respectively, wherein the multi-dimensional similarity comprises at least one of the following: text similarity, structural similarity and semantic similarity; and performing weighted calculation on the multi-dimensional similarity to determine the code pairs having homologous relationship between the first change code and the first response code through the obtained similarity score.
[0040] It can be understood that in the present application, the homologous relationship refers to the similarity or direct adoption relationship between the code generated by AI and the code later submitted by human developers in a distributed version control system (such as Git). Specifically, the homologous relationship refers to a piece of code (whether it is a function, a module or a simple code line) that is initially generated by AI and recommended to developers, and then the piece of code or its modified version is adopted by developers and submitted to the version control repository of the software project.
[0041] The embodiments of the present application accurately determine the homologous relationship between AI-generated code and actually submitted code through weighted calculation of multi-dimensional feature similarity, ensuring the depth and comprehensiveness of evaluation.
[0042] Optionally, before determining the multi-dimensional feature representation corresponding to each line of code in the first changed code and each line of code in the candidate set respectively, the method further comprises: detecting a programming language type to which the target code belongs through a file suffix of a file to which the target code belongs or a lexical analyzer, wherein the target code comprises one of the first changed code and the first response code; and extracting a basic semantic unit of the target code according to a character length of a code line in the target code.
[0043] Embodiments of the present application maintain a mapping table from common file suffixes to standard programming language names, for example, `.py` corresponds to `Python` and `.js` corresponds to `JavaScript`. After recognizing the file suffix, the programming language type can be determined by querying the mapping table. When the file extension is missing or cannot be recognized, the content of the code fragment itself is analyzed using a mature lexical analysis library (such as `Pygments`). `Pygments` can guess the most likely programming language according to the characteristics of lexical units such as keywords, operators, and literals appearing in the code.
[0044] For Token extraction, embodiments of the present application can automatically select the optimal Token extraction method according to the character length of the code line (i.e., the target code). For simple code lines with a length less than a preset threshold (e.g., 100 characters), a set of optimized regular expressions is used for fast extraction. For long and complex code lines that exceed the threshold, the lexical analyzer of `Pygments` is called for more accurate but slightly more expensive extraction. This adaptive strategy achieves an excellent balance between accuracy and performance.
[0045] Further, the multi-dimensional similarity between each line of code in the first changed code and each line of code in the candidate set is determined through the multi-dimensional feature representation, comprising: in the case that the multi-dimensional similarity includes a text similarity, calculating a lexical edit distance between each line of code in the first changed code and each line of code in the candidate set, and determining an intermediate value of the text similarity through the lexical edit distance; determining matching code lines in the front and back N lines of code, wherein the front and back N lines of code include the front N lines of code and the back N lines of code of each line of code in the candidate set in the code block to which the line of code belongs, and the matching code lines are code lines in the front and back N lines of code that have the homology relationship with the first changed code; in the case that the matching code lines are continuous and the number of the matching code lines meets a preset number, rewarding the intermediate value to obtain the text similarity, wherein the preset number is related to N, and N is a positive integer.
[0046] Optionally, the text similarity can also be directly determined by the lexical edit distance. After the similarity score corresponding to each line of code in the candidate set is calculated by weighting the text similarity, the structural similarity and the semantic similarity, the matching line of code in the front and back N lines of code is determined; in the case that the matching line of code is continuous and the number meets the preset number, the similarity score corresponding to each line of code in the candidate set is rewarded to obtain the post-reward score; in the case that the post-reward score is higher than the adoption threshold, it is determined that each line of code in the first changed code and the code line corresponding to the post-reward score have the homology relationship.
[0047] Optionally, the lexical edit distance can be converted into a text similarity or an intermediate value of the text similarity.
[0048] Further, the multi-dimensional similarity between each line of code in the first changed code and each line of code in the candidate set is determined by the multi-dimensional feature representation, including: in the case that the multi-dimensional similarity includes a structural similarity, determining the first structural mode and the second structural mode to which each line of code in the first changed code and each line of code in the candidate set respectively belong; in the case that the first structural mode and the second structural mode are the same, determining that the structural similarity is a first value; in the case that the first structural mode and the second structural mode are similar, determining that the structural similarity is a second value, wherein the second value is less than the first value; in the case that the first structural mode and the second structural mode are different, determining that the structural similarity is a third value, wherein the third value is less than the second value.
[0049] If two lines of code (i.e., each line of code in the first changed code and each line of code in the candidate set) belong to the same structural mode, the structural similarity score is higher, which makes the matching effectively resist the pure text difference caused by variable renaming, etc. Specifically, if the structure of two lines of code is exactly the same, such as both belonging to variable assignment, a full score can be recorded, usually 1.0 or 100% (equivalent to the first value); if the two lines of code are different, for example, one is variable assignment and the other is if / else conditional statement, it can be 0 or close to 0, such as 0.1 (equivalent to the third value); if the two lines of code are similar, such as if and elseif, or for and while, i.e., the functions are close, it can be a score between 0-1, such as 0.5 (equivalent to the second value).
[0050] Further, the method further includes determining a multi-dimensional similarity between each line of code in the first changed code and each line of code in the candidate set according to the multi-dimensional feature representation, including: in a case where the multi-dimensional similarity includes a semantic similarity, extracting a first set of semantic elements and a second set of semantic elements from each line of code in the first changed code and each line of code in the candidate set, respectively; calculating a similarity index of the first set of semantic elements and the second set of semantic elements, and determining the similarity index as the semantic similarity.
[0051] The similarity index is a Jaccard index, that is, an intersection and a union of the first set of semantic elements and the second set of semantic elements are taken respectively, and the similarity index is calculated by the intersection and the union to obtain the semantic similarity.
[0052] Specifically, the multi-dimensional similarity is weighted and calculated to determine a code pair having a homology relationship between the first changed code and the first response code according to a similarity score obtained, including: weighted sum of the multi-dimensional similarity is obtained to obtain the similarity score; the similarity score is compared with an adoption threshold; in a case where the similarity score is higher than the adoption threshold, it is determined that each line of code in the first changed code and a code line corresponding to the similarity score is the code pair having the homology relationship. Optionally, the weights of the text similarity, the structural similarity and the semantic similarity can be 0.5, 0.3 and 0.2 in turn.
[0053] Specifically, the code adoption rate of the first response code is determined according to the code pair, including: determining a first number of the code pair, and determining a second number of code lines included in the first response code; the code adoption rate is determined by a ratio of the first number to the second number.
[0054] In an exemplary embodiment, after the code pair having the homology relationship between the first changed code and the first response code is determined by each line of code in the first changed code and the candidate set, the method further includes: in a case where a file to which the first code line belongs is submitted for modification, determining an evolution operation graph corresponding to the file, wherein the code pair includes: a first code line belonging to the first changed code, and a second code line belonging to the first response code; and determining an adoption mode of the second code line according to the evolution operation graph.
[0055] Further, the evolution operation graph corresponding to the file is determined, including: abstract syntax trees are respectively generated for the new version file and the old version file before and after modification; differences between the abstract syntax trees respectively corresponding to the new version file and the old version file are compared, and the evolution operation graph corresponding to the file is constructed through the differences, wherein the evolution operation graph takes a code segment to be modified as a node, and takes an evolution operation on the code segment as an edge, and the evolution operation includes: a refactoring operation, a deletion operation, and a bug fixing operation.
[0056] After the abstract syntax trees (AST) respectively corresponding to the new version file and the old version file are obtained, a special AST difference algorithm, such as a related method in a library such as libCST or diff-match-patch, can be used to compare the two ASTs before and after modification. These algorithms can intelligently identify the addition, deletion, change and movement of nodes, thereby accurately identifying which parts of the code are modified, refactored or fixed.
[0057] During the AST difference comparison process, each type of difference (i.e., evolution operation) is labeled, including: (1) variable / function renaming (Rename): the node type does not change, but the node name changes. (2) Logic refactoring (Refactor): a subtree is replaced by a new subtree that is semantically equivalent but structurally different. (3) Bug fixing (BugFix): usually manifested as a change in the boundary of a conditional statement, a change in an operator, or the addition of new logic in the original code block. (4) Function enhancement (Enhancement): new function calls or logic branches are added to the original code block.
[0058] Based on the AST difference result, a graph structure is created, taking code segments as nodes and evolution operations as edges. Each node represents a specific code segment (which may be a function, a class, or an independent code line), and the edges represent the evolution operations between these segments, such as refactoring, deletion, and fixing. As new versions are continuously submitted, the system will continuously update the evolution operation graph to reflect the latest code state. The evolution operation graph can intuitively reflect the trajectory of code evolution over time, helping to identify code change patterns and quality evolution.
[0059] Further, the adoption mode of the second code line is determined through the evolution operation graph, including: a target node including the first code line in the evolution operation graph is determined; and the adoption mode of the second code line is determined through the target node and the evolution operation type of the edge connected to the target node.
[0060] Optionally, the adoption mode includes the following modes 1 to 4:
[0061] Pattern One: Prototype-Inspired Adoption: The AI-generated code undergoes a large number of modifications, refactorings, and optimizations shortly after its adoption. This indicates that the developer treated the AI code as a working "prototype" or "inspiration" and performed a significant amount of secondary creation on top of it. This is a high-quality adoption pattern.
[0062] Count the number and types of all incoming and outgoing edges of all target nodes that include the second code line during the time window. If the number of edges is large and the types are biased towards modifications, refactorings, and optimizations, classify it as Pattern One. For example, if the total number of modification, refactoring, and optimization type edges accounts for 70% of all incoming and outgoing edges, classify the adoption pattern of the second code line as Pattern One.
[0063] Pattern Two: Utility-Function Adoption: The AI-generated code (usually a standalone function or class) is adopted and remains largely unmodified for a long period of time but is frequently called by multiple different places in the project. This indicates that the AI generated a stable, reliable utility code whose value is amplified by being reused.
[0064] Count the number and types of all incoming and outgoing edges of all target nodes that include the second code line during the time window. If the number of edges is large and the types are biased towards modifications, refactorings, and optimizations, classify it as Pattern One. For example, if the total number of modification, refactoring, and optimization type edges accounts for 70% of all incoming and outgoing edges, classify the adoption pattern of the second code line as Pattern One.
[0065] Pattern Three: Temporary-Patch Adoption: The AI-generated code is adopted and soon after, it is completely removed in a large-scale refactoring. This may indicate that the AI code only solved a temporary problem or that its quality was insufficient for long-term existence in the codebase.
[0066] Track the time from when the second code line was adopted to its last appearance in the codebase based on the evolution operation graph. If this time period is short and the last appearance is accompanied by a large-scale refactoring or deletion operation (such as the last target node's incoming and outgoing edges being refactoring or deletion operations in the evolution operation graph), then classify it as Pattern Three.
[0067] Pattern Four: Defect-Introducing Adoption: The AI-generated code is adopted and subsequent commits related to it are explicitly labeled as "Fix" or code evolution analysis shows that it introduced logical vulnerabilities. This is a negative adoption pattern, and identifying it is crucial for assessing the risks of AI tools.
[0068] In any target node is marked as "Fix", then determine that the second code line belongs to pattern four. Also, for example, find the edge from the target node pointing to the operation marked as Fix ("Fix") in the evolution operation graph. If such an edge exists, then adopt the pattern as pattern four.
[0069] Through the above steps, not only the homology relationship between the AI generated code and the actual submitted code can be determined, but also the specific mode of the adopted AI code can be intelligently identified by constructing and analyzing the evolution operation graph of the code snippet, including the prototype heuristic, tool function, temporary patch or defect introduction, thereby providing deep insights into the quality and impact of the AI code contribution.
[0070] In an exemplary embodiment, after determining the code adoption rate of the first response code by the code pair, the method further comprises: obtaining the adoption mode of the second code line belonging to the first response code in the code pair; and outputting an evaluation report of the intelligent programming assistant in the first time range by the code adoption rate and the adoption mode.
[0071] In order to better understand the process of the above-mentioned code adoption rate determination method, the implementation process of the above-mentioned code adoption rate determination method will be described in combination with optional embodiments below, but not used to limit the technical solutions of the embodiments of the present application.
[0072] In recent years, with the rapid development of deep learning technology, artificial intelligence (AI), especially large language models (LLMs), has been increasingly applied in the field of software engineering. AI programming assistants, represented by GitHub Copilot and Tongyi Ling Code, can automatically generate code snippets, functions, and even entire modules based on context, greatly changing the traditional development paradigm of software. Developers can significantly improve coding efficiency and shorten development cycles by collaborating with AI. However, this new human-machine collaboration model also brings new challenges. After introducing AI-assisted programming tools, enterprises and R&D teams urgently need a scientific and objective method to quantitatively evaluate the real value brought by them. However, the related technology for quantitatively evaluating AI-assisted programming tools has the following obvious shortcomings: 1) Contribution measurement is ambiguous: Traditional code measurement tools cannot distinguish between code generated by developers and code generated by AI, making it difficult to accurately identify and quantify how much of the code adopted by developers is generated by AI. 2) Single evaluation dimension: Some simple evaluation methods only stop at calculating the "copy-paste" rate, i.e., the direct adoption rate. This method ignores the subsequent evolution process of the adopted code (such as refactoring and fixing) and its long-term impact on software quality and maintainability, making the evaluation dimension very one-sided. 3) Lack of in-depth analysis: Related technologies are mostly based on pure text similarity comparison, making it difficult to deal with non-literal modifications such as variable renaming and syntax structure adjustment, resulting in insufficient matching accuracy. At the same time, it is also difficult to analyze the mode of AI code adoption in depth, such as whether AI provides "out-of-the-box" tool functions or only provides "semi-finished" inspiration prototypes.
[0073] Specifically, the closest related technology is mainly based on code similarity detection tools such as Measure of Software Similarity (MOSS) and JPlag. These tools detect the similarity between code bases through tokenization and fingerprinting, commonly used in academic plagiarism detection or enterprise intellectual property infringement detection. The main implementation method is: preprocess the code text (such as removing white space and comments), then decompose it into a string of tokens, and then generate fingerprints for these token sequences through specific hashing algorithms (such as Winnowing). Finally, the similarity between two pieces of code is determined by comparing the fingerprint overlap. However, the closest related technology has the following shortcomings: MOSS and other tools aim to "detect plagiarism", i.e., find similarities between two static code. Usually only dealing with a single data source of code base. Mainly rely on text comparison at the lexical level. Finally, only a similarity score is provided. Therefore, the closest related technology also cannot accurately quantify the actual contribution of AI-generated code in the software development process.
[0074] The optional embodiment of the present application provides an AI generated code traceability and adoption evaluation system and method based on deep code analysis and multi-dimensional feature fusion (the system can be used to execute the code adoption rate determination method in the above-embodiment, and the method is equivalent to the code adoption rate determination method in the above-embodiment), aiming to solve the problem that the actual contribution of artificial intelligence (AI) to the code generated in the software development process is difficult to accurately, efficiently and multi-dimensionally quantitatively evaluate in the current technology. The optional embodiment of the present application realizes a set of end-to-end automated process, from multi-source heterogeneous data collection, code deep analysis, cross-source homology accurate matching, to code evolution relationship modeling and comprehensive evaluation of research and development performance.
[0075] The system proposed in the optional embodiment of the present application, as shown in Figure 3 The overall architecture design of the system aims to realize modularity, scalability and high performance. The system is mainly composed of a data layer, a processing layer, an analysis layer and an application layer, and communicates and exchanges data between layers through standardized interfaces, and cooperates to complete the traceability and evaluation of AI generated code.
[0076] Among them, the data layer (Data Layer): as the basis of the system, the data layer is responsible for stable and reliable data collection from two core data sources: software development code version control system (represented by Git) and AI programming assistant service log. This layer not only needs to handle massive historical data, but also needs to support accurate real-time data increment acquisition, providing timely and comprehensive data input for upper layer analysis. The data layer internally includes data collection module, data cleaning module and data storage module. The data collection module interacts with external systems; the data cleaning module is responsible for normalizing and formatting the original data and eliminating noise data; the data storage module uses efficient database technology to persistently manage structured and semi-structured data.
[0077] Among them, the processing layer (Processing Layer): as the core engine of the system, the processing layer is responsible for deep processing and analysis of the data provided by the data layer. This layer integrates multiple core technologies of the optional embodiment of the present application, including programming language intelligent detection, code structured analysis, multi-dimensional feature extraction, and cross-source homology matching based on hybrid similarity algorithm. The design of the processing layer fully considers the computing efficiency, and adopts multiple optimization means such as multi-level cache, parallel computing and distributed processing, to ensure high performance and high throughput when analyzing large-scale code library. This layer mainly includes three core components: code parser, feature extractor and code matcher.
[0078] The Analysis Layer builds upon the matching results of the Processing Layer, performing more advanced abstract analysis and pattern mining. This layer goes beyond simply calculating the direct adoption rate of code; it introduces code evolution relationship modeling to track the lifecycle of adopted code, including subsequent modifications, refactoring, and defect fixes. Furthermore, the Analysis Layer constructs a multi-dimensional R&D efficiency evaluation model, comprehensively assessing the actual impact of AI-assisted programming on software development activities from multiple perspectives, including development efficiency, code quality, and technical influence. This layer mainly consists of an evolutionary analysis module, a statistical calculation module, and an efficiency evaluation module.
[0079] The Application Layer serves as the system's user interface. It is responsible for presenting the complex data and evaluation results from the analytics layer in an intuitive and easy-to-understand manner to users with different roles, such as development engineers, project managers, and technical managers. The Application Layer provides customizable dashboards, data reports, and trend analysis charts, and can generate insights and alerts based on preset rules, thereby providing data-driven support for technical decisions, team management, and process optimization.
[0080] In summary, the system's operation in this optional embodiment begins with the data layer periodically or triggered to pull the latest data from Git repositories and AI services. After cleaning and preprocessing, the data is handed over to the processing layer. The processing layer first performs language recognition and structured parsing on the code, extracting key lexical, syntactic, and semantic features. Subsequently, a code matcher uses an efficient inverted index and hybrid similarity algorithm to establish homology associations between AI-generated code and user-submitted code. The matching results are passed to the analysis layer, which performs code evolution analysis and performance metrics calculation. Finally, the application layer presents these analytical insights to the user in a visual form. The entire process is highly automated, minimizing human intervention.
[0081] Furthermore, the system in the optional embodiments of this application can be further divided into multiple modules.
[0082] Optional modules include: a multi-source heterogeneous data acquisition and normalization processing module. This module forms the data foundation of the entire system, designed to efficiently and robustly acquire data from diverse sources and transform it into a unified, clean, and analyzable format.
[0083] The multi-source heterogeneous data acquisition and normalization processing module includes a sub-module for precise incremental code extraction from Git repositories. This sub-module is responsible for extracting all code changes within a specified time range from the Git version history. Its technical implementation includes:
[0084] 1) Secure external command execution mechanism: By encapsulating the standard `subprocess` library, robust calls to `git` commands are achieved. This mechanism has built-in timeout control, which can set a reasonable waiting time to prevent permanent blocking of the process due to large repositories or network problems. At the same time, various exceptions that may be thrown during the execution of the `git` command (such as `CalledProcessError`) are fully captured and finely processed, and detailed error information is recorded through the logging system, ensuring the stability and traceability of the data collection process.
[0085] 2) Incremental parsing algorithm based on `git log`: To accurately obtain new code lines, the optional embodiment of the present application designs a state machine parsing algorithm. This algorithm processes the output of the `git log --patch` command line by line, identifies specific line prefixes in the patch format (diff format) (such as `+` for addition, `-` for deletion, and ` ` for context), and ignores meta-information lines (such as `diff--git`, `index`, `---`, and `+++`), accurately associating each line of new code with its corresponding commit hash, committer, commit timestamp, and file path.
[0086] 3) Intelligent merging and separation of discontinuous code blocks: In the same file submission, new code blocks may be distributed in multiple discontinuous locations. The optional embodiment of the present application can identify these discontinuous code blocks and attribute them to the same file in the same submission in the internal data structure. At the same time, in order to facilitate subsequent processing, the system inserts a unique, custom separator between data streams from different submissions or different files. This design simplifies subsequent processing logic, allowing focus on the code content itself rather than its source meta-information.
[0087] Among them, the multi-source heterogeneous data collection and normalization processing module includes an AI service log data structure parsing submodule. This submodule is responsible for processing log data from AI programming assistant background services and extracting valid code responses. Its technical implementation includes:
[0088] 1) Precise identification of document markup (Markdown) format code blocks: The response of the AI service is usually a Markdown text containing natural language explanations and code snippets. The optional embodiment of the present application uses a combination of regular expressions and state machines to accurately identify code blocks wrapped in three backticks (`\`\`\`). This method can correctly handle nested or format-irregular situations and automatically extract the programming language type declared by the code block (such as `python`, `java`, etc.), providing a basis for subsequent language-specific analysis.
[0089] 2) Code content standardization: To eliminate the interference of format differences on subsequent similarity calculation, the extracted code lines will undergo a standardization process. The implementation of this process includes multiple steps: removing leading and trailing white space characters; replacing multiple consecutive white space characters (spaces, tabs) with a single space; removing empty lines and pure comment lines (configurable). This standardization operation ensures that only the effective content of the code itself is used for subsequent analysis.
[0090] 3) Data consistency and reliability guarantee mechanism: To ensure the consistency and integrity of data during the persistence process, this module integrates database transaction management and connection management mechanisms, including atomic data writing and connection pooling and automatic retry.
[0091] Among them, atomic data writing: all write operations to the database, especially the analysis result saving involving multiple tables, are encapsulated in a database transaction. This ensures that a batch of data saving operations either all succeed or all roll back when any step fails. This effectively prevents the problem of inconsistent data caused by system interruption.
[0092] Among them, connection pool and automatic retry: the system uses database connection pool technology to manage database connections, avoiding the overhead of frequent creation and destruction of connections. More importantly, the optional embodiments of the application integrate an automatic retry mechanism based on the exponential backoff algorithm (such as using the `tenacity` library). When the database connection is temporarily failed or jittered, the system will automatically try to reconnect and perform operations after a period of time, greatly enhancing the robustness of the system in complex network environments.
[0093] Optionally, the plurality of modules further comprise: a code deep parsing and structured feature extraction module. The code deep parsing and structured feature extraction module is used to realize accurate understanding and matching of code, and can convert the original code text string into a multi-dimensional feature representation containing rich structure and semantic information.
[0094] Among them, the code deep parsing and structured feature extraction module comprises: a dual-mode intelligent programming language detector (Programming Language Detector) for processing code fragments from diverse sources (may contain file suffixes or may not contain file suffixes), specifically including:
[0095] 1) Fast path based on file extension: the system first attempts to determine the programming language through the file name suffix of the code. It internally maintains a mapping table from common file extensions to standard programming language names (for example, `.py` corresponds to `Python`, `.js` corresponds to `JavaScript`). This is the most efficient way of recognition.
[0096] 2) Lexical analysis based deep guessing: When the file extension is missing or unrecognized, the system will activate the second mode. This mode utilizes mature lexical analysis libraries (such as `Pygments`) to analyze the content of the code snippet itself. `Pygments` can guess the most likely programming language based on the characteristics of lexical units such as keywords, operators, literals, etc. appearing in the code.
[0097] 3) Thread-safe lexer cache: The `Pygments` lexer instantiation overhead is large. In order to improve efficiency in parallel processing environments, the optional embodiment of the present application designs a thread-safe cache mechanism. This mechanism uses language names as keys to cache already created Lexer instances. When a new request requires a Lexer for the same language, it can be directly obtained from the cache, avoiding the performance loss of repeated creation.
[0098] Among them, the code deep parsing and structured feature extraction module further includes: a fine-grained code structure and semantic element analyzer (CodeStructureAnalyzer), which is used to go beyond simple text matching and deeply analyze the syntax structure and semantic components of the code. Specifically, it includes:
[0099] 1) Regular recognition of 14 code structure patterns: Through a set of carefully designed regular expressions common to multiple mainstream programming languages, the system can accurately classify each line of code into one of the 14 predefined structure patterns. These patterns include but are not limited to: variable declaration and assignment statements, function / method call statements, conditional control statements (if, else, else if, switch-case, etc.), loop control statements (for, while, foreach, etc.), class / interface definition statements, function / method definition statements, import / reference statements (import, include, using, etc.), return statements, exception handling statements (try, catch, throw, raise, etc.), comment statements, declaration statements (without assignment), expression statements (such as independent arithmetic or Boolean expressions), control transfer statements (such as break, continue, goto, etc.). This classification provides the first layer of information for understanding the role played by the code line.
[0100] 2) Context-aware extraction of 10 core semantic elements: Based on the identification of macro-structures, the system further extracts micro-semantic elements. These elements include: variable names, function names, class names, operators, numeric literals, string literals, language keywords, etc. The extraction process is context-aware, for example, in the line of code `class MyClass:`, `MyClass` will be identified as a "class name", while in `MyClass()` it will be identified as a "class name" in "function call" or "constructor name". This fine-grained element extraction provides rich features for subsequent similarity calculation.
[0101] 3) Adaptive high-performance code Token extractor (CodeTokenExtractor). Token is the basic semantic unit of code, and its extraction efficiency and accuracy directly affect the performance of the entire system. It includes: long-short line adaptive processing strategy and multi-level parallel and batch processing architecture. Specifically:
[0102] Long-short line adaptive processing strategy: The optional embodiments of the present application realize that different complexity of code lines need different processing strategies. The system automatically selects the optimal Token extraction method according to the character length of the code line. For simple code lines with a length less than a preset threshold (for example, 100 characters), a set of optimized regular expressions is used for fast extraction. For long and complex code lines that exceed the threshold, the lexical analyzer of `Pygments` is called for more accurate but slightly more expensive extraction. This adaptive strategy achieves an excellent balance between accuracy and performance.
[0103] Multi-level parallel and batch processing architecture: In order to maximize the computing power of modern multi-core processors, the Token extraction process is designed to be highly parallel. At the top level, the system can use multi-process or multi-thread to distribute code analysis tasks from different Git repositories (modules) to different CPU cores. Inside each task, thread pools can be used to parallelize Token extraction tasks for a large file or multiple batches of code lines. Data is transferred between processing units in batches, reducing the overhead of function calls and further improving throughput.
[0104] Optionally, the plurality of modules further comprise: a cross-source homology matching module based on a hybrid similarity algorithm. This module is the core module of the entire system, and its goal is to quickly and accurately find code pairs with homology between massive AI generated code and user submitted code. To achieve this goal, the optional embodiment of the present application proposes an innovative multi-level matching strategy from macro to micro. The strategy first quickly filters out a small number of highly relevant candidate codes through efficient indexing technology, and then performs accurate similarity calculation and determination through a hybrid model that integrates multi-dimensional features. Specifically, it includes:
[0105] 1) Efficient candidate retrieval: execute global cache and dynamic indexing strategy.
[0106] To fundamentally solve the performance bottleneck caused by brute force comparison, the optional embodiment of the present application designs a set of efficient retrieval strategy of "one-time caching, daily indexing", aiming to minimize the repeated calculation overhead in long-period analysis.
[0107] First, execute global AI code line cache (Global Line Store): when the analysis task starts, the system will query all relevant AI code within the specified time range from the database at one time, perform unified standardization and Tokenization, and store the processed results in a "global line store" in memory. This global cache is the basis for all subsequent analysis, ensuring that the most time-consuming input / output (Input / Output, I / O) and CPU-intensive preprocessing work only occurs once during the entire task period.
[0108] Second, build a daily dynamic inverted index (Dynamic Daily Index): when analyzing each day, the system will first filter out the code subset within the time window from the "global line store" according to the current date, and then build a daily dedicated inverted index only for this small-scale subset. When matching Git submission code for the current day, the system only needs to search in this lightweight daily index. This is like looking for a book from a specific historical period, instead of searching the entire national library, the administrator first moves all books from the relevant period to a small cart, and only needs to check the small cart. This strategy reduces the search range by several orders of magnitude, which is the core of achieving high performance matching.
[0109] By executing the global cache and dynamic indexing strategy, the system can efficiently retrieve the top-K most likely relevant AI code lines for each newly added Git code, forming a preliminary candidate set for subsequent accurate verification.
[0110] 2) Multi-dimensional similarity verification and adoption determination.
[0111] After obtaining the candidate set, the system will strictly verify the multi-dimensional similarity of each pair (Git code line, AI code line). The optional embodiment of the present application proposes a weighted hybrid model based on multi-dimensional feature fusion to comprehensively evaluate the homology from three aspects. Specifically, it includes:
[0112] Text similarity calculation based on lexical edit distance (weight 50%): This dimension focuses on the literal similarity of the code. By calculating the normalized edit distance (Levenshtein Distance) of the two lines of code, the difference in text is quantified, which is very effective for capturing direct copy-paste or small modifications.
[0113] Code structure similarity comparison based on structural patterns (weight 30%): This dimension focuses on the syntactic structure of the code. Using a fine-grained code structure and semantic element analyzer, the code line is classified into one of the 14 predefined structural patterns. If the two lines of code belong to the same structural pattern (such as "variable assignment"), the structural similarity score will be higher, which makes the matching effective against pure text differences caused by variable renaming. If the two lines of code are completely the same in structure, such as both being variable assignment, they can score full marks, usually 1.0 or 100%; if they are different, such as one being variable assignment and the other being if / else conditional statement, they can score 0 or close to 0, such as 0.1; if they are similar, such as if and elseif, or for and while, they can score a score between 0 and 1, such as 0.5.
[0114] Semantic similarity comparison based on semantic element intersection (weight 20%): This dimension focuses on the deep logical intent of the code. The system extracts a set of core semantic elements (such as function names, variable names, etc.) for each line of code, and then calculates the Jaccard index (intersection / union) between the two element sets. The higher the index, the higher the degree of coincidence of the core logic of the two lines of code.
[0115] Finally, the similarity scores calculated by the three dimensions are weighted and summed according to the preset weights (50%, 30%, 20%) to obtain a comprehensive similarity score. This score will be compared with the preset adoption threshold (e.g. 75%), and only those exceeding the threshold will be finally determined as an effective adoption.
[0116] Optionally, considering that the meaning of the code is often determined by its context, single-line matching alone can easily lead to misjudgment. Therefore, the optional embodiment of the present application introduces a code block level context-aware matching algorithm as the final check and enhancement on the basis of single-line matching. Specifically, a sliding window and continuity reward are used: after finding a pair of matching code lines, the system starts a "sliding window" to check whether there is a continuous match in their respective contexts (the N lines of code before and after). If it is found that multiple lines are highly matched, the system will give a "continuity reward" to significantly improve the final matching score of the entire code block.
[0117] Optionally, the plurality of modules further include a code evolution relationship modeling and adoption pattern recognition module. Traditional code adoption rate evaluation only counts the "copy-paste" behavior of the code, ignoring the subsequent life cycle of the adopted code. The optional embodiment of the present application innovatively introduces code evolution analysis to more comprehensively and deeply understand the true value of AI code. Specifically, it includes:
[0118] 1) Post-adoption code life cycle tracking: based on the initial matching result output by the processing layer (i.e. "0 generation adoption"), the evolution path of the adopted code fragment is tracked by continuously analyzing subsequent Git commits.
[0119] Optionally, when a file is modified in subsequent versions, the system not only performs text comparison. It generates an Abstract Syntax Tree (AST) for the old and new versions of the file respectively. By comparing the differences between the two ASTs (Tree Differencing), the system can accurately identify various types of code evolution operations, which can be: (1) variable / function renaming (Rename): the node type does not change, but the node name changes. (2) Logic refactoring (Refactor): a subtree is replaced by a new subtree that is semantically equivalent but structurally different. (3) Bug fix: usually manifested as a change in the boundary of a conditional statement, a change in the operator, or the addition of new logic in the original code block. (4) Enhancement: new function calls or logic branches are added to the original code block.
[0120] Further, a code evolution graph can be constructed based on the evolution operation: the system connects a series of discrete commits to construct a directed acyclic graph with code fragments as nodes and evolution operations as edges. This graph clearly depicts how a piece of AI-generated code is gradually integrated into the existing code base and continuously evolves and improves.
[0121] 2) Automatic identification and classification of adoption patterns: Based on the code evolution graph, the optional embodiments of the present application can automatically identify and summarize various typical AI code adoption patterns. Specifically, it includes patterns one to four.
[0122] Pattern one: Prototype-inspired adoption: After the AI-generated code is adopted, it undergoes a large number of modifications, refactorings, and optimizations in a short period of time. This indicates that the developer regards the AI code as a working "prototype" or "inspiration" and makes a lot of secondary creation on this basis. This is a high-quality adoption pattern.
[0123] Pattern two: Utility-function adoption: After the AI-generated code (usually a separate function or class) is adopted, it is almost not modified for a long time, but is frequently called by multiple different places in the project. This indicates that the AI has generated a stable and reliable utility code, and its value is amplified by being reused.
[0124] Pattern three: Temporary patch adoption: After the AI-generated code is adopted, it is completely deleted in a large-scale refactoring soon. This may indicate that the AI code only solves a temporary problem, or its quality is not sufficient to exist in the code base for a long time.
[0125] Pattern four: Defect-introducing adoption: After the AI-generated code is adopted, the subsequent commits related to it are explicitly marked as "fix", or code evolution analysis shows that it introduces logical vulnerabilities. This is a negative adoption pattern, and identifying this pattern is crucial for evaluating the risks of AI tools.
[0126] Through the identification and statistics of these patterns, the optional embodiments of the present application go beyond the simple "adoption rate" number and provide rich, qualitative insights into the collaboration quality between AI and developers.
[0127] Optionally, the plurality of modules further include a multi-dimensional research and development efficiency evaluation and decision support module. The goal of this module is to transform the underlying analysis results into macroscopic efficiency indicators and insights that are practically meaningful to managers and developers. Specifically, it includes:
[0128] 1) Build a comprehensive AI-assisted programming efficiency index system. The optional embodiments of the present application propose a three-in-one index system including efficiency, quality, and influence. It includes efficiency indicators, quality indicators, and influence indicators.
[0129] Among them, the efficiency index includes: (1) The traditional AI code adoption rate index, but through the precise matching and evolution analysis of the optional embodiments of the present application, its accuracy is greatly improved. (2) The average evolution step number of the adopted code, which can measure the "maturity" of the AI code. The fewer the steps, the higher the code quality and the less the required modification. (3) AI-assisted development time saving estimation. By correlating the developer's adoption of AI code behavior and the length of time to complete the task (for example, correlating the closing time of Jira Ticket), the time saved by AI for the developer on specific types of tasks can be estimated.
[0130] Among them, the quality index includes: (1) The subsequent defect rate of the adopted code, which indicates the frequency of the adopted code being repaired in subsequent versions, directly measuring the risk of introducing defects. (2) The complexity of the adopted code, which indicates the cyclomatic complexity, cognitive complexity and other indicators of the adopted code, used to evaluate its maintainability. (3) The proportion of high-value adoption modes, which can be determined by calculating the proportion of positive adoption modes such as "prototype heuristic" and "tool functional" in all adoption behaviors.
[0131] Among them, the influence index includes: (1) The reuse degree of the adopted code, which is used to measure the extent to which a piece of adopted code is called in the code library. (2) The innovative function points based on AI code, which can be used to correlate product requirements and identify which new functions are strongly dependent on AI-generated code implementation. (3) Team / personal AI collaboration level: By counting the frequency and quality of different teams or individuals adopting AI code, the collaboration ability with AI tools is quantified.
[0132] 2) Data-driven decision support system, used to output decision support provided for different roles.
[0133] For technical managers: Provide a macro dashboard of team AI usage, show the overall impact trend of AI on R&D efficiency, help them evaluate the return on investment (ROI) of AI tools, and identify which technology stack or project can get the maximum benefit from promoting AI-assisted programming.
[0134] For project managers: Provide project-level AI adoption reports to reveal AI's contribution in specific function development and warn about potential technical debt or quality risks introduced by AI code.
[0135] For development engineers: Provide personalized AI usage feedback, such as "20% of the AI code you adopted has been proven to have defects in the future" or "You are very good at refactoring AI-generated prototype code into high-quality production code", helping developers improve their skills in collaboration with AI.
[0136] Through this complete solution from bottom technology to upper application, the optional embodiment of the application not only solves the problem of AI code contribution measurement, but more importantly, it provides a scientific, quantitative and feasible theoretical framework and technical implementation for enterprises to systematically utilize, manage and optimize AI applications in software engineering.
[0137] Optionally, the AI-generated code tracing and adoption evaluation method based on deep code analysis and multi-dimensional feature fusion can be implemented through the following steps:
[0138] Step 1: Multi-source heterogeneous data collection. Provide high-quality, standardized data input for subsequent analysis. The system completes this task through two parallel sub-modules.
[0139] Step 1.1: Git repository data collection. The system first calls the `gitlog --patch` command through a secure external command execution interface to obtain all code submission records within a specified time period (e.g., the past 24 hours). To ensure stability, the call sets a timeout control and complete exception capture mechanism. Then, a state machine-based parser processes the command output line by line, accurately extracts all added and deleted code lines by recognizing the `+` or `-` symbols at the beginning of the line, and associates them with submission hash, author, timestamp, file path, etc. For non-continuous code blocks within the same file, the system can intelligently merge them into the same submission and use a unique separator for marking.
[0140] Step 1.2: AI service log data collection. The system regularly pulls data from the log storage (such as a database or log file system) of the AI programming assistant background service. For log content usually returned in Markdown format, the system uses a combination of regular expressions and state machines to accurately extract code blocks wrapped in three backticks (```), and parse the declared programming language type. The extracted code will go through a standardization process, including removing leading and trailing whitespace, merging redundant spaces, removing blank lines and comment lines, to eliminate format differences that interfere with subsequent analysis.
[0141] All collected data, whether from Git or AI logs, will be encapsulated in a database transaction and written to persistent storage in an atomic manner to ensure data consistency and integrity. The system also integrates an automatic retry mechanism based on the exponential backoff algorithm to handle temporary database connection interruptions.
[0142] Step 2: Code deep analysis and multi-dimensional feature extraction. Convert raw code text into feature vectors containing rich structure and semantic information.
[0143] Step 2.1: Language detection. The system employs a "dual-mode" mechanism to identify the programming language of the code. First, it attempts a quick judgment based on file extensions; if there is no extension, it calls a library based on lexical analysis (such as `Pygments`) to deeply analyze the content of the code and guess its language according to keywords, operators, etc. To improve performance, instantiated lexical analyzers are cached thread-safely.
[0144] Step 2.2: Feature extraction. The system analyzes each line of code at two levels:
[0145] Structural pattern recognition: Through a set of carefully designed regular expressions, the code line is classified into one of the 14 structural patterns, such as "variable assignment", "function call", "conditional statement", etc., to understand the role of the code line macroscopically.
[0146] Semantic element extraction: Based on the structural pattern, 10 core semantic elements are further extracted, such as "variable name", "function name", "class name", "literal", etc., to capture the logical intent of the code microscopically.
[0147] Step 2.3: The system adaptively selects the optimal Token extraction strategy according to the length of the code line. For short lines of code, use efficient regular expressions for fast tokenization; for long and complex code lines, call more accurate lexical analyzers. The entire extraction process is designed for multi-level parallel and batch processing to maximize the use of computing resources.
[0148] Step 3: Cross-source homology matching based on hybrid similarity algorithm. It is the core step of the optional embodiment of the present application, responsible for establishing homology association between massive AI code and user-submitted code.
[0149] Step 3.1: Efficient candidate retrieval. To avoid brute-force comparison, the system adopts a "one-time cache, daily index" strategy. At the beginning of the analysis task, all relevant AI code is loaded into the "global line store" in memory at one time. When analyzing each day's Git submission, the system will only build a lightweight inverted index for the relevant subset of AI code for that day. When matching a business code, the system only needs to search in this small range of daily index, thereby efficiently finding the Top-K most relevant candidate AI code lines.
[0150] Step 3.2: Multi-dimensional similarity verification. For each candidate code pair, the system calculates its comprehensive similarity through a weighted hybrid model, including:
[0151] Text similarity (weight 50%): Calculate the Levenshtein Distance of two lines of code. Structural similarity (weight 30%): Compare whether the structural patterns to which the two lines of code belong are consistent. Semantic similarity (weight 20%): Calculate the Jaccard index of the core semantic element set of the two lines of code. Weighted sum the scores of the three dimensions to get a comprehensive score. Only when the score exceeds the preset adoption threshold (for example, 75%) is it determined as an effective adoption.
[0152] Step 3.3: Context-aware matching: To improve accuracy, the system introduces code block-level matching. When a pair of matching code lines is found, a "sliding window" is used to check whether there is a continuous match in its context (N lines before and after). The continuous matching code block will get a "continuity reward", which significantly improves its final matching score, effectively distinguishing between accidental similarity and real adoption.
[0153] Step 4: Code evolution analysis and performance evaluation. Used to track the subsequent life cycle of the adopted code and convert it into macro performance insights.
[0154] Step 4.1: Evolution relationship modeling: Based on the initial matching results, the system accurately identifies code evolution operations (such as renaming, refactoring, fixing, etc.) by comparing the Abstract Syntax Tree (AST) differences of subsequent submissions, and builds a code evolution graph to clearly depict the entire life cycle of AI code.
[0155] Step 4.2: Adoption pattern recognition: Based on the evolution graph, the system automatically identifies and summarizes typical adoption patterns, such as "prototype heuristic", "tool function type", "temporary patch type", etc.
[0156] Step 4.3: Performance indicator calculation and presentation: Finally, the system builds an indicator system containing efficiency, quality, and influence, calculates a series of quantitative indicators such as "AI code adoption rate", "subsequent defect rate", "code reuse degree", etc. These results are finally presented to users of different roles through visual dashboards and reports, providing data-driven support for technical decision-making, team management, and process optimization.
[0157] In summary, the optional embodiments of the present application have the following remarkable beneficial effects compared with the prior art by using the above technical solutions:
[0158] 1) Achieving accurate quantification and traceability of AI contribution. The optional embodiments of the present application provide an end-to-end automated solution for the first time, which can effectively associate the data scattered in the AI service log and the Git version history, and accurately identify that each line of adopted code is derived from which AI suggestion. This solves the fundamental problem of AI contribution being difficult to measure and trace in current technology, making the return on investment evaluation of AI-assisted programming tools change from vague qualitative judgment to precise quantitative analysis.
[0159] 2) Significantly improving the accuracy and efficiency of code matching. The unique "multi-dimensional hybrid similarity model" of the optional embodiments of the present application surpasses the limitations of traditional pure text-based comparison. By integrating the features of code text, syntax structure and core semantics in three dimensions for comprehensive judgment, it can effectively deal with complex scenarios such as variable renaming, format adjustment, syntax equivalent replacement, etc., with much higher accuracy than existing technology. At the same time, its "dynamic inverted index" strategy reduces the matching range by several orders of magnitude, greatly improving the analysis efficiency on large-scale code libraries while ensuring accuracy.
[0160] 3) Providing deep insights into code adoption behavior. The optional embodiments of the present application innovatively introduce abstract syntax tree (AST) based code evolution analysis, which can track the complete life cycle of the adopted code, not just the initial "copy-paste" behavior. By identifying various adoption modes such as "prototype heuristic", "tool function", "defect introduction", etc., the optional embodiments of the present application can reveal the deep collaboration between AI and developers, helping to understand the true value and potential risks of AI code, and providing unprecedented depth of insight for optimizing AI tools and developer training.
[0161] 4) Building a scientific and comprehensive R&D efficiency evaluation system. The optional embodiments of the present application propose a three-in-one R&D efficiency index system including efficiency, quality and influence. It not only includes "code adoption rate" and other efficiency indicators, but also includes "subsequent defect rate", "code complexity" and other quality indicators, as well as "code reuse degree", "high-value adoption mode proportion" and other influence indicators. This scientific and comprehensive evaluation system can avoid the one-sidedness brought by single indicators, providing managers with a 360-degree perspective to evaluate the comprehensive impact of AI-assisted programming, making their decisions more scientific and reliable.
[0162] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software on a general hardware platform, and of course can also be realized by hardware, but in many cases the former is a better implementation. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk), and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device) to execute the methods described in the various embodiments of the present application.
[0163] In the present embodiment, a code adoption rate determination apparatus is also provided, which is used to implement the above embodiments and preferred embodiments, and will not be described again. Although the apparatus described in the following embodiments is preferably realized in software, hardware or a combination of software and hardware is also possible and is contemplated.
[0164] Figure 4 is a framework diagram of the code adoption rate determination apparatus according to the embodiments of the present application, as shown in Figure 4 The apparatus includes:
[0165] The acquisition module 42 is configured to acquire first changed code of the distributed version control system in a first time range, and acquire first response code corresponding to the first changed code generated by the intelligent programming assistant;
[0166] The first determination module 44 is configured to determine a candidate set related to each line of code in the first changed code in the first response code, and determine a code pair having a homologous relationship between the first changed code and the first response code through each line of code in the first changed code and the candidate set.
[0167] The second determination module 46 is configured to determine the code adoption rate of the first response code through the code pair.
[0168] The code adoption rate determination apparatus determines the first changed code of the distributed version control system in the first time range, and obtains the first response code corresponding to the first changed code generated by the intelligent programming assistant; in the first response code, a candidate set related to each line of code in the first changed code is determined, and a code pair having a homology relationship between the first changed code and the first response code is determined through each line of code in the first changed code and the candidate set; and the code adoption rate of the first response code is determined through the code pair. Through the present application, the problem that the actual contribution of the code generated by artificial intelligence in the software development process is difficult to accurately quantify and evaluate in the related art is solved, and the effect of accurately evaluating the contribution of the code generated by artificial intelligence is realized.
[0169] In an exemplary embodiment, the obtaining module 42 is further configured to determine the second changed code in the original code by a state machine parsing algorithm, wherein the original code is the original code of the distributed version control system in the first time range, and the second changed code is the changed code in one commit of the same file; and a preset separator is inserted between a plurality of the second changed codes to obtain the first changed code.
[0170] In an exemplary embodiment, the obtaining module 42 is further configured to identify meta-information lines in the original code based on a preset field by the state machine parsing algorithm; and line prefix identification is performed on code lines in the original code except the meta-information lines to obtain the second changed code.
[0171] In an exemplary embodiment, the obtaining module 42 is further configured to determine log data corresponding to the first changed code generated by the intelligent programming assistant; identify a code block of a preset format in the log data; and perform a standardization processing procedure on code lines in the code block of the preset format to obtain the first response code.
[0172] In an exemplary embodiment, the first determining module 44 is further configured to obtain a second response code in a time window corresponding to a second time range in the first response code, wherein the first time range includes the second time range, and the second time range is a preset time granularity for determining a candidate set related to each line of code in the first changed code; construct an inverted index corresponding to the second response code; and in the inverted index, retrieve K code lines having the highest relevance to each line of code in a third changed code to obtain a candidate set related to each line of code in the first changed code, wherein K is a positive integer, and the third changed code is code in the first changed code within the second time range.
[0173] In an example embodiment, the first determining module 44 is further configured to determine a multi-dimensional feature representation corresponding to each line of code in the first changed code and each line of code in the candidate set respectively, wherein the multi-dimensional feature representation comprises at least one of: code text, structural pattern and semantic element; determine a multi-dimensional similarity between each line of code in the first changed code and each line of code in the candidate set respectively based on the multi-dimensional feature representation, wherein the multi-dimensional similarity comprises at least one of: text similarity, structural similarity and semantic similarity; and perform a weighted calculation on the multi-dimensional similarity to determine a code pair between the first changed code and the first response code having the homology relationship based on a similarity score obtained.
[0174] In an example embodiment, the first determining module 44 is further configured to determine a programming language type to which the target code belongs by a file suffix of a file to which the target code belongs or a lexical detector, wherein the target code comprises at least one of: the first changed code and the first response code; and extract a basic semantic unit of the target code according to a character length of a code line in the target code.
[0175] In an example embodiment, the first determining module 44 is further configured to, in a case where the multi-dimensional similarity comprises the text similarity, calculate a lexical edit distance between each line of code in the first changed code and each line of code in the candidate set, and determine an intermediate value of the text similarity based on the lexical edit distance; determine matching code lines in front and back N lines of code, wherein the front and back N lines of code comprise front N lines of code and back N lines of code of each line of code in the candidate set in a code block to which the line of code belongs, and the matching code lines are code lines in the front and back N lines of code having the homology relationship with the first changed code; and in a case where the matching code lines are continuous and a number of the matching code lines satisfies a preset number, reward the intermediate value to obtain the text similarity, wherein the preset number is related to N, and N is a positive integer.
[0176] In an example embodiment, the first determining module 44 is further configured to, in a case where the multi-dimensional similarity comprises the structural similarity, determine a first structural pattern and a second structural pattern to which each line of code in the first changed code and each line of code in the candidate set respectively belong; in a case where the first structural pattern and the second structural pattern are the same, determine the structural similarity as a first value; in a case where the first structural pattern and the second structural pattern are similar, determine the structural similarity as a second value, wherein the second value is less than the first value; and in a case where the first structural pattern and the second structural pattern are different, determine the structural similarity as a third value, wherein the third value is less than the second value.
[0177] In an example embodiment, the first determining module 44 is further configured to, in the case that the multi-dimensional similarity includes a semantic similarity, extract a first set of semantic elements and a second set of semantic elements from each line of code in the first changed code and each line of code in the candidate set respectively; calculate a similarity index of the first set of semantic elements and the second set of semantic elements, and determine the similarity index as the semantic similarity.
[0178] In an example embodiment, the first determining module 44 is further configured to sum the multi-dimensional similarity by weighting to obtain a similarity score; compare the similarity score with an adoption threshold; and in the case that the similarity score is higher than the adoption threshold, determine that each line of code in the first changed code and the code line corresponding to the similarity score has the homology relationship.
[0179] In an example embodiment, the second determining module 46 is further configured to determine a first number of the code pairs and determine a second number of code lines included in the first response code; and determine the code adoption rate by a ratio of the first number to the second number.
[0180] In an example embodiment, the apparatus further comprises a third determining module configured to, after determining the code pair having the homology relationship between the first changed code and the first response code by each line of code in the first changed code and the candidate set, determine an evolution operation graph corresponding to a file to which the first code line belongs in the case that the file is submitted for modification, wherein the code pair comprises the first code line belonging to the first changed code and a second code line belonging to the first response code; and determine the adoption mode of the second code line by the evolution operation graph.
[0181] In an example embodiment, the third determining module is further configured to generate an abstract syntax tree for the new version file before and after modification and the old version file respectively; compare the difference between the abstract syntax trees corresponding to the new version file and the old version file respectively, and construct the evolution operation graph corresponding to the file by the difference, wherein the evolution operation graph takes a modified code segment as a node and an evolution operation on the code segment as an edge, and the evolution operation includes a refactoring operation, a deletion operation and a repair operation.
[0182] In an example embodiment, the third determining module is further configured to determine a target node including the first code line in the evolution operation graph; and determine the adoption mode of the second code line by the target node and the evolution operation type of the edge connected to the target node.
[0183] In an example embodiment, the apparatus further comprises an output module configured to, after determining the code adoption rate for the first response code, obtain an adoption pattern of a second code line belonging to the first response code in the code pair; and output an evaluation report of the intelligent programming assistant in the first time range based on the code adoption rate and the adoption pattern.
[0184] The features of the embodiments of the code adoption rate determination apparatus can be understood by referring to the related descriptions of the embodiments of the code adoption rate determination method, which will not be repeated here.
[0185] The embodiments of the present application further provide an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor is configured to execute the computer program to perform the steps in any of the code adoption rate determination method embodiments.
[0186] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program, wherein the computer program is configured to perform the steps in any of the code adoption rate determination method embodiments when executed.
[0187] In an example embodiment, the computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.
[0188] The embodiments of the present application further provide a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps in any of the code adoption rate determination method embodiments.
[0189] The embodiments of the present application further provide another computer program product, which comprises a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps in any of the code adoption rate determination method embodiments.
[0190] Those skilled in the art will further realize that the mere concepts, teachings, and embodiments described herein are merely meant to provide an enabling description of the claimed application. Accordingly, modifications and / or additions, other than those explicitly described herein, can be obvious to those skilled in the art in the light of this disclosure. The claimed application is intended to embrace all such modifications and / or additions.
[0191] The above provides a code adoption rate determination method. The principles and implementation manners of the present application are described by using specific examples. The above description of the embodiments is only applicable to help understand the method and core idea of the present application. It should be pointed out that, for those skilled in the art, without departing from the principles of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A method for determining code adoption rate, characterized in that, The method comprises the following steps: acquiring first changed code of a distributed version control system in a first time range, and acquiring first response code corresponding to the first changed code generated by an intelligent programming assistant; in the first response code, determining a candidate set related to each line of code in the first changed code, and determining a code pair having a homologous relationship between the first changed code and the first response code through each line of code in the first changed code and the candidate set; determining the code adoption rate of the first response code through the code pair, wherein, after determining the code pair having a homologous relationship between the first changed code and the first response code through each line of code in the first changed code and the candidate set, the method further comprises: in the case that the file to which the first code line belongs is submitted for modification, determining an evolution operation graph corresponding to the file, wherein the code pair comprises a first code line belonging to the first changed code and a second code line belonging to the first response code; determining the adoption mode of the second code line through the evolution operation graph.
2. The method of determining a code adoption rate of claim 1, wherein, Acquiring first changed code of a distributed version control system in a first time range comprises: determining second changed code in original code through a state machine parsing algorithm, wherein the original code is original code of the distributed version control system in the first time range, and the second changed code is changed code in one submission to the same file; inserting a preset separator between a plurality of second changed codes to obtain the first changed code.
3. The method of determining the code adoption rate according to claim 2, characterized in that, Determining second changed code in original code through a state machine parsing algorithm comprises: identifying meta-information lines in the original code based on a preset field through the state machine parsing algorithm; performing line prefix identification on code lines in the original code except the meta-information lines to obtain the second changed code.
4. The method of determining the code adoption rate according to claim 1, wherein, Acquiring first response code corresponding to the first changed code generated by an intelligent programming assistant comprises: determining log data corresponding to the first changed code generated by the intelligent programming assistant; identifying code blocks of a preset format in the log data; performing a standardization processing procedure on code lines in the code blocks of the preset format to obtain the first response code.
5. The method of determining the code adoption rate according to claim 1, wherein, In the first response code, determining a candidate set related to each line of code in the first changed code comprises: acquiring second response code in a time window corresponding to a second time range in the first response code, wherein the first time range includes the second time range, and the second time range is a preset time granularity for determining the candidate set related to each line of code in the first changed code; building an inverted index corresponding to the second response code; in the inverted index, retrieving K code lines with the highest relevance to each line of code in the third changed code to obtain the candidate set related to each line of code in the first changed code, wherein K is a positive integer, and the third changed code is code in the first changed code within the second time range.
6. The method of determining the code adoption rate according to claim 1, wherein, determining, for each line of code in the first changed code and each line of code in the candidate set, a multi-dimensional feature representation corresponding to the line of code, wherein the multi-dimensional feature representation comprises at least one of: code text, structural pattern, and semantic element; determining, for each line of code in the first changed code and each line of code in the candidate set, a multi-dimensional similarity between the lines of code based on the multi-dimensional feature representation, wherein the multi-dimensional similarity comprises at least one of: text similarity, structural similarity, and semantic similarity; performing weighted calculation on the multi-dimensional similarity to determine a code pair between the first changed code and the first response code having the homology relationship based on a similarity score obtained from the weighted calculation. Before determining, for each line of code in the first changed code and each line of code in the candidate set, a multi-dimensional feature representation corresponding to the line of code, the method further comprises:
7. The method of determining a code adoption rate of claim 6, wherein, detecting, based on a file suffix of a file to which the target code belongs or a lexical detector, a programming language type to which the target code belongs, wherein the target code comprises at least one of: the first changed code, the first response code; and extracting a basic semantic unit of the target code according to a character length of a line of code in the target code. determining, for each line of code in the first changed code and each line of code in the candidate set, a multi-dimensional similarity between the lines of code based on the multi-dimensional feature representation, comprises: in a case where the multi-dimensional similarity comprises text similarity, calculating a lexical edit distance between each line of code in the first changed code and each line of code in the candidate set, and determining an intermediate value of the text similarity based on the lexical edit distance; 8. The method of determining the code adoption rate according to claim 6, wherein, determining matching code lines in front N lines of code and back N lines of code of each line of code in the candidate set, wherein the matching code lines are code lines having the homology relationship with the first changed code in the front N lines of code and the back N lines of code of each line of code in the candidate set; in a case where the matching code lines are continuous and the number of the matching code lines satisfies a preset number, rewarding the intermediate value to obtain the text similarity, wherein the preset number is related to N, and N is a positive integer. determining, for each line of code in the first changed code and each line of code in the candidate set, a multi-dimensional similarity between the lines of code based on the multi-dimensional feature representation, comprises: in a case where the multi-dimensional similarity comprises structural similarity, determining a first structural pattern and a second structural pattern to which each line of code in the first changed code and each line of code in the candidate set respectively belongs; 9. The method of determining the code adoption rate according to claim 6, wherein, in a case where the first structural pattern and the second structural pattern are the same, determining that the structural similarity is a first value; in a case where the first structural pattern and the second structural pattern are similar, determining that the structural similarity is a second value, wherein the second value is less than the first value; When the first structural pattern and the second structural pattern are different, the structural similarity is determined to be a third value, wherein the third value is less than the second value.
10. The method of determining a code adoption rate of claim 6, wherein, Determining the multidimensional similarity between each line of code in the first modified code and each line of code in the candidate set using the multidimensional feature representation includes: When the multidimensional similarity includes semantic similarity, the first set of semantic elements and the second set of semantic elements in each line of code in the first modified code and each line of code in the candidate set are extracted respectively. Calculate the similarity index between the first set of semantic elements and the second set of semantic elements, and determine the similarity index as the semantic similarity.
11. The method of determining a code adoption rate of claim 6, wherein, The multidimensional similarity is weighted and calculated to determine code pairs with a common origin relationship between the first modified code and the first response code based on the obtained similarity score, including: The weighted sum of the multidimensional similarities is used to obtain the similarity score; Compare the similarity score with the adoption threshold; If the similarity score is higher than the adoption threshold, it is determined that each line of code in the first modified code and the line of code corresponding to the similarity score are code pairs with the homology relationship.
12. The method of determining a code adoption rate of claim 1, wherein, Determining the code adoption rate for the first response code using the code includes: Determine a first number of code pairs and a second number of lines of code included in the first response code; The code adoption rate is determined by the ratio of the first quantity to the second quantity.
13. The method of determining a code adoption rate of claim 1, wherein, Determining the evolutionary operation graph corresponding to the file includes: Generate abstract syntax trees for the new and old versions of the file, respectively; The differences between the abstract syntax trees corresponding to the new version file and the old version file are compared, and an evolutionary operation graph corresponding to the file is constructed based on the differences. The evolutionary operation graph uses the modified code fragment as nodes and the evolutionary operations on the code fragment as edges. The evolutionary operations include: refactoring operation, deletion operation, and repair operation.
14. The method of determining a code adoption rate of claim 1, wherein, Determining the adoption pattern of the second line of code through the evolutionary operation graph includes: Identify the target node in the evolutionary operation graph that includes the first line of code; The adoption mode of the second line of code is determined by the evolution operation type of the target node and the edges connected to the target node.
15. The method of determining a code adoption rate of claim 1, wherein, After determining the code acceptance rate for the first response code using the code pair, the method further includes: Obtain the adoption pattern of the second line of code in the code pair that belongs to the first response code; The intelligent programming assistant outputs an evaluation report within the first time range based on the code adoption rate and the adoption pattern.
16. An apparatus for determining a code adoption rate, the apparatus comprising: include: The acquisition module is used to acquire the first change code of the distributed version control system within a first time range, and to acquire the first response code generated by the intelligent programming assistant corresponding to the first change code; The first determining module is configured to determine a candidate set related to each line of code in the first change code in the first response code, and determine, through each line of code in the first change code and the candidate set, a code pair having a homologous relationship between the first change code and the first response code; The second determining module is configured to determine a code adoption rate of the first response code through the code pair. The device further comprises a third determining module configured to, after determining the code pair having the homologous relationship between the first change code and the first response code through each line of code in the first change code and the candidate set, determine an evolution operation graph corresponding to a file to which a first code line belongs in a case where the file is submitted for modification, wherein the code pair comprises the first code line belonging to the first change code and a second code line belonging to the first response code, and determine an adoption mode of the second code line through the evolution operation graph.
17. An electronic device, comprising: The method comprises: a memory configured to store a computer program; a processor configured to implement steps of the method for determining the code adoption rate according to any one of claims 1 to 15 when executing the computer program.
18. A computer-readable storage medium, characterized in that, The computer program is stored in the computer readable storage medium and is configured to implement steps of the method for determining the code adoption rate according to any one of claims 1 to 15 when executed by the processor.
19. A computer program product comprising a computer program, characterized in that, The computer program is configured to implement steps of the method for determining the code adoption rate according to any one of claims 1 to 15 when executed by the processor.
Citation Information
Patent Citations
Similarity detection method and system based on power information system code file
CN110471835A
Code adoption rate determination method and device, equipment, storage medium and product
CN120492310A