Program code processing method and computer program product

By building a three-dimensional dependency graph, the chain reaction problem when modifying common components is solved, the modification efficiency and application stability are improved, the cost of understanding for new employees is reduced, and cross-team collaboration is promoted.

CN120780348APending Publication Date: 2025-10-14SHENZHEN DACHENG COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510893702.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-10-14

AI Technical Summary

Technical Problem

During the front-end development of an application, it is difficult to assess the chain reaction caused by modifying common components due to their widespread reference, especially when the scope of impact is difficult to determine in a large program code.

Method used

By constructing a three-dimensional dependency graph including forward dependencies, reverse reference relationships, and circular dependencies, we can characterize the relationship between program codes and help developers quickly assess the impact of modifications.

Benefits of technology

It improves the efficiency of modifying component program code, reduces major regression issues, improves the stability and security of the application, reduces the cost of understanding for new employees, and promotes cross-team collaboration and code optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120780348A_ABST
    Figure CN120780348A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a program code processing method and a computer program product, and belongs to the technical field of computers. A modification instruction is received, the modification instruction is used for requesting to modify a program code of a first target component in a first program code of the application program, and the first program code comprises program codes of a plurality of components; a first dependency graph of the first program code is determined, the first dependency graph comprises a first dependency relationship, a second dependency relationship and a third dependency relationship, and the first dependency relationship is used for representing the dependency relationship between the program code of the component corresponding to the father node and the program code of the component corresponding to the child node; the second dependency relationship is used for representing a dependency relationship between a program code of a component corresponding to the child node and a program code of a component corresponding to the father node, and the third dependency relationship is used for representing an interdependency relationship between program codes of at least two components; and modifying the program code of the first target component based on the first dependency graph and the modification instruction.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of computer, and particularly, relate to a processing method of program code and a computer program product. BACKGROUND

[0002] In the front-end development process of an application program, modifying a public component is a very challenging task; because the public component is usually referenced by multiple businesses or even multiple projects, any subtle change of the public component can cause extensive chain reaction modification. However, with the powerful function of the application program and the passage of time, the program code of the application program becomes more and more huge, and it becomes extremely difficult to assess the modification impact of the public component. SUMMARY

[0003] Embodiments of the present application provide a processing method of program code and a computer program product. The technical solution is as follows:

[0004] In one aspect, the embodiments of the present application provide a processing method of program code, and the method comprises:

[0005] receiving a modification instruction, the modification instruction being used to request modification of program code of a first target component in first program code of an application program, the first program code comprising program code of multiple components, different components being used to implement different functions of the application program;

[0006] determining a first dependency graph of the first program code, the first dependency graph comprising a first dependency relationship, a second dependency relationship and a third dependency relationship between the program code of the multiple components, the first dependency relationship being used to represent a dependency relationship between program code of a component corresponding to a parent node and program code of a component corresponding to a child node, the second dependency relationship being used to represent a dependency relationship between program code of a component corresponding to a child node and program code of a component corresponding to a parent node, and the third dependency relationship being used to represent a mutual dependency relationship between program code of at least two components;

[0007] modifying the program code of the first target component based on the first dependency graph and the modification instruction.

[0008] In another aspect, the embodiments of the present application provide a processing device of program code, and the device comprises:

[0009] a first receiving module, configured to receive a modification instruction, the modification instruction being used to request modification of program code of a first target component in first program code of an application program, the first program code comprising program code of multiple components, different components being used to implement different functions of the application program;

[0010] a first determining module, configured to determine a first dependency graph of the first program code, the first dependency graph comprising a first dependency relationship, a second dependency relationship, and a third dependency relationship between the program codes of the plurality of components, the first dependency relationship being used to represent a dependency relationship between the program code of the component corresponding to the parent node and the program code of the component corresponding to the child node, the second dependency relationship being used to represent a dependency relationship between the program code of the component corresponding to the child node and the program code of the component corresponding to the parent node, and the third dependency relationship being used to represent a mutual dependency relationship between the program codes of at least two components;

[0011] A modification module is used to modify the program code of the first target component based on the first dependency graph and the modification instruction.

[0012] On the other hand, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein the memory stores at least one computer instruction, and the at least one computer instruction is loaded and executed by the processor to implement the program code processing method described in the above aspects.

[0013] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which stores at least one computer instruction, and the at least one computer instruction is used to be executed by a processor to implement the program code processing method described in the above aspects.

[0014] On the other hand, an embodiment of the present application provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the program code processing method described in the above aspects.

[0015] In an embodiment of the present application, the first dependency graph includes a first dependency relationship, a second dependency relationship, and a third dependency relationship; the first dependency relationship is used to characterize the forward dependency relationship of the program codes of multiple components, the second dependency relationship is used to characterize the reverse reference relationship of the program codes of multiple components, and the third dependency relationship is used to characterize the circular dependency relationship of the program codes of multiple components; therefore, the first dependency graph can characterize the relationship between the program codes of multiple components from three dimensions, so that the first dependency graph can provide application developers with a more comprehensive dependency relationship, thereby helping developers to quickly evaluate the impact scope of modifications to the component program code, which also improves the modification efficiency of the component program code based on the first dependency graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1is a flowchart of a method for processing program code according to an exemplary embodiment of the present application;

[0017] Figure 2 is a flowchart of a method for processing program code according to an exemplary embodiment of the present application;

[0018] Figure 3 is a schematic diagram of a method for processing program code according to an exemplary embodiment of the present application;

[0019] Figure 4 is a schematic diagram of a method for processing program code according to an exemplary embodiment of the present application;

[0020] Figure 5 is a flowchart of a method for processing program code according to an exemplary embodiment of the present application;

[0021] Figure 6 is a schematic diagram of a method for processing program code according to an exemplary embodiment of the present application;

[0022] Figure 7 is a schematic diagram of a method for processing program code according to an exemplary embodiment of the present application;

[0023] Figure 8 is a schematic diagram of a method for processing program code according to an exemplary embodiment of the present application;

[0024] Figure 9 is a flowchart of a method for processing program code according to an exemplary embodiment of the present application;

[0025] Figure 10 is a schematic diagram of a method for processing program code according to an exemplary embodiment of the present application;

[0026] Figure 11 is a flowchart of a method for processing program code according to an exemplary embodiment of the present application;

[0027] Figure 12 is a structural block diagram of a program code processing device shown in an exemplary embodiment of the present application;

[0028] Figure 13 It is a structural block diagram of a computer device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0030] In this document, "plurality" refers to two or more. "And / or" describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates an "or" relationship between the associated objects.

[0031] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the program codes (first program code and second program code) involved in this application were obtained with full authorization.

[0032] Please refer to Figure 1 , which shows a flowchart of a method for processing program code provided by an exemplary embodiment of the present application. The method may include the following steps:

[0033] Step 101: A computer device receives a modification instruction, where the modification instruction is used to request modification of a program code of a first target component in a first program code of an application.

[0034] The first program code includes program codes for multiple components, where different components are used to implement different functions of the application. The first program code can be program codes for components of multiple functions of the application, or can be program codes for multiple components of updated functions of the application. Furthermore, the first program code can be compiled code. The computer device can be a computer device used by the developer of the application; and the computer device can be a personal computer (PC) or a laptop computer, etc.

[0035] Step 102: The computer device determines a first dependency graph of the first program code, where the first dependency graph includes a first dependency relationship, a second dependency relationship, and a third dependency relationship between the program codes of multiple components. The first dependency relationship is used to represent the dependency relationship between the program code of the component corresponding to the parent node and the program code of the component corresponding to the child node. The second dependency relationship is used to represent the dependency relationship between the program code of the component corresponding to the child node and the program code of the component corresponding to the parent node. The third dependency relationship is used to represent the mutual dependency relationship between the program codes of at least two components.

[0036] The first dependency is from parent to child, so it can also be called a forward dependency. The second dependency is from child to parent, so it can also be called a backward reference. The third dependency is a mutual dependency; therefore, it can also be called a circular dependency.

[0037] Step 103: The computer device modifies the program code of the first target component based on the first dependency graph and the modification instruction.

[0038] The computer device evaluates the modification instruction based on the first dependency graph to determine whether modification of the program code of the first target component is allowed; if modification of the program code of the first target component is allowed, the computer device modifies the program code of the first target component based on the modification instruction; if modification of the program code of the first target component is not allowed, the computer device refuses to respond to the modification instruction.

[0039] In an embodiment of the present application, the first dependency graph includes a first dependency relationship, a second dependency relationship, and a third dependency relationship; the first dependency relationship is used to characterize the forward dependency relationship of the program codes of multiple components, the second dependency relationship is used to characterize the reverse reference relationship of the program codes of multiple components, and the third dependency relationship is used to characterize the circular dependency relationship of the program codes of multiple components; therefore, the first dependency graph can characterize the relationship between the program codes of multiple components from three dimensions, so that the first dependency graph can provide application developers with a more comprehensive dependency relationship, thereby helping developers to quickly evaluate the impact scope of modifications to the component program code, which also improves the modification efficiency of the component program code based on the first dependency graph.

[0040] Please refer to Figure 2 , which shows a flowchart of a method for processing program code provided by an exemplary embodiment of the present application. The method may include the following steps:

[0041] Step 201: A computer device receives a modification instruction, where the modification instruction is used to request modification of a program code of a first target component in a first program code.

[0042] In a possible implementation, when a developer wants to modify the program code of the first target component, he triggers a modification instruction to the computer device, and the modification instruction carries the modified program code of the first target component. For example, please refer to Figure 3 For version A of the application, the computer device changes the program code of component Z.

[0043] In another possible implementation, the developer can also add the program code of a new component, and in this case trigger a new instruction to the computer device; the computer device receives the new instruction, and the new instruction carries the program code of the fourth target component; the program code of the fourth target component is added to the first program code of the application to obtain the fourth program code. For example, please continue to refer to Figure 3 For version A of the application, the computer device adds the program code of component X.

[0044] In another possible implementation, the developer can also remove the program code of the component, in which case a removal instruction is triggered to the computer device; the computer receives the removal instruction, which carries the component identifier of the fifth target component to be removed; based on the component identifier of the fifth target component, the program code of the fifth target component is removed from the first program code of the application to obtain the fifth program code. Please continue to refer to Figure 3 , for version A of the application, the computer device removes the program code of component Y.

[0045] Step 202: The computer device determines a first dependency graph of the first program code, where the first dependency graph includes a first dependency relationship, a second dependency relationship, and a third dependency relationship between the program codes of multiple components. The first dependency relationship is used to represent the dependency relationship between the program code of the component corresponding to the parent node and the program code of the component corresponding to the child node. The second dependency relationship is used to represent the dependency relationship between the program code of the component corresponding to the child node and the program code of the component corresponding to the parent node. The third dependency relationship is used to represent the mutual dependency relationship between the program codes of at least two components.

[0046] In one possible implementation, the computer device may generate and store a first dependency graph for the application before receiving the modification instruction; in this step, the computer device directly retrieves the stored first dependency graph. In another possible implementation, after receiving the modification instruction, the computer device stores the first dependency graph for the first program code.

[0047] A file dependency analysis plug-in is installed in the computer device, and the file dependency analysis plug-in may be EnhancedFileLinkAnalysisPlugin. Accordingly, the step of generating a first dependency graph for the first program code by the computer device may be: the computer device performs dependency analysis on the first program code using the file dependency analysis plug-in to obtain first dependencies, second dependencies, and third dependencies between the program codes of multiple components, and generates a first dependency graph for the application based on the first dependencies, second dependencies, and third dependencies. For example, the computer device constructs a three-dimensional first dependency graph based on the first dependencies, second dependencies, and third dependencies through three-dimensional modeling.

[0048] The first dependency is from parent to child, so it can also be called a forward dependency. The second dependency is from child to parent, so it can also be called a backward reference. The third dependency is a mutual dependency; therefore, it can also be called a circular dependency.

[0049] Step 203: The computer device determines the code size and dependency count of the program code of the first target component before modification based on the first dependency graph.

[0050] In one possible implementation, the computer device determines the number of dependencies of the program code of the first target component before modification based on the first dependency relationship (or the second dependency relationship); accordingly, the step of the computer device determining the number of dependencies of the program code of the first target component before modification based on the first dependency graph may be: the computer device determines the first number of program codes of other components that the program code of the first target component before modification depends on based on the first dependency relationship (or the second dependency relationship) in the first dependency graph, and determines the first number as the number of dependencies of the program code of the first target component before modification.

[0051] The amount of program code of the first target component before modification is marked in the first dependency graph; in this step, the computer device directly obtains the amount of program code of the first target component before modification from the first dependency graph. Alternatively, the computer device directly obtains the program code of the first target component before modification, then determines the space occupied by the program code of the first target component before modification, and determines the occupied space as the amount of program code of the first target component before modification.

[0052] In another possible implementation, the computer device determines the number of dependencies of the program code of the first target component before modification based on the first dependency relationship (or the second dependency relationship) and the third dependency relationship; accordingly, the step of the computer device determining the number of dependencies of the program code of the first target component before modification based on the first dependency graph may be: the computer device determines the first number of dependencies of the program code of other components on which the program code of the first target component before modification depends based on the first dependency relationship (or the second dependency relationship) in the first dependency graph, and determines whether there is a third dependency relationship between the program code of the first target component and the program code of the other components based on the third dependency relationship; in the case that there is a third dependency relationship between the program code of the first target component and the program code of the other components, the first number is weighted based on a preset weight to obtain a second number, and the second number is determined as the number of dependencies of the program code of the first target component before modification; in the case that there is no third dependency relationship between the program code of the first target component and the program code of the other components, the first number is determined as the number of dependencies of the program code of the first target component before modification.

[0053] Step 204: The computer device determines the code size and dependency count of the modified program code of the first target component.

[0054] The computer device counts the space occupied by the modified program code of the first target component, and determines the occupied space as the code size of the modified program code of the first target component.

[0055] The computer device can modify the program code of the first target component in the first program code based on the modification instruction to obtain a sixth program code, determine a third dependency graph of the sixth program code, and determine the number of dependencies of the modified program code of the first target component based on the third dependency graph.

[0056] The process by which the computer device determines the third dependency graph of the sixth program code is similar to the process by which the computer device determines the first dependency graph of the first program code. The process by which the computer device determines the number of dependencies of the program code after the first target component is modified based on the third dependency graph is similar to the process by which the computer device determines the number of dependencies of the program code before the first target component is modified based on the first dependency graph, and will not be repeated here.

[0057] Step 205: The computer device modifies the program code of the first target component based on the code size and dependency count of the program code of the first target component before modification, the code size and dependency count of the program code of the first target component after modification, and the modification instruction.

[0058] In a case where the amount of code of the modified program code of the first target component is less than the amount of code of the program code of the first target component before the modification, and the number of dependencies of the modified program code of the first target component is greater than the number of dependencies of the program code of the first target component before the modification, the computer device modifies the program code of the first target component in the first program code based on the modification instruction.

[0059] In a case where the amount of code of the modified program code of the first target component is not less than the amount of code of the program code of the first target component before the modification, or the number of dependencies of the modified program code of the first target component is not greater than the number of dependencies of the program code of the first target component before the modification, the computer device refuses to respond to the modification instruction, that is, the computer device does not modify the program code of the first target component.

[0060] For example, please refer to Figure 3 If the number of dependencies of the program code after the first target component is modified is greater than the number of dependencies of the program code before the first target component is modified + 2, and the code size of the program code after the first target component is modified is less than the code size of the program code before the first target component is modified - 15KB, then the program code of the first target component is modified.

[0061] Before modifying the program code of the first target component, the computer device can also detect the usage scenarios to which the modified program code of the first target component is adapted; only when the usage scenarios to which the modified program code of the first target component is adapted cover multiple preset scenarios, the program code of the first target component in the first program code is modified based on the modification instruction.

[0062] In an embodiment of the present application, before modifying the program code of the first target component, the computer device can also automatically detect whether the modified program code of the first target component is adapted to the scenario requirements. Only when it is adapted to the scenario requirements will the program code of the first target component be modified, thereby reducing major regression problems by 80% and improving the security of the change.

[0063] Step 206: The computer device determines the components on which the first target component depends.

[0064] The computer device determines a component on which the first target component depends based on a second dependency relationship among the program codes of the plurality of components in the first program code.

[0065] Step 207: The computer device displays prompt information, which is used to prompt to modify the component on which the first target component depends.

[0066] For example, see Figure 4 The computer device performs a change impact analysis on the program code of the first target component. This change impact analysis includes an analysis of associated business components, thereby prompting modifications to components on which the first target component depends. Furthermore, the computer device may determine test cases for components on which the first target component depends, thereby determining the affected test cases.

[0067] In this embodiment of the present application, when modifying the program code of a component, the computer device automatically identifies whether the modification is allowed, thereby further improving the stability and security of the project. Furthermore, the computer device also prompts the user to modify the components on which the first target component depends, thereby automatically identifying components that require synchronous adjustment, thereby improving the architectural stability of the application.

[0068] Please refer to Figure 5 , which shows a flowchart of a method for processing program code provided by an exemplary embodiment of the present application. In the embodiment of the present application, taking the generation of a first dependency graph as an example, the method may include the following steps:

[0069] Step 501: A computer device determines a first program code of an application to be analyzed. The first program code includes program codes of multiple components, and different components are used to implement different functions of the application.

[0070] The first program code may be the program code for components of multiple functions of the application, or may be the program code for multiple components of updated functions of the application. If the first program code is the program code for multiple components of the updated functions of the application, the step of the computer device determining the first program code of the application to be analyzed may include: the computer device determining second program code of the application to be analyzed, the second program code including the program code for components of multiple functions of the application; and determining the program code for the multiple components of the updated functions from the second program code of the application to obtain the first program code.

[0071] In the case where the program code of one or more functional components of the second program code of the application is updated, the computer device determines the hash value of the program code of the component of any function before the update and the hash value after the update. If the hash value before the update and the hash value after the update are different, the function is determined to be an updated function; if the hash value before the update and the hash value after the update are the same, the function is determined to be a non-updated function.

[0072] In an embodiment of the present application, a computer device determines the program codes of multiple components of the updated functions by comparing hash values, thereby performing dependency analysis on the program codes of multiple components of the updated functions to achieve local update analysis, thereby greatly improving the analysis efficiency of the program code of the application program.

[0073] Step 502: The computer device determines an entry file in the first program code. The entry file is the first file executed when the first program code is run.

[0074] The first program code includes program codes of multiple components, and the multiple components are used to implement the functions of at least one page; accordingly, the number of entry files is at least one, and one entry file corresponds to one page. For example, please refer to Figure 6 , the computer device determines the entry file in the first program code and then executes step 203.

[0075] In a possible implementation, after the computer device determines the entry and exit files, it stores the file path of the entry file in an entry file registry and outputs the entry file registry.

[0076] Before this step, please refer to Figure 7 , the computer device performs initialization preparation and then initializes the data structure, which includes an entry file registry; in this step, the computer device stores the file path of the entry file in the entry file registry.

[0077] Step 503: The computer device traverses the first program code starting from the entry file.

[0078] The number of entry files can be one or more. When there are multiple entry files, the computer device starts to traverse the first program code from multiple entry files and traverses the program codes of multiple first components. The multiple first components traversed are components of the same level. For example, please refer to Figure 8 The computer device traverses the first program code starting from the two entry files, and traverses to component 1 and component 2. Component 1 and component 2 are components of the same level, and both component 1 and component 2 are components corresponding to the parent node (which can be simply referred to as the parent component).

[0079] Step 504: The computer device determines a first dependency relationship, a second dependency relationship, and a third dependency relationship among the program codes of the multiple components based on the traversed program code of the first component and the program codes of other components in the multiple components.

[0080] A file dependency analysis plug-in is installed in the computer device, and the file dependency analysis plug-in can be EnhancedFileLinkAnalysisPlugin; in this step, the computer device uses the file dependency analysis plug-in to perform dependency analysis on the first program code, and obtains the first dependency, second dependency, and third dependency between the program codes of multiple components. For example, the computer device captures the program code of the first component traversed through the EnhancedFileLinkAnalysisPlugin hook and performs dependency analysis on the program code of the first component. For example, please continue to refer to Figure 6 , the computer device performs component dependency analysis on program codes of multiple components.

[0081] The first dependency is from parent to child, so it can also be called a forward dependency. The second dependency is from child to parent, so it can also be called a backward reference. The third dependency is a mutual dependency; therefore, it can also be called a circular dependency.

[0082] This step can be achieved by following the steps 5041-5042, including:

[0083] Step 5041: When the program code of the traversed first component depends on the program code of the second component, the computer device determines that the dependency relationship between the program code of the first component and the program code of the second component is a first dependency relationship, and determines that the dependency relationship between the program code of the second component and the program code of the first component is a second dependency relationship.

[0084] The computer device uses a bidirectional map storage structure to store the first dependency relationship and the second dependency relationship. A map is a data storage structure that stores key-value pairs. The key-value pair includes two components that have the first dependency relationship and the second dependency relationship, namely, the component identifier of the first component and the component identifier of the second component. Because the bidirectional map storage structure is used to store the component identifier of the first component and the component identifier of the second component, the query efficiency of the component is O(1). O(1) is a constant time complexity, indicating that the execution time of the algorithm does not change with the amount of input data.

[0085] For example, see Figure 8 , the first program code includes component 1, component 2, component 3, and component 4. The computer device starts traversing and analyzing from the program code of component 1 and the program code of component 2. The program code of component 2 depends on the program code of component 3. Therefore, the dependency relationship between the program code of component 2 and the program code of component 3 is a first dependency relationship, that is, the program code of component 2 is positively dependent on the program code of component 3. The dependency relationship between the program code of component 3 and the program code of component 2 is a second dependency relationship, that is, the program code of component 3 is reversely dependent on the program code of component 2. Moreover, the node corresponding to the program code of component 2 is the parent node, and the node corresponding to the program code of component 3 is the child node. Moreover, the computer device continues to traverse downwards and now traverses to component 3. The program code of component 3 depends on the program code of component 4. Therefore, the dependency relationship between the program code of component 3 and the program code of component 3 is a first dependency relationship, that is, the program code of component 3 is positively dependent on the program code of component 4.

[0086] In an embodiment of the present application, the computer device not only records the dependency of the first component on the second component, but also records the dependency of the second component on the first component, thereby realizing the recording of the bidirectional dependency between the parent and child components.

[0087] Step 5042: When the program code of the traversed first component depends on the program code of the second component and the program code of the second component depends on the program code of the first component, the computer device determines that the program code of the first component and the program code of the second component are in a third dependency relationship.

[0088] The computer device starts a depth-first search (DFS) algorithm from an entry file, traverses the program code of the application, and determines a recursive link, where the recursive link is used to store component identifiers of at least two components of a first dependency relationship; based on the component identifier of the first component in the recursive link, determines from the first program code the program code of a second component that has a third dependency relationship with the program code of the first component.

[0089] Since the recursive link is used to store the component identifiers of at least two components of the first dependency relationship; therefore, when the component identifier of the component corresponding to the child node of the node corresponding to the first component is not in the recursive link, the computer device continues to go deeper and determine the program code of the second component that has a third dependency relationship with the program code of the first component from the first program code.

[0090] For example, please refer to Figure 8 , the computer device determines that the program code of component 1 depends on the program code of component 3, and the program code of component 3 depends on the program code of component 1; that is, the dependency relationship between the program code of component 1 and the program code of component 3 is a circular dependency.

[0091] When the computer device traverses the program code of the first component, it can directly determine the first dependency, the second dependency and the third dependency based on step 504; it can also filter and check the program code of the first component to determine whether the program code of the first component meets the dependency analysis conditions; if the program code of the first component meets the dependency analysis conditions, execute step 504; if the program code of the first component does not meet the dependency analysis conditions, the computer device traverses the program code of the next component.

[0092] In one possible implementation, a computer device may filter non-business components to analyze the program code of business components; accordingly, the step for the computer device to determine whether the program code of a first component meets the dependency analysis conditions may be: the computer device determines the component type of the first component; when the component type of the first component is a preset business type, determining that the program code of the first component meets the dependency analysis conditions; when the component type of the first component is not a preset business type, determining that the program code of the first component does not meet the dependency analysis conditions.

[0093] For example, the computer device stores a type list, which is used to store non-preset business types; the computer device determines whether the component type of the first component is in the type list; when the component type of the first component is in the type list, it is determined that the program code of the first component does not meet the dependency analysis conditions; when the component type of the first component is not in the type list, it is determined that the program code of the first component meets the dependency analysis conditions.

[0094] The preset service type can be set and changed as needed. In the embodiment of this application, the preset service type is not specifically limited. For example, please continue to refer to Figure 7 , the computer device performs initialization preparation, the initialization preparation includes reading configuration parameters, and the configuration parameters include preset business types.

[0095] The analysis plug-in provided in the embodiments of the present application can open an application programming interface (API) interface to facilitate the development team to seamlessly integrate the analysis plug-in with the development process, thereby realizing automated dependency management and monitoring. In addition, developers can customize the preset business type through the API, thereby flexibly adjusting the preset business type; accordingly, the steps for the computer device to determine the preset business type can be:

[0096] The computer device receives first configuration information through an open API, where the first configuration information carries at least one service type, and determines the at least one service type as a preset service type.

[0097] In another possible implementation, the computer device may filter out components whose extensions do not meet the requirements, thereby analyzing the program codes of components whose extensions meet the requirements; accordingly, the step for the computer device to determine whether the program code of the first component meets the dependency analysis conditions may be: the computer device determines the file extension of the file where the program code of the first component is located; if the file extension is a preset extension, it is determined that the program code of the first component meets the dependency analysis conditions; if the file extension is not a preset extension, it is determined that the program code of the first component does not meet the dependency analysis conditions.

[0098] The preset extension can be set and changed as needed. In the embodiment of the present application, the preset extension is not specifically limited; for example, the preset extension can be .gs, etc. For example, please continue to refer to Figure 7 , the computer device performs initialization preparation, the initialization preparation includes reading configuration parameters, and the configuration parameters include file extensions.

[0099] In addition, developers can customize the preset extensions through the API, thereby flexibly adjusting the preset extensions; accordingly, the step for the computer device to determine the preset extensions can be: the computer device receives second configuration information through an open API, the second configuration information includes at least one extension, and determines at least one extension as the preset extension.

[0100] Step 505: The computer device generates a first dependency graph of the first program code based on the first dependency, the second dependency, and the third dependency. The first dependency graph is used to reflect the first dependency, the second dependency, and the third dependency.

[0101] The computer device constructs a three-dimensional first dependency graph through three-dimensional modeling based on the first dependency, the second dependency and the third dependency.

[0102] In one possible implementation, a computer device records three dependency relationships through three record tables; accordingly, this step may be: the computer device stores the component identifiers of at least two components whose dependency of the program code is a first dependency relationship in the first dependency record table; stores the component identifiers of at least two components whose dependency of the program code is a second dependency relationship in the second dependency record table; stores the component identifiers of at least two components whose dependency of the program code is a third dependency relationship in the third dependency record table; and generates a first dependency graph based on the first dependency record table, the second dependency record table, and the third dependency record table.

[0103] The first dependency record table can be a forward dependency mapping table, the second dependency record table can be a reverse reference index table, and the third dependency record table can be a circular dependency list. For example, please continue to refer to Figure 7 Before this step, the computer device needs to initialize the first dependency record table, the second dependency record table and the third dependency record table.

[0104] The computer device determines an output path of the first dependency graph, and outputs the first dependency graph based on the output path. For example, please continue to refer to Figure 7 , the computer device performs initialization preparation, the initialization preparation includes reading configuration parameters, and the configuration parameters include the output path of the first dependency graph.

[0105] The first dependency graph can be output in the form of a json file; for example, the first dependency graph can be dependencies.json. In addition, the computer device can also output a reverse reference index table, and the reverse reference index table can also be output in the form of a json file; for example, the reverse reference index table can be reverse-dependencies.json. The forward dependency mapping table can be represented in a tree structure, and the forward dependency mapping table can also be output in the form of a json file; for example, the forward dependency mapping table can be dependencies-tree.json. The circular dependency list can also be output in the form of a json file; for example, the circular dependency list can be circular-dependencies.json.

[0106] It's important to note that the first dependency graph, forward dependency mapping table, reverse reference index table, and circular dependency list are all output in a visual format, allowing developers to quickly assess the impact of component code modifications and reduce the likelihood of blind changes. Furthermore, the visual first dependency graph can reduce the learning curve for new developers by over 50%, facilitating rapid onboarding. Furthermore, it eliminates the psychological barrier of "fear of change," enabling continuous refactoring and optimization of application code. This in turn helps manage technical debt. Furthermore, component owners can clearly understand the applicable parties, improving change communication efficiency and facilitating smoother cross-team collaboration. Furthermore, improvements to these component code ultimately create a virtuous cycle: more reliable components → more developers willing to use them → higher code adoption → lower maintenance costs → teams can invest more resources in optimizing components. This positive feedback mechanism is a key foundation for building a sustainable front-end architecture.

[0107] In one possible implementation, the first dependency graph also supports interaction. For example, the first dependency graph includes a keyword search button, a filter button, an expand all button, a zoom in button, and a zoom out button. Developers can interact with the first dependency graph based on these buttons. For example, the keyword search button is used to query the dependencies of a component; the filter button is used to filter the dependencies of a component; the expand all button is used to expand the first dependency graph; the zoom in button is used to zoom in on the first dependency graph; and the zoom out button is used to zoom out on the first dependency graph.

[0108] Step 506 : The computer device determines, based on the first dependency graph, a first preset number of second target components, a second preset number of third target components, and cycle ratios of program codes of the plurality of components.

[0109] In a possible implementation, the step of determining a first preset number of second target components and a second preset number of third target components by the computer device based on the first dependency graph may be:

[0110] The computer device determines the number of dependencies and the number of dependencies of the program codes of multiple components based on the first dependency relationship and the second dependency relationship; based on the number of dependencies and the number of dependencies of the program codes of multiple components, the computer device determines the program codes of a first preset number of second target components and the program codes of a second preset number of second target components, the third target component is the component with the largest number of dependencies of the first preset number, and the second target component is the component with the largest number of dependencies of the second preset number.

[0111] Both the first preset number and the second preset number can be set and changed as needed. In the embodiment of the present application, there is no specific limitation on the first preset number and the second preset number; for example, the first preset number and the second preset number are the same, both 10, that is, the computer device counts the 10 components with the most dependencies and the 10 components with the least dependencies.

[0112] In another possible implementation, the step of determining, by the computer device, loop percentages of program codes of multiple components based on the first dependency graph may include: the computer device determining a first number of components whose program codes are in a third dependency relationship; determining a second number of the multiple components; and determining, based on the first number and the second number, loop percentages of the program codes of the multiple components. For example, the computer device determines a ratio of the first number and the second number to obtain loop percentages of the program codes of the multiple components.

[0113] The computer device outputs the loop ratios of the program codes of the multiple components, so that the developer can trigger modification instructions to the computer device based on the loop ratios of the program codes of the multiple components. For example, if the loop ratios of the program codes of the multiple components are less than a first preset ratio, the developer triggers the modification instructions to the computer device. Furthermore, the computer device can also determine whether to respond to the modification instructions based on the loop ratios of the program codes of the multiple components; for example, if the loop ratios of the program codes of the multiple components are less than a second preset ratio, the computer device responds to the modification instructions, i.e., modifies the program code of the first target component based on the modification instructions.

[0114] Step 507: The computer device determines statistical summary information of the first program code based on the first dependency graph.

[0115] The statistical summary information briefly describes the dependencies of the first program code, including whether there are circular dependencies in the first program code. Furthermore, the statistical summary information may include the output path and file name of the first dependency graph. The computer device stores the statistical summary information in an analysis result summary container. The statistical summary information may also assist developers in determining whether to modify the program code of the first target component.

[0116] Please continue to refer to Figure 7 The computer device performs initialization preparations and then initializes a data structure, including an analysis result summary container. In this step, the computer device stores the statistical summary information in the analysis result summary container. The statistical summary information can be output as a JSON file; for example, the statistical summary information can be stats-summary.json.

[0117] In an embodiment of the present application, the first dependency graph includes a first dependency relationship, a second dependency relationship, and a third dependency relationship; the first dependency relationship is used to characterize the forward dependency relationship of the program codes of multiple components, the second dependency relationship is used to characterize the reverse reference relationship of the program codes of multiple components, and the third dependency relationship is used to characterize the circular dependency relationship of the program codes of multiple components; therefore, the first dependency graph can characterize the relationship between the program codes of multiple components from three dimensions, so that the first dependency graph can provide application developers with a more comprehensive dependency relationship, thereby helping developers to quickly evaluate the impact scope of modifications to the component program code, which also improves the modification efficiency of the component program code based on the first dependency graph.

[0118] Please refer to Figure 9 , which shows a flowchart of a method for processing program code provided by an exemplary embodiment of the present application. The method may include the following steps:

[0119] Step 901: A computer device determines a first program code of an application to be analyzed. The first program code includes program codes of multiple components, and different components are used to implement different functions of the application.

[0120] In some embodiments, this step is the same as step 501 and will not be repeated here.

[0121] Step 902: The computer device performs a dependency analysis on the first program code to obtain a first dependency, a second dependency, and a third dependency between the program codes of multiple components. The first dependency is used to represent the dependency between the program code of the component corresponding to the parent node and the program code of the component corresponding to the child node. The second dependency is used to represent the dependency between the program code of the component corresponding to the child node and the program code of the component corresponding to the parent node. The third dependency is used to represent the mutual dependency between the program codes of at least two components.

[0122] In some embodiments, this step can be implemented through the above steps 502-504, which will not be repeated here.

[0123] Step 903: The computer device generates a first dependency graph of the first program code based on the first dependency, the second dependency, and the third dependency. The first dependency graph is used to reflect the first dependency, the second dependency, and the third dependency.

[0124] In some embodiments, this step is the same as step 505 and will not be repeated here.

[0125] Step 904: In the process of dependency analysis on the first program code, the computer device determines the target depth of the program code of the plurality of components, which represents the nesting number of the program code of the component in the first program code.

[0126] For example, referring to Figure 10 , the computer device adopts the intelligent depth calculation method to calculate the target depth of the program code of the plurality of components in real time. This step can be implemented through the following steps 9041-9042, including:

[0127] Step 9041: The computer device determines the current depth of the program code of the component corresponding to the parent node in the first dependency relationship.

[0128] The computer device determines the first dependency path corresponding to the first dependency relationship, which represents the dependency relationship between the program codes of the plurality of components; and determines the current depth of the program code of the component corresponding to the parent node in the first dependency path.

[0129] It should be noted that the current depth of the program code of the component corresponding to the entry file is 0; for example, the first dependency path is component 2-component 3-component 4; since component 2 is the component corresponding to the entry node, the current depth of the program code of component 2 is 0, and the current depth of the program code of component 3 is 1.

[0130] Step 9042: The computer device determines the target depth of the program code of the plurality of components in the first dependency relationship based on the current depth of the program code of the component corresponding to the parent node.

[0131] For example, referring to Figure 10 , the computer device determines the target depth of the program code of the plurality of components through the intelligent depth calculation method; for example, the intelligent depth calculation method can be a hierarchical propagation algorithm, that is, the computer device determines the target depth of the program code of the plurality of components through the hierarchical algorithm method.

[0132] Correspondingly, this step can be implemented through the following steps 90421-90422, including:

[0133] Step 90421: The computer device determines the historical depth of the program code of the component corresponding to the parent node in the historical first dependency relationship; and determines the maximum depth between the historical depth and the current depth as the target depth of the program code of the component corresponding to the parent node.

[0134] For example, referring to Figure 10, the depth of the program code of the component corresponding to the parent node = max (the historical depth, the current depth). In a case where the program code of the component corresponding to the parent node exists both the current first dependency relationship and the historical first dependency relationship, that is, the program code of the component corresponding to the parent node is the program code of the shared component, thereby realizing that the target depth of the program code of the shared component takes the maximum depth.

[0135] In step 90422, the computer device determines the target depth of the program code of the component corresponding to the child node of the parent node based on the current depth of the program code of the component corresponding to the parent node and the dependency relationship of the program code of the component corresponding to the child node.

[0136] In a possible implementation, in a case where there is a third dependency relationship between the program code of the component corresponding to the child node and the program code of other components in the plurality of components, the computer device determines a first depth of the program code of the component corresponding to the child node based on the current depth of the program code of the component corresponding to the parent node and a depth attenuation factor, and determines the target depth of the program code of the component corresponding to the child node as the maximum depth of a second depth and the first depth, the second depth being a depth of the program code of the component corresponding to the child node determined based on the third dependency relationship.

[0137] The depth attenuation factor can be set and changed as needed, and in the embodiment of the present application, the depth attenuation factor is not specifically limited; for example, the depth attenuation factor can be 0.7; for details, please continue to refer to Figure 10 In a case where the program code of the component corresponding to the child node is a circular reference, the depth of the program code of the component corresponding to the child node = max (the second depth of the child node, the current depth * the depth attenuation factor).

[0138] In the embodiment of the present application, the computer device can dynamically prune and optimize the target depth of the program code of the component corresponding to the child node based on the depth attenuation factor.

[0139] In another possible implementation, in a case where there is no third dependency relationship between the program code of the component corresponding to the child node and the program code of other components in the plurality of components, the computer device adds one to the current depth of the program code of the component corresponding to the child node of the parent node to obtain the target depth of the program code of the component corresponding to the child node.

[0140] For example, please continue to refer to Figure 10 In a case where the program code of the component corresponding to the child node is a non-circular reference, the depth of the program code of the component corresponding to the child node = the current depth + 1.

[0141] One thing that needs to be explained is that the computer device traverses downward based on the first dependency relationship and determines the target depth of the program code of the component corresponding to the child node of the child node until it traverses to the program code of the component corresponding to the leaf node, that is, the computer device automatically terminates the recursion when it traverses to the program code of the component corresponding to the leaf node.

[0142] Another point that needs to be explained is that the computer device can also determine the criticality of multiple components; for example, for any component, the computer device determines the criticality of the component based on the number of times the component is relied upon. The number of times it is relied upon is positively correlated with the criticality, that is, the greater the number of times the component is relied upon, the greater the criticality of the component; the smaller the number of times the component is relied upon, the smaller the criticality of the component.

[0143] Step 905: The computer device determines depth distribution information of the program codes of the multiple components based on the target depths of the program codes of the multiple components.

[0144] The depth distribution information of the program codes of multiple components refers to the distribution of the number of layers controlled by the program codes of the multiple components in the first program code. For example, if the program code of component 2 depends on the program code of component 3, and the program code of component 3 depends on the program code of component 4, then the depth distribution information of the program codes of component 2, component 3, and component 4 is 1, 2, and 3 respectively.

[0145] For example, please refer to Figure 6 The computer device determines the depth distribution information of the program codes of multiple components through an intelligent depth calculation method, and then outputs a first dependency graph and the depth distribution information, thereby achieving multi-dimensional output. The depth distribution information of the program codes of multiple components is used to assist the computer device in determining whether to respond to a modification instruction; for example, if the depth distribution information of the program codes of multiple components meets the depth distribution condition, the computer device responds to the modification instruction of the first target component; if the depth distribution information of the program codes of multiple components does not meet the depth distribution condition, the computer device refuses to respond to the modification instruction.

[0146] Step 906 : The computer device determines feature data of the multiple components based on the first dependency graph and the target depths of the program codes of the multiple components.

[0147] The characteristic data of any component includes the program code of the component, the subset that the component depends on, the subset is used to store the program code of the components that the program code of the component depends on, the target depth of the component, etc. Figure 4 , the computer device performs initialization preparation, and then initializes the data structure, which includes the component feature database; in this step, the computer device stores the feature data of multiple components into the component feature database, please continue to refer to Figure 7and Figure 10 .

[0148] In the embodiment of the present application, the computer device can not only characterize the relationship between the program codes of multiple components from three dimensions, so that the first dependency graph can provide a more comprehensive dependency relationship for the application developer, thereby helping the developer to quickly evaluate the scope of the modification impact of the component program code from the perspective of dependency; it can also determine the depth distribution information of the program codes of multiple components, thereby helping the developer to quickly evaluate the scope of the modification impact of the component program code from the perspective of depth. It can be seen that the embodiment of the present application can improve the evaluation efficiency of modifying the program code of the component from the two aspects of dependency and depth.

[0149] Please refer to Figure 11 , which shows a flowchart of a method for processing program code provided by an exemplary embodiment of the present application. The method may include the following steps:

[0150] Step 1101: The computer device determines a first program code of an application to be analyzed. The first program code includes program codes of multiple components, and different components are used to implement different functions of the application.

[0151] In some embodiments, this step is the same as step 501 and will not be repeated here.

[0152] Step 1102: The computer device performs a dependency analysis on the first program code to obtain a first dependency, a second dependency, and a third dependency between the program codes of multiple components. The first dependency is used to represent the dependency between the program code of the component corresponding to the parent node and the program code of the component corresponding to the child node. The second dependency is used to represent the dependency between the program code of the component corresponding to the child node and the program code of the component corresponding to the parent node. The third dependency is used to represent the mutual dependency between the program codes of at least two components.

[0153] In some embodiments, this step can be implemented through the above steps 502-504, which will not be repeated here.

[0154] Step 1103: The computer device generates a first dependency graph of the first program code based on the first dependency, the second dependency, and the third dependency. The first dependency graph is used to reflect the first dependency, the second dependency, and the third dependency.

[0155] In some embodiments, this step is the same as step 505 and will not be repeated here.

[0156] Step 1104: The computer device determines a second dependency graph of a third program code of the application, where the third program code and the first program code are program codes corresponding to different versions of the application, respectively. The second dependency graph is used to reflect the first dependency relationship, the second dependency relationship, and the third dependency relationship of the third program code.

[0157] In one possible implementation, a computer device determines a third program code of an application, performs dependency analysis on the third program code, obtains a first dependency, a second dependency, and a third dependency between the program codes of multiple components, and generates a second dependency graph for the third program based on the first dependency, the second dependency, and the third dependency.

[0158] In another possible implementation, after historically determining the second dependency graph of the third program code, the computer device automatically stores the second dependency graph; in this step, the computer device obtains the stored second dependency graph.

[0159] In an embodiment of the present application, the computer device can build a complete set of data sedimentation and storage reminders, thereby realizing the automatic preservation of the generated data.

[0160] One thing that needs to be explained is that the third program code can be the program code obtained by modifying the program code of the first target component in the first program code based on the modification instruction by the computer device; that is, by comparing and analyzing the first dependency graph of the first program code and the second dependency graph of the third program code, the program code of the first target component can be modified and the impact on the dependency graph can be analyzed.

[0161] Step 1105: The computer device performs a comparative analysis on the first dependency graph and the second dependency graph to obtain a dependency comparative analysis result.

[0162] The dependency comparison analysis results include a first dependency comparison analysis result and a second dependency comparison analysis result. The first dependency comparison analysis result is used to indicate that the first dependency graph and the second dependency graph have the same dependency relationship, and the second dependency comparison analysis result is used to indicate that the first dependency graph and the second dependency graph have different dependency relationships.

[0163] In an embodiment of the present application, a computer device can automatically determine the test cases that require regression based on the dependency comparison analysis results, shortening the test time by 40% to 60%. In addition, the coverage of the modified regression test can reach more than 95%, major online accidents are reduced, and confidence in the application launch is enhanced. In addition, the version control of the application makes the program code upgrade of the component more controllable and the impact of destructive changes is reduced, that is, version management is more standardized. In addition, the optimization of the program code of the component is no longer a bottleneck, and the interaction cycle of the application is shortened by 30% to 50%, that is, the iteration speed is accelerated. In addition, by storing the second dependency graph, the record of the dependency graph no longer relies on personal memory, and the component usage constraints and best practices are fully precipitated, thereby improving the reliability of knowledge inheritance. In addition, the unified component behavior ensures the consistency of interactions in different business scenarios, so that the user experience is consistent.

[0164] Step 1106 : The computer device determines a target depth of the program code of the plurality of components included in the third program code of the application.

[0165] In some embodiments, the process by which the computer device determines the target depth of the program codes of multiple components included in the third program code of the application is similar to the process by which the computer device determines the target depth of the program codes of multiple components included in the first program code of the application, and will not be repeated here.

[0166] Step 1107 : The computer device compares the target depths of the program codes of the multiple components included in the first program code with the target depths of the program codes of the multiple components included in the third program code to obtain a depth comparison analysis result.

[0167] The depth comparison analysis results include a first depth comparison analysis result and a second depth comparison analysis result. The first depth comparison analysis result is used to represent components with the same target depth in the first program code and the third program code, and the second depth comparison analysis result is used to represent components with the same target depth but different targets in the first program code and the third program code.

[0168] For example, please refer to Figure 4 The computer device determines a historical version of the application through a version selector, determines a third program code corresponding to the historical version, and then determines a second dependency graph corresponding to the third program code. Then, a dependency graph comparison is performed based on the first dependency graph and the second dependency graph, and a target depth comparison is performed based on the target depth of the program codes of the multiple components included in the first program code and the target depth of the program codes of the multiple components included in the third program code.

[0169] In an embodiment of the present application, a computer device can obtain a second dependency graph of a third program code of a determined historical version of an application program, and perform dependency comparison analysis on the second dependency graph and the first dependency graph of the first program code, thereby enabling visual comparison analysis supporting multi-version dependency relationships, helping developers quickly locate dependency changes between different versions and efficiently troubleshoot dependency conflicts and security vulnerabilities. Furthermore, an embodiment of the present application can provide developers with powerful tool support, helping them work more efficiently and conveniently in complex dependency environments.

[0170] Please refer to Figure 12 , which shows a structural block diagram of a program code processing device provided by an exemplary embodiment of the present application. The device includes:

[0171] A first receiving module 1201 is configured to receive a modification instruction, wherein the modification instruction is configured to request modification of a program code of a first target component in a first program code of an application, wherein the first program code includes program codes of multiple components, and different components are configured to implement different functions of the application;

[0172] A first determining module 1202 is configured to determine a first dependency graph of the first program code, the first dependency graph including a first dependency relationship, a second dependency relationship, and a third dependency relationship between the program codes of the multiple components, the first dependency relationship being used to represent a dependency relationship between the program code of the component corresponding to the parent node and the program code of the component corresponding to the child node, the second dependency relationship being used to represent a dependency relationship between the program code of the component corresponding to the child node and the program code of the component corresponding to the parent node, and the third dependency relationship being used to represent a mutual dependency relationship between the program codes of at least two components;

[0173] The modification module 1203 is configured to modify the program code of the first target component based on the first dependency graph and the modification instruction.

[0174] In one possible implementation, the modification module 1203 is used to determine the code amount and dependency number of the program code of the first target component before modification based on the first dependency graph; determine the code amount and dependency number of the program code of the first target component after modification; and modify the program code of the first target component based on the code amount and dependency number of the program code of the first target component before modification, the code amount and dependency number of the program code of the first target component after modification, and the modification instruction.

[0175] In another possible implementation, the modification module 1203 is used to modify the program code of the first target component based on the modification instruction when the amount of code of the program code of the first target component after modification is less than the amount of code of the program code of the first target component before modification, and the number of dependencies of the program code of the first target component after modification is greater than the number of dependencies of the program code of the first target component before modification.

[0176] In another possible implementation, the apparatus further includes:

[0177] A second determining module is configured to determine, based on the first dependency graph, a component on which the first target component depends;

[0178] The display module is used to display prompt information, where the prompt information is used to prompt the component on which the first target component depends to be modified.

[0179] In another possible implementation, the process of generating the first dependency graph includes:

[0180] a third determining module, configured to determine the first program code of the application to be analyzed;

[0181] an analysis module, configured to perform dependency analysis on the first program code to obtain a first dependency, a second dependency, and a third dependency between the program codes of the plurality of components;

[0182] A generation module is used to generate a first dependency graph of the first program code based on the first dependency relationship, the second dependency relationship and the third dependency relationship.

[0183] In another possible implementation, the analysis module is used to determine an entry file in the first program code, where the entry file is the first file executed when the first program code is run; traverse the first program code starting from the entry file; and determine a first dependency, a second dependency, and a third dependency between the program codes of the multiple components based on the program code of the traversed first component and the program codes of other components among the multiple components.

[0184] In another possible implementation, the analysis module is configured to, when the program code of the traversed first component depends on the program code of the second component, determine that the dependency relationship between the program code of the first component and the program code of the second component is the first dependency relationship, and determine that the dependency relationship between the program code of the second component and the program code of the first component is the second dependency relationship;

[0185] The analysis module is used to determine that the program code of the first component and the program code of the second component are in the third dependency relationship when the program code of the traversed first component depends on the program code of the second component and the program code of the second component depends on the program code of the first component.

[0186] In another possible implementation, the analysis module is configured to determine a component type of the first component; if the component type of the first component is a preset business type, determine a first dependency relationship, a second dependency relationship, and a third dependency relationship between the program codes of the multiple components based on the program code of the first component and the program codes of other components in the multiple components;

[0187] The analysis module is used to determine the file extension of the file where the program code of the first component is located; when the file extension is a preset extension, based on the program code of the first component and the program codes of other components among the multiple components, determine the first dependency, second dependency and third dependency between the program codes of the multiple components.

[0188] In another possible implementation, the apparatus further includes at least one of the following implementations:

[0189] A second receiving module is configured to receive first configuration information through an open application programming interface (API), where the first configuration information includes at least one service type, and determine the at least one service type as the preset service type;

[0190] The third receiving module is configured to receive second configuration information through an open API, where the second configuration information includes at least one extension name, and determine the at least one extension name as the preset extension name.

[0191] In another possible implementation, the apparatus further includes:

[0192] The storage module is used to store the file path of the entry file in the entry file registry.

[0193] In another possible implementation, the generation module is used to store the component identifiers of at least two components whose dependency of the program code is the first dependency in a first dependency record table; store the component identifiers of at least two components whose dependency of the program code is the second dependency in a second dependency record table; store the component identifiers of at least two components whose dependency of the program code is the third dependency in a third dependency record table; and generate the first dependency graph based on the first dependency record table, the second dependency record table and the third dependency record table.

[0194] In another possible implementation, the apparatus further includes:

[0195] a fourth determining module, configured to determine target depths of the program codes of the plurality of components, wherein the target depths of the program codes of the components represent the number of nesting levels of the program codes of the components in the first program code;

[0196] The fifth determining module is configured to determine depth distribution information of the program codes of the plurality of components based on target depths of the program codes of the plurality of components.

[0197] In another possible implementation, the fourth determination module is used to determine the current depth of the program code of the component corresponding to the parent node in the first dependency relationship; based on the current depth of the program code of the component corresponding to the parent node, determine the target depth of the program code of multiple components in the first dependency relationship.

[0198] In another possible implementation, the fourth determination module is used to determine the historical depth of the program code of the component corresponding to the parent node in the historical first dependency relationship; determine the maximum depth between the historical depth and the current depth as the target depth of the program code of the component corresponding to the parent node; and determine the target depth of the program code of the component corresponding to the child node of the parent node based on the current depth of the program code of the component corresponding to the parent node and the dependency relationship of the program code of the component corresponding to the child node.

[0199] In another possible implementation, the fourth determination module is configured to, when the third dependency relationship exists between the program code of the component corresponding to the child node and the program codes of other components among the multiple components, determine, based on the current depth of the program code of the component corresponding to the parent node and the depth attenuation factor, a first depth of the program code of the component corresponding to the child node; and determine, as a maximum depth between a second depth and the first depth of the program code of the component corresponding to the child node, a target depth of the program code of the component corresponding to the child node, the second depth being the depth determined by the program code of the component corresponding to the child node based on the third dependency relationship.

[0200] The fourth determination module is used to add one to the current depth of the program code of the component corresponding to the child node of the parent node, when there is no third dependency relationship between the program code of the component corresponding to the child node and the program code of other components among the multiple components, to obtain the target depth of the program code of the component corresponding to the child node.

[0201] In another possible implementation, the apparatus further includes:

[0202] A fifth determining module is configured to determine statistical summary information of the first program code based on the first dependency graph, where the statistical summary information is used to briefly describe the dependency relationship of the first program code.

[0203] In another possible implementation, the apparatus further includes:

[0204] a sixth determining module, configured to determine, based on the first dependency relationship and the second dependency relationship, the number of dependencies and the number of dependencies of the program codes of the plurality of components;

[0205] The seventh determination module is used to determine a first preset number of second target components and a second preset number of third target components based on the number of dependencies and the number of dependencies of the program codes of the multiple components, wherein the second target components are the first preset number of components with the largest number of dependencies, and the third target components are the second preset number of components with the largest number of dependencies.

[0206] In another possible implementation, the apparatus further includes:

[0207] An eighth determination module is used to determine a first number of components whose program codes are the third dependency; determine a second number of the multiple components; and determine a cycle ratio of the program codes of the multiple components based on the first number and the second number.

[0208] In another possible implementation, the third determination module is used to determine the second program code of the application to be analyzed, where the second program code includes the program code of components of multiple functions of the application; and determine the program code of multiple components of the updated functions from the second program code of the application to obtain the first program code.

[0209] In another possible implementation, the apparatus further includes:

[0210] a ninth determining module, configured to determine a second dependency graph of a third program code of the application, wherein the third program code and the first program code are program codes corresponding to different versions of the application, and the second dependency graph is configured to reflect the first dependency relationship, the second dependency relationship, and the third dependency relationship of the third program code;

[0211] The first comparison module is used to compare and analyze the first dependency graph and the second dependency graph to obtain a dependency comparison analysis result.

[0212] In another possible implementation, the apparatus further includes:

[0213] a tenth determining module, configured to determine target depths of program codes of a plurality of components included in a third program code of the application, wherein the third program code and the first program code are program codes corresponding to different versions of the application;

[0214] The second comparison module is configured to compare target depths of program codes of multiple components included in the first program code with target depths of program codes of multiple components included in the third program code to obtain a depth comparison analysis result.

[0215] In an embodiment of the present application, the first dependency graph includes a first dependency relationship, a second dependency relationship, and a third dependency relationship; the first dependency relationship is used to characterize the forward dependency relationship of the program codes of multiple components, the second dependency relationship is used to characterize the reverse reference relationship of the program codes of multiple components, and the third dependency relationship is used to characterize the circular dependency relationship of the program codes of multiple components; therefore, the first dependency graph can characterize the relationship between the program codes of multiple components from three dimensions, so that the first dependency graph can provide application developers with a more comprehensive dependency relationship, thereby helping developers to quickly evaluate the impact scope of modifications to the component program code, which also improves the modification efficiency of the component program code based on the first dependency graph.

[0216] It should be noted that the program code processing apparatus provided in the above embodiments only uses the division of the above functional modules as an example to illustrate the processing of program code. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the program code processing apparatus provided in the above embodiments and the program code processing method embodiments are based on the same concept. The specific implementation process is detailed in the method embodiments and will not be repeated here.

[0217] See also Figure 13 , Figure 13 FIG1 is a schematic diagram of a computer device 1300 according to an exemplary embodiment of the present application. The computer device 1300 may further include one or more of the following components: a processor 1310 , a memory 1320 , and a display screen 1330 .

[0218] The processor 1310 utilizes various interfaces and circuits to connect the various components within the entire computer device 1300. It executes various functions and processes data within the computer device 1300 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1320, as well as accessing data stored in the memory 1320. Optionally, the processor 1310 can be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 1310 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a neural network processing unit (NPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content displayed on the display screen 1330; the NPU is used to implement artificial intelligence (AI) functions; and the modem is used to handle wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 1310, but may be implemented separately through a computer program product.

[0219] The memory 1320 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 1320 includes a non-transitory computer-readable storage medium. The memory 1320 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 1320 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc.; the data storage area may store data created according to the use of the computer device 1300 (such as audio data, a phone book), etc.

[0220] The display screen 1330 is a display component for displaying a user interface. Optionally, the display screen 1330 is a display screen with a touch function, through which the user can use any suitable object such as a finger or a touch pen to perform touch operations on the display screen 1330.

[0221] Display screen 1330 is typically provided on the front panel of computer device 1300. Display screen 1330 can be designed as a full-screen, curved screen, special-shaped screen, double-sided screen, or foldable screen. Display screen 1330 can also be designed as a combination of a full-screen and a curved screen, a combination of a special-shaped screen and a curved screen, etc., which are not limited in this embodiment.

[0222] In addition, those skilled in the art will appreciate that the structure of the computer device 1300 shown in the above figures does not limit the computer device 1300. The computer device 1300 may include more or fewer components than shown, or may combine certain components or arrange the components differently. For example, the computer device 1300 may also include a Wireless Fidelity (WiFi) module, an audio acquisition device, a speaker, a radio frequency circuit, an input unit, a sensor, an audio circuit, a Bluetooth module, a power supply, and other components, which will not be described in detail here.

[0223] An embodiment of the present application provides a computer-readable storage medium, which stores at least one computer instruction, and the at least one computer instruction is used to be executed by a processor to implement the program code processing method described in the above embodiment.

[0224] On the other hand, an embodiment of the present application provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the program code processing method described in the above embodiment.

[0225] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any media that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0226] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A method for processing program code, characterized in that: The method comprises: receiving a modification instruction, the modification instruction being used to request modification of a program code of a first target component in a first program code of an application, the first program code including program codes of a plurality of components, different components being used to implement different functions of the application; Determining a first dependency graph of the first program code, the first dependency graph including a first dependency relationship, a second dependency relationship, and a third dependency relationship between the program codes of the multiple components, the first dependency relationship being used to represent a dependency relationship between the program code of the component corresponding to the parent node and the program code of the component corresponding to the child node, the second dependency relationship being used to represent a dependency relationship between the program code of the component corresponding to the child node and the program code of the component corresponding to the parent node, and the third dependency relationship being used to represent a mutual dependency relationship between the program codes of at least two components; Based on the first dependency graph and the modification instruction, the program code of the first target component is modified.

2. The method according to claim 1, characterized in that The modifying the program code of the first target component based on the first dependency graph and the modification instruction includes: Determining, based on the first dependency graph, the code size and dependency count of the program code of the first target component before modification; Determining the code size and dependency count of the modified program code of the first target component; The program code of the first target component is modified based on the code amount and dependency times of the program code of the first target component before modification, the code amount and dependency times of the program code of the first target component after modification, and the modification instruction.

3. The method according to claim 2, characterized in that The modifying the program code of the first target component based on the code amount and the number of dependencies of the program code of the first target component before modification, the code amount and the number of dependencies of the program code of the first target component after modification, and the modification instruction includes: In a case where the amount of code of the modified program code of the first target component is less than the amount of code of the program code of the first target component before the modification, and the number of dependencies of the modified program code of the first target component is greater than the number of dependencies of the program code of the first target component before the modification, the program code of the first target component is modified based on the modification instruction.

4. The method according to claim 1, wherein The method further comprises: Determining, based on the first dependency graph, components on which the first target component depends; Prompt information is displayed, where the prompt information is used to prompt modification of the component on which the first target component depends.

5. The method according to claim 1, wherein The process of generating the first dependency graph includes: determining the first program code of the application to be analyzed; Performing dependency analysis on the first program code to obtain a first dependency, a second dependency, and a third dependency between the program codes of the multiple components; Based on the first dependency relationship, the second dependency relationship, and the third dependency relationship, a first dependency graph of the first program code is generated.

6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: determining target depths of the program codes of the plurality of components, where the target depths of the program codes of the components represent the number of nesting levels of the program codes of the components in the first program code; Depth distribution information of the program codes of the plurality of components is determined based on target depths of the program codes of the plurality of components.

7. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Determining the number of times the program codes of the plurality of components depend on each other and the number of times they are depended on based on the first dependency relationship and the second dependency relationship; Based on the number of dependencies and the number of dependencies of the program codes of the multiple components, a first preset number of second target components and a second preset number of third target components are determined, wherein the second target components are the first preset number of components with the largest number of dependencies, and the third target components are the second preset number of components with the largest number of dependencies.

8. The method according to any one of claims 1 to 5, characterized in that The method further comprises: determining a first number of components having program codes as the third dependency; determining a second quantity of the plurality of components; Based on the first number and the second number, cycle percentages of program codes of the plurality of components are determined.

9. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Determining a second dependency graph of a third program code of the application, where the third program code and the first program code are program codes corresponding to different versions of the application, and the second dependency graph is used to reflect the first dependency relationship, the second dependency relationship, and the third dependency relationship of the third program code; A comparative analysis is performed on the first dependency graph and the second dependency graph to obtain a dependency comparative analysis result.

10. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the program code processing method according to any one of claims 1 to 9.