CN113377431A - Code processing method, device, equipment and medium - Google Patents

Code processing method, device, equipment and medium Download PDF

Info

Publication number
CN113377431A
CN113377431A CN202010118173.9A CN202010118173A CN113377431A CN 113377431 A CN113377431 A CN 113377431A CN 202010118173 A CN202010118173 A CN 202010118173A CN 113377431 A CN113377431 A CN 113377431A
Authority
CN
China
Prior art keywords
code
code change
change
group
blocks
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010118173.9A
Other languages
Chinese (zh)
Inventor
魏昭
梁广泰
王千祥
申博
张伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Peking University
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peking University, Huawei Technologies Co Ltd filed Critical Peking University
Priority to CN202010118173.9A priority Critical patent/CN113377431A/en
Priority to PCT/CN2020/112767 priority patent/WO2021169227A1/en
Publication of CN113377431A publication Critical patent/CN113377431A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/72Code refactoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a code changing method, which comprises the following steps: the method comprises the steps of obtaining a code change file of a code file of a current version relative to a code file of a basic version, analyzing a plurality of code change blocks included in the code change file, obtaining at least one incidence relation among the code change blocks, and grouping the code change blocks by using the incidence relation to obtain N code change groups so as to respectively execute code submission operation according to the N code change groups, thereby solving the problem that the subsequent code examination and regression test are influenced by the compound submission of codes, and further the software development efficiency is influenced.

Description

Code processing method, device, equipment and medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a code processing method, apparatus, device, and computer-readable storage medium.
Background
In developing software, developers are often faced with the development of multiple tasks. For example, when a developer develops a new feature, the developer may also check for code bugs (bugs) in existing code and repair the code bugs. After completing multiple tasks, developers often tend to commit all change code through one code commit operation, thus producing complex commits.
The submitted message submitted in a composite mode comprises a plurality of tasks of code change, and other users can hardly understand the intention of the code change, so that inconvenience is brought to code examination in a code development stage, code recovery (revert) in a code maintenance stage, regression testing (regression testing) in a preferred picking stage and the like, and software development efficiency is greatly influenced. Based on this, it is highly desirable to provide a code processing method to solve the problem that the compound submission of codes affects the subsequent code examination and regression test, and further affects the software development efficiency.
Disclosure of Invention
The application provides a code processing method, which analyzes by taking code change blocks as granularity, obtains the incidence relation among the code change blocks, and realizes intelligent code grouping based on the incidence relation, thereby solving the problem that the subsequent code examination and regression test are influenced by the compound submission of codes, and further the software development efficiency is influenced.
In a first aspect, the present application provides a code processing method. The method may be performed by a code processing apparatus, which may be deployed in a computer. The computer may be a terminal device such as a desktop computer, a notebook computer, a tablet computer, or the like, and in some cases, the computer may also include a server.
Specifically, the code processing apparatus may acquire a code change file of a code file of a current version (current version) with respect to a code file of a base version (base version). The basic version specifically refers to a version before redevelopment in the continuous development process, and the current version specifically refers to a version after redevelopment in the continuous development process. The code change file may include a plurality of code change blocks, considering that a plurality of code change operations may be included in one development process.
The code processing apparatus may analyze the code change blocks from at least one dimension to obtain at least one association relationship between the code change blocks, and then group the code change blocks by using the at least one association relationship to obtain N (N is a positive integer) code change groups, so as to perform a code submission operation according to the N code change groups, respectively.
The method realizes the intellectualization and the automatic grouping of the code change blocks by utilizing the incidence relation among the code change blocks, avoids the occurrence of missing report or false report during manual grouping, and improves the grouping accuracy. And code submitting operations are respectively executed according to the grouping results, and the tasks of code change contained in the submitting message corresponding to each code change group are greatly reduced, so that the difficulty of understanding the code change intention by other users is reduced, the code review in the code development stage and the code recovery, preferential selection and regression test in the code maintenance stage are facilitated, and the software development efficiency is improved.
In some possible implementation manners, considering that compiling is often required before code submission, the code processing device may also compile a code change group obtained by grouping to check grouping accuracy, and adjust a grouping result based on compiling prompt information when grouping is inaccurate, so as to optimize the grouping result, and further improve the grouping accuracy.
In a specific implementation, for any one code change group (referred to as a first code change group in this application) of the N code change groups, the code processing apparatus may compile a code according to a code segment of a current version included in a code change block of the first code change group to obtain compilation prompt information, and then adjust the first code change group according to the compilation prompt information.
Of course, the code processing apparatus may compile codes for each of a plurality of code change groups, for example, N code change groups, to obtain compilation prompt information corresponding to each code change group, and adjust the code change groups based on the obtained compilation prompt information. For example, when the compilation prompt information of a certain code alteration group indicates that the code alteration group lacks a certain function definition, and the compilation prompt information of another code alteration group indicates that the code alteration group defines the function but does not use the function, the code processing apparatus may move a code alteration block including the function definition from the another code alteration group to the code alteration group.
The code processing apparatus may further perform a step of performing code compilation based on a code segment of the current version included in the code change block included in the code change group of the code change group with respect to the adjusted code change group. If the compiling prompt information indicates that the compiling is passed or the compiling is successful, the flow of adjusting the grouping result according to the compiling prompt information can be ended, and if the compiling prompt information indicates that the compiling is not passed, namely, a compiling alarm or a compiling error exists, the code change group can be adjusted according to the alarm type (such as xxx functions lack of parenthesis and static decoration are not used) or the error type (undefined functions or undefined variables).
That is, the code processing apparatus may cyclically execute the steps of "performing code compilation based on the code segments of the current version included in the code change blocks of the first code change group to obtain compilation prompt information" and "adjusting the first code change group based on the compilation prompt information" until the code segments of the current version included in the code change blocks of the first code change group are compiled.
In some possible implementations, the code processing apparatus may also provide a grouping interface to manually adjust grouping results based on the grouping interface, further improve grouping accuracy, and improve compatibility.
Specifically, the grouping interface may present the grouping result of the code change block by the code processing apparatus. The grouping result may be a result of grouping by the code processing apparatus based on the association relationship between the code change blocks, or a result of adjusting the grouping result in conjunction with the compiling presentation information. When the user thinks that the grouping result is inaccurate, the grouping result can be adjusted through the grouping interface. The code processing apparatus may receive adjustment settings for the second code change group by the user via the group interface. Wherein the second code change group may be any one of the N code change groups. The second code changeset may be the same code changeset as the first code changeset or may be a different code changeset. The code processing apparatus may adjust the code change blocks of the second code change group according to the adjustment settings.
In some possible implementation manners, the code processing device may adaptively adjust other code change blocks in a self-learning manner based on the adjustment setting of a certain code change block or certain code change blocks in the second code change group by the user, so that the adjustment efficiency can be improved, and the operation convenience of the user can be improved.
Specifically, the adjustment settings of the second code change group by the user via the group interface may be adjustment settings for target code change blocks in the second code change group, which may be any one or more code change blocks in the second code change group. The code processing apparatus may adjust the object code change block in accordance with the adjustment setting, determine an associated code change block of the object code change block from a second code change group, and adjust the associated code change block in accordance with the adjustment setting.
In some possible implementations, the code processing apparatus may obtain a submission template corresponding to at least one code change group, and then generate a submission message according to the at least one code change group and the submission template corresponding thereto, so as to execute the code submission operation according to the submission message. On the basis, the problems that a plurality of change tasks are mixed in one submitted message, so that the change intention is difficult to understand, the subsequent flow of software development is influenced, and the software development efficiency is further influenced can be solved. On the other hand, the problems of low accuracy and low generalization capability caused by using a long-short-term memory network (LSTM) to generate the submit message can be improved.
In some possible implementations, the at least one association relationship between code change blocks may specifically include any one or more of an element definition and usage relationship, an element indirection usage relationship, or a similar change relationship. Wherein the code change block comprises a code segment, and the code segment comprises a statement carrying an element. The elements are components of statements in the code fragments, and may specifically include variables and/or functions. Thus, the element definition and usage relationship may specifically include a variable definition and usage relationship and/or a function definition and usage relationship. The element indirection usage relationship may specifically include a relationship between code change blocks that use the same element. The similar change relationship refers to the relationship between code change blocks with similar change behaviors.
The code processing apparatus can obtain the following relationships for the element definition and usage relationship, and the element indirect usage relationship. Specifically, the code processing apparatus may obtain a code change action set of each of a plurality of code change blocks, then parse the code change action set, obtain an element definition set and an element usage set of the current version and the base version corresponding to each code change block, and then obtain at least one of an element definition, a usage relationship, and an element indirect usage relationship between the plurality of code change blocks according to the element definition set and the element usage set of the current version and the base version corresponding to each code change block.
It should be noted that the code processing apparatus may analyze the code change blocks from multiple dimensions to obtain multiple association relationships between the code change blocks, such as element definition and usage relationships, indirect usage relationships, and similar usage relationships. This provides richer and more comprehensive information for code grouping, thereby improving the accuracy of grouping.
In a second aspect, the present application provides a code processing apparatus. The device specifically includes: the device comprises a communication module, an analysis module and a grouping module. The communication module is used for acquiring a code change file of the code file of the current version relative to the code file of the basic version, and the code change file comprises a plurality of code change blocks. And the analysis module is used for analyzing the code change blocks to obtain at least one incidence relation among the code change blocks. And the grouping module is used for grouping the code change blocks by utilizing the at least one incidence relation to obtain N code change groups so as to respectively execute code submission operation according to the N code change groups, wherein N is a positive integer.
In some possible implementations, the apparatus further includes:
and the adjusting module is used for compiling codes according to the code segments of the current version included in the code change blocks of the first code change group to obtain compiling prompt information and adjusting the first code change group according to the compiling prompt information.
In some possible implementations, the communication module is further configured to:
receiving the adjustment setting of the second code change group by the user through the grouping interface;
the device further comprises:
and the adjusting module is used for adjusting the code change block of the second code change group according to the adjusting setting.
In some possible implementations, the adjustment settings for the second code change group include adjustment settings for target code change blocks in the second code change group;
the adjustment module is specifically configured to:
adjusting the target code change block according to the adjustment setting;
determining an associated code change block of the target code change block from the second code change group;
and adjusting the associated code change block according to the adjustment setting.
In some possible implementations, the communication module is further configured to:
acquiring a submission template corresponding to at least one code change group;
the device further comprises:
and the submission module is used for generating a submission message according to the at least one code change group and the submission template corresponding to the code change group so as to execute the code submission operation according to the submission message.
In some possible implementations, the analysis module is specifically configured to:
acquiring a code change action set of each code change block in the plurality of code change blocks;
analyzing the code change action set to obtain an element definition set and an element use set of the current version and the basic version corresponding to each code change block;
and acquiring at least one of element definition, use relationship and element indirect use relationship among the code change blocks according to the element definition set and the element use set of the current version and the basic version corresponding to each code change block.
In a third aspect, the present application provides a computer comprising a processor and a memory. The processor and the memory are in communication with each other. The processor is configured to execute the instructions stored in the memory to cause the computer to perform the code processing method as in the first aspect or any implementation manner of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein instructions, which, when executed on a computer, cause the computer to perform the code processing method of the first aspect or any implementation manner of the first aspect.
In a fifth aspect, the present application provides a computer program product containing instructions which, when run on a computer, cause the computer to perform the code processing method of the first aspect or any implementation manner of the first aspect.
The present application can further combine to provide more implementations on the basis of the implementations provided by the above aspects.
Drawings
In order to more clearly illustrate the technical method of the embodiments of the present application, the drawings used in the embodiments will be briefly described below.
Fig. 1 is a schematic diagram of a code change file and a code change block according to an embodiment of the present application;
fig. 2 is a schematic system architecture diagram of a code processing method according to an embodiment of the present application;
fig. 3 is an interaction flowchart of a code processing method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a grouping interface provided by an embodiment of the present application;
fig. 5 is a schematic structural diagram of a computer according to an embodiment of the present application.
Detailed Description
The scheme in the embodiments provided in the present application will be described below with reference to the drawings in the present application.
The terms "first," "second," and the like in the description and in the claims of the present application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances and are merely descriptive of the various embodiments of the application and how objects of the same nature can be distinguished.
In order to facilitate understanding of the technical solutions of the present application, some technical terms related to the present application are described below.
The code file refers to a text file written according to a certain programming language specification. In this application, a code file generally refers to a source code file. The code file includes a series of human-readable computer language instructions that can be compiled by a compiler into binary instructions that can be executed by the computer. When a binary instruction is executed, a function corresponding to the binary instruction may be implemented.
The software development process is often sustainable, and developers can develop again on the basis of a certain version of code files to obtain the new version of code files. For example, a developer may modify a code bug (bug) in a version of a code file, add a new function (new function) or a new feature (new feature), and so on, to obtain a new version of the code file. For convenience of description, the version before being developed again may be referred to as a base version (base version), and the new version obtained by being developed again may be referred to as a current version (current version).
The difference portion of the current version of the code file relative to the base version of the code file may form a code change file. As shown in fig. 1, the code change file includes a plurality of code change blocks, each of which includes a code segment before change and a code segment after change, that is, a code segment of a base version and a code segment of a current version corresponding to the difference portion.
For ease of understanding, this application also provides an example of a code change block. As shown in FIG. 1, the code segment before and after modification in the code change block are both loop statements. For the code segment before modification, while is adopted for circulation, dead circulation is easy to generate, and thus code defects are generated. For the modified code segment, it loops with for. Since int is 32-bit integer, the variable sum will overflow when increasing to the maximum value, and the variable sum becomes negative, thereby ending the loop and repairing the code defect.
When a developer develops software, the developer develops the software for a plurality of tasks to generate a plurality of code change blocks. When a developer can submit the code change blocks through one code submission operation, a composite submission (composite submissions) is generated. Because the submitted message submitted in a composite mode contains a plurality of tasks of code change, difficulty in understanding the intention of the code change by other users is increased, inconvenience is brought to code examination in a code development stage, code recovery (revert), preference selection (cherry pick), regression testing (regression testing) and the like in a code maintenance stage, and software development efficiency is influenced.
Based on this, the application provides a code processing method. The method comprises the steps of analyzing a plurality of code change blocks in a code change file from a code change block layer to obtain at least one incidence relation among the code change blocks, and then grouping the code change blocks by using the at least one incidence relation to obtain N code change groups. Because the incidence relation among the code change blocks is considered by taking the code change blocks as the granularity, the missing report or the false report when the code change blocks are grouped is reduced, and the grouping accuracy is improved. And code submitting operation is respectively executed according to the N code change groups, and the code change tasks contained in the submission message corresponding to each code change group are greatly reduced, so that the difficulty of understanding the code change intention by other users is reduced, the code review in the code development stage and the code recovery, preferential selection and regression test in the code maintenance stage are facilitated, and the software development efficiency is improved.
Furthermore, the method also supports code compiling of the code segment of the current version included in the code change block of at least one code change group in the N code change groups, and adjusts the code change groups based on the compiling result, so that the code segment of the current version included in the code change block in the adjusted code change group is compiled. Due to the fact that the correctness of code compiling after grouping is considered, the grouping accuracy is further improved, and the software development efficiency is improved. In addition, the method also supports the manual adjustment of the code change groups by the user, and can perform self-adaptive adjustment based on the adjustment setting of the code change groups by the user so as to optimize the grouping result, so that the submission message corresponding to each code change group is easy to understand, and convenience is provided for subsequent code development and code maintenance.
It is understood that the code processing method provided by the present application can be applied in an application environment including, but not limited to, that shown in fig. 2.
As shown in fig. 2, the code processing apparatus 200 includes a communication module 202, an analysis module 204, and a grouping module 206. The communication module 202 is configured to obtain a code change file of a code file of a current version relative to a code file of a base version, where the code change file includes a plurality of code change blocks, the analysis module 204 may analyze the plurality of code change blocks to obtain at least one association relationship between the plurality of code change blocks, and the grouping module 206 groups the plurality of code change blocks by using the at least one association relationship to obtain N code change groups. Wherein N is a positive integer.
Further, the code processing apparatus 200 may further include an adjustment module 208. The adjusting module 208 may include a compiler. The adjusting module 208 may compile the code with a compiler according to the code segment of the current version included in the code change block of the first code change group (any one of the N code change groups), to obtain the compilation prompt information. The adjustment module 208 may then parse the compilation prompt and adjust the first code change set based on the parsing. For example, when the compiling hint information indicates that the function definition is absent from the first code change group, the code change block including the function definition in the other code change group may be moved to the first code change group.
The adjustment module 208 may also provide a grouping interface through which a user may adjust the code change group. Specifically, the communication module 202 is further configured to receive user adjustment settings for a second code change group (any one of N code change groups, which may be the same code change group as the first code change group or a different code change group) via a grouping interface, and the adjustment module 208 adjusts the code change blocks of the second code change group in response to the adjustment settings. In actual application, the adjustment module 208 may adjust the target code change block based on adjustment settings of the target code change block in the second code change group by the user through the grouping interface, determine an associated code change block of the target code change block from the second code change group, and adjust the associated code change block according to the adjustment settings. Therefore, the grouping result is optimized through at least one round of user interaction and self-adaptive adjustment, and the grouping accuracy is improved.
In some implementations, the code processing apparatus 200 also includes a commit module 210. The submission module 210 is configured to generate a submission message according to at least one code change group and a submission template corresponding to the code change group, and execute a code submission operation based on the submission message. For example, the code processing apparatus 200 may transmit the code grouping result, specifically, the N code change groups, to the classification apparatus 100. The communication module 102 of the classification device 100 receives the N code change groups, then the preprocessing module 104 of the classification device 100 generates corresponding feature vectors according to the N code change groups, and the classification module 106 of the classification device 100 can call the submission type predictor to predict the submission type of each code change group. The submission type predictor takes the feature vector as input and takes the submission type as output. The submission-type predictor may be trained using training samples generated from a large number of submission instances.
Classification module 106 may also retrieve a submission template from template repository 108 corresponding to the submission type based on the predicted submission type. Correspondingly, the communication module 102 may further send a submission template corresponding to each of the at least one code change group to the code processing apparatus 200, so that the code processing apparatus 200 generates a submission message according to the at least one code change group and the submission template corresponding thereto, and implements intelligent code submission based on the submission message.
The code processing apparatus 200 may be deployed locally, for example, in a local terminal device. The terminal device includes but is not limited to a desktop computer, a notebook computer, and the like. In some possible implementations, the code processing apparatus 200 may also be deployed in the cloud, for example, in a cloud server. The code processing method provided by the application can be realized in a mode that a user can access the cloud server through a browser. The classification apparatus 100 may be deployed in a terminal device or a server. It should be noted that the code processing apparatus 200 and the classification apparatus 100 may be deployed in different devices, so that the demand of the code processing apparatus 200 on system resources may be reduced, and the availability may be improved. Of course, the code processing apparatus 200 and the classification apparatus 100 may be disposed in the same device, and thus, the code processing efficiency may be improved.
In order to make the technical solution of the present application clearer and easier to understand, the following describes a code processing method of the present application with reference to an embodiment. This embodiment is exemplified in the case where the code processing apparatus 200 and the classification apparatus 100 are respectively disposed in different devices.
Referring to fig. 3, a flow chart of a code processing method is shown, the method comprising:
s302: the code processing apparatus 200 acquires a code change file of the code file of the current version with respect to the code file of the base version.
Specifically, when the user develops software based on the code processing apparatus 200, the user may change the code file of the base version, such as modifying a code defect in the code file of the base version, adding a new function or a code corresponding to a new characteristic on the basis of the code file of the base version, or deleting an existing function or a code corresponding to an existing characteristic on the basis of the code file of the base version, to obtain the code file of the current version. The code processing apparatus 200 may receive the code changed for each change action and obtain a code change file.
The code change file comprises a code change block corresponding to each change behavior. Considering that a user usually generates multiple change behaviors during software development, specifically multiple change behaviors for different tasks, a code change file may include multiple code change blocks. Wherein each code change block comprises a code segment of a current version and a code segment of a base version.
S304: the code processing apparatus 200 analyzes the plurality of code change blocks to obtain at least one association relationship between the plurality of code change blocks.
The code change block includes a code fragment, and the code fragment includes a statement that carries an element. In this embodiment, an element is a component of a statement in a code fragment, which may be a variable and/or a function, etc. When variables and/or functions are used, the variables and/or functions need to be defined.
Based on this, the code processing apparatus 200 can obtain the association relationship between the plurality of code change blocks from the element definition and use angle analysis. Specifically, the code processing apparatus 200 may obtain the variable definition and usage relationship between the plurality of code change blocks from the analysis of the variable definition and usage perspective. Of course, the code processing apparatus 200 may obtain the function definition and usage relationship between the plurality of code change blocks from the function definition and usage analysis.
In some possible implementations, the code processing apparatus 200 may further analyze a plurality of code change blocks to obtain an indirect use relationship. By indirectly using relationships is meant relationships between different code change blocks that use the same element, such as a variable or the same function. For example, if both code change block 1 and code change block 2 use function a, then code change block 1 and code change block 2 are said to have an indirect use relationship.
In the element definition and usage analysis, the code processing apparatus 200 may first obtain a code change action set of each code change block of the plurality of code change blocks, and specifically, the code processing apparatus 200 may determine the code change action set of each code change block by a syntax parsing tree differentiation algorithm, such as a gumtree algorithm, a change distillation change distiller algorithm, or the like. The code change action set comprises a set of all change actions included in the code change block. The change action includes any one or more of addition (add), deletion (delete), modification (change), and movement (move).
Then, the code processing apparatus 200 parses the code change action set, and obtains the element definition set and the element usage set of the current version and the base version corresponding to each code change block. Next, the code processing apparatus 200 obtains at least one association relationship among the element definitions, the usage relationships, and the element indirect usage relationships among the plurality of code change blocks according to the element definition set and the element usage set of the current version and the base version corresponding to each code change block.
In consideration that the alteration intents of similar code alteration behaviors are similar, in some possible implementations, the code processing apparatus 200 may also analyze the code alteration blocks from the dimension of similarity of the alteration behaviors to obtain the association relationship between the code alteration blocks.
Specifically, the code processing apparatus 200 may determine a change target and a change operation of each code change block, determine a degree of similarity of code change behaviors based on a degree of similarity of the change target and the degree of similarity of the change operation, and determine a code change block, of which the degree of similarity of the code change behaviors is greater than a preset threshold value, as a code change block having a similar change relationship. The change object refers to an object for which a change operation is performed, and the change object may be a variable, a function, or the like. The change operation may include adding, deleting, modifying, or moving, etc.
In practical applications, the code processing apparatus 200 may calculate the similarity of the code segment of the current version and the similarity of the code segment of the base version in the plurality of code change blocks, respectively, determine one group of similar code change blocks based on the similarity of the code segment of the current version, and determine another group of similar code change blocks based on the similarity of the code segment of the base version. And when the two groups of similar code change blocks are the same code change block, determining that the group of code change blocks are the code change blocks with similar change relations.
The code processing apparatus 200 can analyze the code change blocks from multiple dimensions, and obtain multiple association relationships among the code change blocks, such as obtaining direct use relationships (including function definition and use relationships and variable definition and use relationships), indirect use relationships, and similar change relationships among the code change blocks, so that the grouping accuracy can be improved.
S306: the code processing apparatus 200 groups the code change blocks by using the association relationship to obtain N code change groups.
In a specific implementation, the code processing apparatus 200 may divide the code change blocks having the relationship between the element definition and the usage into the same code change group by using the association relationship. Specifically, the code processing apparatus 200 divides code change blocks having a function definition and use relationship into the same code change group, and divides code change blocks having a variable definition and use relationship into the same code change group.
For example, if the code change block 1 defines a variable a and a function a, the code change block 2 uses the variable a, the code change block 3 uses the function a, and the code change block 4 uses the function B, the code processing apparatus 200 can divide the code change block 1, the code change block 2, and the code change block 3 into the same code change group, and divide the code change block 4 into different code change groups.
In some possible implementations, the code processing apparatus 200 may also divide code change blocks having similar change relationships into the same code change group using the association relationship. For example, the code change block 1 modifies the expression of the function a, the code change block 5 also modifies the expression of the function a, the objects to be changed are all the functions a, the change operations are all the modifications, and the code processing apparatus 200 determines that the code change block 1 and the code change block 5 are code change blocks having a similar change relationship, so that the code change block 1 and the code change block 5 are divided into the same code change group.
In a specific implementation, the code processing apparatus 200 may construct a change block relationship diagram for the plurality of code change blocks by using the association relationship, and then perform clustering processing on nodes in the change block relationship diagram by using a clustering algorithm, thereby implementing grouping of the code change blocks. Specifically, the code processing apparatus 200 constructs the change block relationship diagram by using the code change block as a node and constructing an edge of the change block relationship diagram according to the association relationship of the code change block. Further, the code processing apparatus 200 may assign a corresponding weight to each edge according to the association degree, so that the change block relationship diagram can more accurately express the association relationship between the code change blocks. When the changed block relational graph is subjected to clustering processing, nodes in the changed block relational graph can be clustered through a K-means clustering algorithm, a mean shift clustering algorithm or a hierarchical clustering algorithm, so that N code change groups are obtained.
When grouping code change blocks, each code change block belongs to one code change group. When a code change block has an association relationship with a code change block of a different code change group, the code processing apparatus 200 may determine the code change group to which the code change block is ultimately attributed, based on the weight of the different association relationship.
S308: the code processing apparatus 200 compiles a code according to a code segment of the current version included in the code change block of the first code change group, and obtains compilation prompt information.
In consideration of the code compiling correctness, the code processing apparatus 200 may compile a code segment of the current version included in a code change block of a code change group, for example, compile a code segment of the current version included in a code change block of any one code change group (i.e., a first code change group) of N code change groups to detect a code change group having a compiling problem in advance, and adjust the code change group having the compiling problem, so as to avoid the submitted code change group from including the compiling problem, and further improve the grouping accuracy.
For convenience of description, the following description will be exemplified by compiling the code fragments of the current version included in the code change blocks of the N code change groups, respectively. In a specific implementation, the code processing apparatus 200 may select a corresponding compiler according to a programming language of the code segment to perform code compilation on the code segments of the current versions included in the code change blocks in the N code change groups, respectively. For example, the code processing apparatus 200 may be compiled using Gradle or MVN for code fragments in the Java programming language. The compiler can output the compiling prompt information after compiling is finished.
The compiling prompting information may specifically include a plurality of types, such as a compiling error (compiling error) or a compiling warning (compiling warning). Wherein the compiling error indicates that the code segment has an error and cannot be converted into an executable program. The compilation alarm indicates that a code fragment presents a risk point that may cause an exception to the executable program that the code fragment translates while executing.
For ease of understanding, this application also provides some specific examples of compilation errors and compilation alarms. In one example, a compilation error may be an undefined function or an undefined variable, etc., and a compilation alarm may be the lack of parenthesis, the static decorated xxx functions are not used, etc.
It should be noted that the compiling prompt information also includes a position where a compiling error occurs or a compiling alarm is given. The location may be specifically characterized by a line number in the code file.
S310: the code processing apparatus 200 adjusts the first code change group according to the compilation prompt information.
The code processing apparatus 200 may analyze the compilation presentation information and adjust the first code change group according to the analysis result. Specifically, the code processing apparatus 200 analyzes the compilation prompt information, and if the analysis result indicates that the variable definition is absent from the first code alteration group, adds a code alteration block including the variable definition to the first code alteration group, and if the analysis result indicates that the function definition is absent from the first code alteration group, adds a code alteration block including the function definition to the first code alteration group.
Further, the code processing apparatus 200 may re-execute the code compiling step after adjusting the first code change group according to the compiling hint information. If the compiler still outputs the compiling error or the compiling alarm, the first code change group can be continuously adjusted until the code segments of the current version included in the code change blocks in the adjusted first code change group are compiled to pass. If the compiler outputs a compilation success, the subsequent steps may be performed. That is, the code processing apparatus 200 may further loop through the above S308 to S310 until all the code segments of the current version included in the code change block in the adjusted code change group are compiled.
S312: the code processing apparatus 200 receives adjustment settings of target code change blocks in the second code change group by a user through a group interface.
In some possible implementations, the code processing apparatus 200 further supports a user to group codes or adjust existing grouping results. When the user thinks that the grouping of a certain code change block or certain code change blocks is not accurate, the grouping result can be adjusted through the grouping interface.
Specifically, the code processing apparatus 200 is provided with a grouping interface that can expose N code change groups obtained by grouping a plurality of code change blocks by the code processing apparatus 200. The user may adjust any one code change group (i.e., the second code change group) of the N code change groups, specifically, any one or more code change blocks (i.e., target code change blocks) of the second code change group, through the grouping interface. For example, a user may move a code change block in one code change group to another code change group through the grouping interface, thus implementing adjustment of the two code change groups.
The code processing apparatus 200 receives adjustment settings for target code change blocks in the second code change group by a user via the group interface to effect manual adjustment of the second code change group. The second code change group and the first code change group may be the same code change group or different code change groups.
Fig. 4 shows a schematic diagram of adjusting a code change group through a grouping interface, as shown in fig. 4, a frame of the grouping interface includes N sub-frames, each sub-frame is used to display a code change block in one code change group, and the N sub-frames are used to display code change blocks in N code change groups obtained by the code processing apparatus 200. When a user clicks any code change block, the two frames above the N sub frames respectively show the code segment of the base version and the code segment of the current version included in the code change block, that is, the code segment before modification and the code segment after modification. Therefore, the difference between the code segment of the base version and the code segment of the current version in the code change block can be conveniently checked.
In this example, N is specifically 5. The first code change group comprises 3 code change blocks, and the second to fifth code change groups respectively comprise 6 code change blocks. The user can move the code change block included in the code change group by dragging or the like.
In some possible implementations, as shown in fig. 4, the grouping interface may also provide a navigation bar that presents a list of code files through which the user can quickly switch to a specified file. Certainly, the grouping interface can also provide a change intention display column, when a user clicks any code change block, the change intention display column can display the change intention corresponding to the code change block, the user can conveniently and quickly check the change intention, and the adjustment efficiency is improved. The change intention display bar may further provide an editing control, so as to support the user to modify the change intention through the editing control. When the user thinks the intention of change is incorrect, can make the modification through the above-mentioned edit control.
It should be noted that the N code change groups displayed by the grouping interface may be N code change groups obtained by compiling and adjusting. Of course, when S308 to S310 are not executed, the N code change groups displayed on the grouping interface may be N code change groups divided by the code processing apparatus 200 according to at least one association relationship between a plurality of code change blocks.
S314: the code processing apparatus 200 adjusts the target code change block according to the adjustment setting.
The code processing apparatus 200 may adjust the object code change block of the second code change group according to the received adjustment setting. For example, the code processing apparatus 200 moves the object code change block from the second code change group to another code change group or deletes the object code change block from the second code change group according to the adjustment setting.
S316: the code processing apparatus 200 determines a related code change block of the target code change block from the second code change group, and adjusts the related code change block according to the adjustment setting.
In some possible implementations, the code processing apparatus 200 records change information of a code change block that performs an adjustment operation. The change information may specifically include a source group and a destination group to which the code change block belongs, that is, a code change group to which the code change block belongs before adjustment and a code change group to which the code change block belongs after adjustment. The code processing apparatus 200 analyzes the reason for the user to adjust the code change block, specifies a related code change block that needs to be adjusted in association with at least one kind of association relationship between a plurality of code change blocks, and adjusts the related code change block based on the adjustment setting.
In some possible implementations, the code processing apparatus 200 may not perform the above steps, and the user may manually adjust the associated code change block.
S318: the code processing apparatus 200 transmits a classification request message to the classification apparatus 100.
The classification request message includes at least one code change group of the N code change groups. The classification request message is specifically used for classifying at least one code change group in the N code change groups to obtain a submission type of the at least one code change group.
The commit type specifically refers to a type of commit message (commit message). In actual application, the commit type may include at least one of a bug fix (bug fix), a reconstruction (refactors), a new feature (feature), and a reformatting (reformat). The code processing apparatus 200 generates a commit message of at least one code change group by transmitting a sort request message to the sorting apparatus 100 to acquire a commit type of at least one code change group of the N code change groups.
S320: the classification apparatus 100 generates a feature vector from at least one code alteration group.
The classification apparatus 100 extracts the feature vector corresponding to each code alteration group according to the code segment included in the code alteration block in the code alteration group. Specifically, the classification apparatus 100 may extract a code change action set from code segments included in code change blocks in a code change group, and then generate a feature vector corresponding to the code change group from the code change action set.
In actual application, the classification device 100 may perform vectorization processing on the code change operation set to generate a feature vector corresponding to the code change group. Each code change action in the set of code change actions may be identified by a change operation and a change object. The change operation includes add, delete, change, or move, and the change object may be a variable or a function, and specifically includes a variable declaration and a function definition. The variable declaration and the function definition correspond to an AST node type in an Abstract Syntax Tree (AST), respectively.
The classification apparatus 100 may tile each of the four change operations into n AST node types in order into one-dimensional vector. If a certain AST node type is add in the present submission, the element value of the corresponding element in the one-dimensional vector is added by 1. For AST node types that do not occur in any of the four operations, the element value of the corresponding element in the one-dimensional vector is set to 0. Thus, the feature vector corresponding to the code change group can be obtained.
In some possible implementations, the classification apparatus 100 may not only consider fine-grained code change actions from a microscopic aspect, but also consider statistical characteristics of code changes from a macroscopic aspect when extracting feature vectors, such as the number of code change blocks in a code change group, the number of code change blocks in a code change group relating to a definition and usage relationship, the number of code change blocks in a code change group relating to a similar change relationship, and so on. Specifically, the classification device 100 may add several elements on the basis of the one-dimensional vector, and assign the statistical values to the elements. Therefore, more comprehensive characteristic vectors can be extracted, more information is provided for the classification model, and the classification accuracy of the classification model is improved.
S322: the classification device 100 predicts a commit type of the at least one code change group according to the feature vector.
In practical applications, the classification apparatus 100 may predict a commit type of at least one code change group using a commit type predictor. The submission type predictor takes the feature vector as input and takes the submission type of the code change group as output. Therefore, the classification apparatus 100 inputs the feature vector of at least one code change group into the submission type predictor, and the submission type predictor can predict the submission type of at least one code change group and output the prediction result.
The submission type predictor can perform model training generation by adopting a machine learning method based on training samples acquired in advance. A training sample includes a feature vector extracted from the code fragment included in the historical commit message and a commit type tag. The specific implementation of extracting the feature vector from the code segment included in the history submission message may be described in relation to S320, and is not described in detail here. The commit type tag may be determined based on a commit log (commit log).
Specifically, the keywords of the submission log include the submission type. The sorting apparatus 100 automatically generates a submission-type tag by analyzing the submission log. The submission type label may be identified with a different number. For example, bug fix may be identified with the number 00 and the refactor may be identified with the number 01. The classification device 100 splices the feature vectors and the submission type labels to generate training samples.
Because the vector dimension of the training samples is large, and a plurality of training samples form a sparse matrix, the classification device 100 can remove the sparsity of the matrix by using a dimension reduction algorithm. Finally, the classification device 100 performs model training on the matrix without sparsity by using a machine learning algorithm, such as xgboost, to obtain a submission type predictor.
S324: the classification apparatus 100 obtains a submission template corresponding to at least one code change group from the template library.
The classification device 100 may mine historical submission messages of various submission types stored in the code repository, so as to obtain a universal template of the submission messages of various submission types, where the universal template may be used as a submission template corresponding to the submission type.
Table 1 shows an example of a submission template:
table 1 submission template example
bug fix:fix an XXX issue
refactor:change XXX
new feature:add/Wrap XXX for XXX
reformat:change XXX(eg.spaces)
Where XXX in table 1 is the content to be populated in the submission template, which may be determined by the extracted code features in the code change group.
The classification device 100 may query the template library, and obtain a submission template matching the submission type of at least one code change group from the template library as a submission template corresponding to the code change group.
S326: the classification apparatus 100 transmits a classification response message to the code processing apparatus 200.
The classification response message comprises at least one submission template corresponding to the code change group.
S328: the code processing apparatus 200 generates a commit message according to at least one code change group and its corresponding commit template, so as to perform a code commit operation based on the commit message.
Specifically, the code processing apparatus 200 may extract code features for at least one code change group, determine keywords based on the code features, fill the keywords into a submission template corresponding to the code change group, and generate a submission message. A code commit operation may be triggered based on the commit message.
In some possible implementations, the code processing apparatus 200 may also present the submission message so that the user confirms the correctness of the submission message. When the user confirms that the submitted message is incorrect, the code processing device 200 supports the user to modify the submitted message, such as the keywords in the submitted message, so as to ensure the correctness of the submitted message in a user interaction mode.
S308 to S316 are optional steps performed in the embodiment of the present application to further improve the grouping accuracy, and in some possible implementations, the steps may not be performed. S318 to S328 are optional steps implemented for generating the submit message in the embodiment of the present application, and in some possible implementations, other implementations may also be implemented.
Based on the above description, an embodiment of the present application provides a code processing method. According to the method, the code change blocks are used as grouping granularity for grouping, grouping is not performed from the change of a file level with relatively coarse granularity, grouping is not performed from the transformation of each code characteristic with fine granularity, and the problems that grouping is not accurate due to too large granularity and grouping is too much due to too fine granularity are solved. The method can also comprehensively consider various incidence relations among the code feature blocks, such as variable definition and use relations, function definition and call relations, indirect use relations or similar change relations, and provides richer and more comprehensive information for code grouping, so that the grouping accuracy is improved.
Furthermore, the method also combines the compiling prompt information to dynamically adjust the grouping result, ensures that the adjusted code change group is compiled to pass, and further improves the accuracy of code grouping. In addition, the method also supports the adjustment of the grouping result in a user interaction mode, and the grouping result is adaptively adjusted according to the adjustment setting of the user, so that the optimized grouping result is obtained.
The method also supports the determination of the submission type based on the grouping result and automatically generates the submission message by combining with the submission template corresponding to the submission type. On one hand, corresponding submission messages are respectively generated for different code change groups, and the problems that one submission message is mixed with a plurality of change tasks, so that change intentions are difficult to understand, subsequent processes of software development are influenced, and further the software development efficiency is influenced are solved. On the other hand, the problems of low accuracy and low generalization capability caused by using a long-short-term memory network (LSTM) to generate the submit message can be improved.
The code processing method provided by the present application is described in detail above with reference to fig. 1 to 4, and the apparatus and device provided by the present application will be described below with reference to the accompanying drawings.
Referring to the schematic structural diagram of the code processing apparatus 200 shown in fig. 2, the code processing apparatus 200 includes a communication module 202, an analysis module 204, and a grouping module 206.
The communication module 202 is configured to obtain a code change file of the code file of the current version relative to the code file of the base version, where the code change file includes a plurality of code change blocks.
The analysis module 204 is configured to analyze the code change blocks to obtain at least one association relationship between the code change blocks.
A grouping module 206, configured to group the multiple code change blocks by using the at least one association relationship to obtain N code change groups, so as to respectively execute a code submission operation according to the N code change groups, where N is a positive integer.
In some possible implementations, the apparatus 200 further includes:
and the adjusting module 208 is configured to perform code compiling according to the code segment of the current version included in the code change block of the first code change group to obtain compiling prompt information, and adjust the first code change group according to the compiling prompt information.
In some possible implementations, the communication module 202 is further configured to:
receiving the adjustment setting of the second code change group by the user through the grouping interface;
the apparatus 200 further comprises:
an adjusting module 208 for adjusting the code change blocks of the second code change group according to the adjustment settings.
In some possible implementations, the adjustment settings for the second code change group include adjustment settings for target code change blocks in the second code change group;
the adjusting module 208 is specifically configured to:
adjusting the target code change block according to the adjustment setting;
determining an associated code change block of the target code change block from the second code change group;
and adjusting the associated code change block according to the adjustment setting.
In some possible implementations, the communication module 202 is further configured to:
acquiring a submission template corresponding to at least one code change group;
the apparatus 200 further comprises:
a submission module 210, configured to generate a submission message according to the at least one code change group and the submission template corresponding to the code change group, so as to execute the code submission operation according to the submission message.
In some possible implementations, the analysis module 204 is specifically configured to:
acquiring a code change action set of each code change block in the plurality of code change blocks;
analyzing the code change action set to obtain an element definition set and an element use set of the current version and the basic version corresponding to each code change block;
and acquiring at least one of element definition, use relationship and element indirect use relationship among the code change blocks according to the element definition set and the element use set of the current version and the basic version corresponding to each code change block.
The code processing apparatus 200 according to the embodiment of the present application may correspond to performing the method described in the embodiment of the present application, and the above and other operations and/or functions of each module of the code processing apparatus 200 are respectively for implementing corresponding flows of each method in fig. 3, and are not described herein again for brevity.
The code processing apparatus 200 described above may be implemented by a computer. Fig. 5 provides a schematic structural diagram of a computer, and as shown in fig. 5, the computer can be specifically used to implement the functions of the code processing apparatus 200 in the embodiment shown in fig. 2. The computer 500 includes a bus 501, a processor 502, a communication interface 503, and a memory 504. The processor 502, memory 504 and communication interface 503 communicate via the bus 501. The bus 501 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus. The communication interface 503 is used for communication with the outside. For example, the communication interface 503 may be used to obtain a code change file of the code file of the current version relative to the code file of the base version, and the like.
The processor 502 may be a Central Processing Unit (CPU). The memory 504 may include volatile memory (volatile memory), such as Random Access Memory (RAM). The memory 504 may also include a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, an HDD, or an SSD.
The memory 504 stores executable code that the processor 502 executes to perform the aforementioned code processing methods.
Specifically, in the case of implementing the embodiment shown in fig. 2, and in the case where the modules of the code processing apparatus 200 described in the embodiment of fig. 2 are implemented by software, software or program code required to perform the functions of the analysis module 204, the grouping module 206, the adjustment module 208, and the submission module 210 in fig. 2 is stored in the memory 504. The communication module 202 functionality may be implemented via the communication interface 503. The communication interface 503 acquires the code change file, transmits the code change file to the processor 502 through the bus 501, and the processor 502 executes the program codes corresponding to the modules stored in the memory 504, executes the code processing method, and realizes intelligent grouping of a plurality of code change blocks in the code change file.
An embodiment of the present application also provides a computer-readable storage medium, which includes instructions that, when executed on a computer, cause the computer to execute the code processing method applied to the code processing apparatus 200.
The embodiment of the application also provides a computer program product, and when the computer program product is executed by a computer, the computer executes any one of the code processing methods. The computer program product may be a software installation package which may be downloaded and executed on a computer in the event that any of the aforementioned code processing methods are required.
It should be noted that the above-described embodiments of the apparatus are merely schematic, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiments of the apparatus provided in the present application, the connection relationship between the modules indicates that there is a communication connection therebetween, and may be implemented as one or more communication buses or signal lines.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present application can be implemented by software plus necessary general-purpose hardware, and certainly can also be implemented by special-purpose hardware including special-purpose integrated circuits, special-purpose CPUs, special-purpose memories, special-purpose components and the like. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions may be various, such as analog circuits, digital circuits, or dedicated circuits. However, for the present application, the implementation of a software program is more preferable. Based on such understanding, the technical solutions of the present application may be substantially embodied in the form of a software product, which is stored in a readable storage medium, such as a floppy disk, a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, an exercise device, or a network device) to execute the method according to the embodiments of the present application.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, training device, or data center to another website site, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device, such as a training device, a data center, etc., that incorporates one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.

Claims (14)

1. A method of code processing, the method comprising:
acquiring a code change file of a code file of a current version relative to a code file of a basic version, wherein the code change file comprises a plurality of code change blocks;
analyzing the code change blocks to obtain at least one incidence relation among the code change blocks;
and grouping the code change blocks by using the at least one incidence relation to obtain N code change groups so as to respectively execute code submission operation according to the N code change groups, wherein N is a positive integer.
2. The method of claim 1, further comprising:
compiling codes according to the code segments of the current version included in the code change blocks of the first code change group to obtain compiling prompt information;
and adjusting the first code change group according to the compiling prompt information.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
receiving the adjustment setting of the second code change group by the user through the grouping interface;
and adjusting the code change block of the second code change group according to the adjustment setting.
4. The method of claim 3, wherein the adjustment settings for the second code change group include adjustment settings for target code change blocks in the second code change group;
said adjusting the code change block of the second code change group according to the adjustment setting comprises:
adjusting the target code change block according to the adjustment setting;
determining an associated code change block of the target code change block from the second code change group;
and adjusting the associated code change block according to the adjustment setting.
5. The method of any one of claims 1 to 4, further comprising:
acquiring a submission template corresponding to at least one code change group;
and generating a submission message according to the at least one code change group and the submission template corresponding to the code change group so as to execute the code submission operation according to the submission message.
6. The method according to any one of claims 1 to 5, wherein the analyzing the code change blocks to obtain at least one association relationship between the code change blocks comprises:
acquiring a code change action set of each code change block in the plurality of code change blocks;
analyzing the code change action set to obtain an element definition set and an element use set of the current version and the basic version corresponding to each code change block;
and acquiring at least one of element definition, use relationship and element indirect use relationship among the code change blocks according to the element definition set and the element use set of the current version and the basic version corresponding to each code change block.
7. A code processing apparatus, characterized in that the apparatus comprises:
the communication module is used for acquiring a code change file of the code file of the current version relative to the code file of the basic version, and the code change file comprises a plurality of code change blocks;
the analysis module is used for analyzing the code change blocks to obtain at least one incidence relation among the code change blocks;
and the grouping module is used for grouping the code change blocks by utilizing the at least one incidence relation to obtain N code change groups so as to respectively execute code submission operation according to the N code change groups, wherein N is a positive integer.
8. The apparatus of claim 7, further comprising:
and the adjusting module is used for compiling codes according to the code segments of the current version included in the code change blocks of the first code change group to obtain compiling prompt information and adjusting the first code change group according to the compiling prompt information.
9. The apparatus of claim 7 or 8, wherein the communication module is further configured to:
receiving the adjustment setting of the second code change group by the user through the grouping interface;
the device further comprises:
and the adjusting module is used for adjusting the code change block of the second code change group according to the adjusting setting.
10. The apparatus of claim 9, wherein the adjustment settings for the second code change group include adjustment settings for target code change blocks in the second code change group;
the adjustment module is specifically configured to:
adjusting the target code change block according to the adjustment setting;
determining an associated code change block of the target code change block from the second code change group;
and adjusting the associated code change block according to the adjustment setting.
11. The apparatus of any one of claims 7 to 10, wherein the communication module is further configured to:
acquiring a submission template corresponding to at least one code change group;
the device further comprises:
and the submission module is used for generating a submission message according to the at least one code change group and the submission template corresponding to the code change group so as to execute the code submission operation according to the submission message.
12. The apparatus according to any one of claims 7 to 11, wherein the analysis module is specifically configured to:
acquiring a code change action set of each code change block in the plurality of code change blocks;
analyzing the code change action set to obtain an element definition set and an element use set of the current version and the basic version corresponding to each code change block;
and acquiring at least one of element definition, use relationship and element indirect use relationship among the code change blocks according to the element definition set and the element use set of the current version and the basic version corresponding to each code change block.
13. A computer, wherein the computer comprises a processor and a memory;
the processor of the computer is configured to execute the instructions stored in the memory to cause the computer to perform the code processing method according to any one of claims 1 to 6.
14. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the code processing method of any one of claims 1 to 6.
CN202010118173.9A 2020-02-25 2020-02-25 Code processing method, device, equipment and medium Pending CN113377431A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010118173.9A CN113377431A (en) 2020-02-25 2020-02-25 Code processing method, device, equipment and medium
PCT/CN2020/112767 WO2021169227A1 (en) 2020-02-25 2020-09-01 Code processing method, apparatus and device, and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010118173.9A CN113377431A (en) 2020-02-25 2020-02-25 Code processing method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN113377431A true CN113377431A (en) 2021-09-10

Family

ID=77489853

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010118173.9A Pending CN113377431A (en) 2020-02-25 2020-02-25 Code processing method, device, equipment and medium

Country Status (2)

Country Link
CN (1) CN113377431A (en)
WO (1) WO2021169227A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113760300B (en) * 2021-09-13 2023-10-27 武汉联影智融医疗科技有限公司 Software continuous integration method, device, computer equipment and storage medium
CN114064472B (en) * 2021-11-12 2024-04-09 天津大学 Automatic software defect repairing acceleration method based on code representation
CN115904480B (en) * 2023-01-09 2023-07-14 成方金融科技有限公司 Code reconstruction method, device, electronic equipment and storage medium
CN117492822B (en) * 2023-12-29 2024-03-29 杭州新中大科技股份有限公司 Change contrast method, device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190026106A1 (en) * 2017-07-20 2019-01-24 Ca, Inc. Associating software issue reports with changes to code
CN109947462A (en) * 2019-03-15 2019-06-28 武汉大学 A kind of decision support method and device that the change of software-oriented code is integrated
CN110262966A (en) * 2019-06-03 2019-09-20 深圳前海微众银行股份有限公司 A kind of coverage information acquisition methods and device

Also Published As

Publication number Publication date
WO2021169227A1 (en) 2021-09-02

Similar Documents

Publication Publication Date Title
US20230418732A1 (en) System and method for performing automated api tests
US10162610B2 (en) Method and apparatus for migration of application source code
CN113377431A (en) Code processing method, device, equipment and medium
US20190108001A1 (en) Correction of code errors using machine learning
CA2949251C (en) Systems and methods for software analysis
US10649836B2 (en) Detecting an error message and automatically presenting links to relevant solution pages
US20220318130A1 (en) Auto test generator
JP6911059B2 (en) Query optimizer for CPU utilization and code refactoring
US9311077B2 (en) Identification of code changes using language syntax and changeset data
CN111736840A (en) Compiling method and running method of applet, storage medium and electronic equipment
CN108197024B (en) Embedded browser debugging method, debugging terminal and computer readable storage medium
CN114138244A (en) Method and device for automatically generating model files, storage medium and electronic equipment
CN115543781A (en) Method and interactive system for automatically verifying automobile software model
CN110928760B (en) Unit test method and device in embedded system
CN115220863A (en) Operation and maintenance method and device for container application, computer equipment and storage medium
Lavoie et al. A case study of TTCN-3 test scripts clone analysis in an industrial telecommunication setting
CN114356783A (en) Method and device for automatically generating unit test code, storage medium and equipment
CN111611173A (en) System and method applied to micro-service engineering interface document detection
CN117520136A (en) Function test method, device and equipment of application program and readable storage medium
Carvalho Structural Clustering of Web Pages for Usage Pattern Mining
CN113010406A (en) Management method, device, equipment and medium of code analysis tool
CN114490370A (en) Multi-language compatible test method and device and electronic equipment
CN116560976A (en) Fine granularity test case detection method based on machine learning
CN113448825A (en) Method, device, equipment and storage medium for determining newly added software defect
CN115794858A (en) Query statement processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
TA01 Transfer of patent application right

Effective date of registration: 20220624

Address after: 550025 Huawei cloud data center, jiaoxinggong Road, Qianzhong Avenue, Gui'an New District, Guiyang City, Guizhou Province

Applicant after: Huawei Cloud Computing Technologies Co.,Ltd.

Applicant after: Peking University

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Applicant before: HUAWEI TECHNOLOGIES Co.,Ltd.

Applicant before: Peking University

TA01 Transfer of patent application right
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination