Code static analysis method and device, equipment, medium and program product

By obtaining ABAP code from multiple servers in parallel and using deep learning technology for static analysis, the shortcomings of existing tools in terms of scalability, analysis depth and user experience are solved, and efficient and intelligent code static analysis results are achieved.

CN119883360APending Publication Date: 2025-04-25PICC INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411897886.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

Existing code static analysis tools have shortcomings in scalability, analysis depth, intelligent analysis capabilities, user experience, etc., resulting in low analysis efficiency and poor results.

Method used

By obtaining ABAP code source files in parallel from multiple servers, using a deep learning-based code static analysis method, combining predefined code analysis rules for static analysis, and significantly improving analysis efficiency and effectiveness through multi-level security protection mechanisms and intelligent problem analysis and optimization suggestions generation mechanism.

Benefits of technology

It realizes parallel acquisition and cross-system analysis of multi-server ABAP code, improves the scalability and efficiency of static code analysis, provides more accurate and intelligent analysis results and optimization suggestions, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883360A_ABST
    Figure CN119883360A_ABST
Patent Text Reader

Abstract

The invention provides a code static analysis method and device, equipment, a medium and a program product. The method comprises the following steps: acquiring code source files from a plurality of servers in parallel; wherein the code source file is an ABAP code; performing static analysis on the code source file to obtain a code analysis result; wherein the static analysis comprises code static analysis based on deep learning; and displaying the code analysis result. By adopting the method provided by the embodiment of the invention, the code static analysis efficiency and effect can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of big data technology, and in particular to a method, apparatus, device, medium and program product. Background Art

[0002] In the related technologies, code static analysis is a basic technology in software engineering, which can find potential problems by analyzing source code without actually executing the program. At present, a single server access mode is usually used to obtain code, and code inspection and analysis are performed based on predefined rules, and the inspection and analysis results are then displayed in a list form. This will result in poor scalability of the code analysis method and low analysis efficiency. Summary of the invention

[0003] The present disclosure provides a code static analysis method, device, equipment, medium and program product. The technical solution of the present disclosure is as follows:

[0004] In a first aspect, the present disclosure provides a code static analysis method, comprising:

[0005] Acquire code source files from multiple servers in parallel; wherein the code source files are ABAP codes;

[0006] Performing static analysis on the code source file to obtain a code analysis result; wherein the static analysis includes code static analysis based on deep learning;

[0007] Display the code analysis results.

[0008] In a possible implementation, the performing static analysis on the code source file to obtain a code analysis result includes:

[0009] Inputting the code source file into a code analysis model; wherein the code analysis model is trained by a deep learning algorithm based on historical code training samples;

[0010] The code source file is statically analyzed by the code static analysis model to obtain a first code analysis result; wherein the first code analysis result includes at least one of a structural feature analysis result, a grammatical feature analysis result, and a semantic feature analysis result of the code source file.

[0011] In a possible implementation, the performing static analysis on the code source file to obtain a code analysis result further includes:

[0012] Performing static analysis on the code source file using predefined code analysis rules to obtain a second code analysis result;

[0013] The code analysis result is determined based on the first code analysis result and the second code analysis result.

[0014] In a possible implementation manner, before obtaining code source files from multiple servers in parallel, the method further includes:

[0015] Upon receiving a login request from a user, performing single sign-on authentication on the login credentials of the user;

[0016] If the identity authentication and access permission verification of the user are passed, generating an access token for the user;

[0017] Obtaining a user request of the user;

[0018] The step of obtaining code source files from multiple servers in parallel includes:

[0019] According to the user request and the access token, code source files are obtained from multiple servers in parallel.

[0020] In a possible implementation manner, before performing single sign-on authentication on the user's login credentials when receiving the user's login request, the method further includes:

[0021] Obtain a configuration file; wherein the configuration file is encrypted and stored using a symmetric encryption algorithm;

[0022] Decrypting the configuration file to obtain configuration information;

[0023] The configuration information is loaded.

[0024] In a possible implementation, displaying the code analysis result includes at least one of the following:

[0025] Responsively display the code analysis results through a network interface;

[0026] Displaying the code analysis result locally through a GUI client;

[0027] Display the code analysis results through an API interface;

[0028] Generate an analysis report based on the code analysis result through a report generator; and display the analysis report.

[0029] In a second aspect, the present disclosure provides a code static analysis device, comprising:

[0030] An acquisition module, used for acquiring code source files from multiple servers in parallel; wherein the code source files are ABAP codes;

[0031] An analysis module, configured to perform static analysis on the code source file to obtain a code analysis result; wherein the static analysis includes code static analysis based on deep learning;

[0032] The display module is used to display the code analysis result.

[0033] In a third aspect, the present disclosure provides an electronic device, including:

[0034] processor;

[0035] a memory for storing instructions executable by the processor;

[0036] The processor is configured to execute the instructions to implement the method described in the first aspect.

[0037] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in the first aspect.

[0038] In a fifth aspect, the present disclosure provides a computer program product, comprising a computer program / instructions, characterized in that when the computer program / instructions are executed by a processor, the method described in the first aspect is implemented.

[0039] The technical solution disclosed in this disclosure brings at least the following beneficial effects:

[0040] In the embodiment of the present disclosure, code source files are obtained from multiple servers in parallel; wherein the code source files are ABAP codes; the code source files are statically analyzed to obtain code analysis results; wherein the static analysis includes code static analysis based on deep learning; and the code analysis results are displayed. In this way, not only can the parallel acquisition of ABAP codes from multiple servers and the cross-system ABAP code analysis be achieved, but also the intelligent static analysis of ABAP codes based on deep learning can be achieved, thereby effectively improving the efficiency and effect of code static analysis.

[0041] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0043] Figure 1 A schematic diagram of a code static analysis method provided by an embodiment of the present disclosure;

[0044] Figure 2 is a schematic diagram of a code static analysis system provided by an embodiment of the present disclosure;

[0045] Figure 3 It is a schematic diagram of the workflow of a code static analysis system provided by an embodiment of the present disclosure;

[0046] Figure 4 is a schematic diagram of a user interface provided by an embodiment of the present disclosure;

[0047] Figure 5 It is a schematic diagram of a data flow processing flow provided by an embodiment of the present disclosure;

[0048] Figure 6 It is a structural schematic diagram of a code static analysis device provided by an embodiment of the present disclosure;

[0049] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0050] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0051] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0052] 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 disclosure are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0053] The acquisition, storage, use, and processing of data in the technical solution disclosed in this disclosure are in compliance with the relevant provisions of national laws and regulations.

[0054] It should be noted that in the embodiments of the present disclosure, there may be existing solutions in the industry such as certain software, components, models, etc., which should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present disclosure, but it does not mean that the applicant has or will necessarily use the solution.

[0055] Among the related technologies, code static analysis is a basic technology in software engineering. It can find potential problems by analyzing source code without actually executing the program. This technology mainly includes methods such as syntax analysis, control flow analysis, data flow analysis and semantic analysis. Among them, syntax analysis mainly checks whether the code conforms to the language specification; control flow analysis is mainly used to understand the execution path of the program; data flow analysis mainly tracks the flow of data in the program; semantic analysis mainly focuses on understanding the actual meaning of the code. These analysis methods together constitute the technical basis for code quality inspection, bug (defect or problem) detection, security vulnerability discovery and performance optimization analysis. In the field of enterprise application development, SAP (Systems, Applications and Products in Data Processing) system is the mainstream enterprise-level ERP (Enterprise Resource Planning) solution, and its proprietary programming language ABAP (Advanced Business Application Programming) occupies an important position in enterprise application development. ABAP language has the characteristics of enterprise application orientation, emphasizing performance and security, so strict code quality control is required. Due to the complexity and importance of enterprise-level applications, higher requirements are placed on the quality management of ABAP code. Distributed system technology is an indispensable part of modern software architecture. This technology achieves parallel processing, high availability, and scalability through the collaborative work of multiple computing nodes. In practical applications, distributed systems achieve task allocation through load balancing, ensure consistency through data synchronization, and optimize resource utilization through task scheduling. These technologies provide necessary technical support for large-scale code analysis.

[0056] In the related art, in the field of code static analysis tools, the SonarQube code quality management platform is usually used, which is developed based on Java and provides a Web (network) interface and a REST API interface (RESTful API, representing a state transfer application program interface). The platform supports code inspection in multiple programming languages ​​and implements code analysis through a rule engine. However, although SonarQube provides a wealth of code inspection rules, its analysis method is too mechanical and only stays at the syntax level. When faced with complex ABAP business codes, it is unable to understand the business semantics and execution logic of the code, resulting in a large number of false positives and missed reports. For example, when analyzing database operation-related codes, existing tools often cannot accurately judge the execution efficiency of SQL (Structured Query Language) statements because they lack an understanding of business scenarios and data volumes. That is, the SonarQube code quality management platform has obvious deficiencies in ABAP code analysis, lacks distributed processing capabilities, and its security design is relatively simple.

[0057] In terms of code acquisition, the Code Inspector officially provided by SAP is an inspection tool specifically for ABAP code. As a built-in function of the SAP system, it has a high degree of system integration. The tool can perform basic code inspection and performance analysis. However, it can only perform code inspection within a single SAP system and cannot perform cross-system code analysis. When an enterprise has multiple SAP systems, developers need to log in to each system separately to perform code inspections, which not only increases the complexity of the operation, but more importantly, it is impossible to perform a unified analysis of related codes distributed in different systems, resulting in the inability to discover possible problems between cross-system codes. Moreover, the rule configuration is relatively fixed and does not support custom extensions. At the same time, the tool lacks intelligent analysis capabilities, the user interface operation is complex, and it is difficult to meet the needs of modern development environments.

[0058] In terms of analysis result processing, CheckStyle-type tools are usually used to display analysis results in a simple problem list format. However, although open source code checking tools such as CheckStyle support rule customization and can be integrated into the development environment, such tools lack classification, statistics, and correlation analysis of problems. This approach makes it difficult for developers to understand the code quality status from an overall perspective, and it is also impossible to effectively identify the code areas that need the most optimization. Moreover, open source code checking tools such as CheckStyle are mainly oriented to general programming languages ​​and do not support ABAP code analysis. Especially in large ABAP projects, there may be thousands of inspection issues, but existing tools cannot help users determine the priority and order of solving the problems. In other words, the analysis capabilities of CheckStyle-type tools are limited to simple rule matching, lack deep analysis capabilities, and do not have distributed processing capabilities, and are less efficient when processing large-scale codes.

[0059] In summary, the code static analysis method in the related art has at least the following technical problems:

[0060] In terms of architecture design, most of them adopt a stand-alone processing mode, which is not scalable enough and has incomplete security considerations; in terms of function implementation, the analysis depth is not enough, there is a lack of intelligent analysis capabilities, and the optimization suggestions provided are often too general; in terms of user experience, the interface design is not friendly enough, the operation process is complicated, and the configuration options are not flexible enough. These problems seriously restrict the actual effect of code static analysis tools in enterprise-level application development.

[0061] Based on this, the embodiments of the present disclosure provide a code static analysis method, device, equipment, medium and program product, which can solve the above technical problems. Specifically:

[0062] Regarding the security issues of multi-system code access. The disclosed embodiment adopts a multi-level security protection mechanism, and encrypts and stores sensitive configuration information through the symmetric encryption algorithm AES-256, effectively preventing the leakage of configuration information. In terms of user authentication, the SSO (Single Sign On) authentication mechanism based on JWT (JSON Web Token) is adopted, which not only ensures the reliability of identity authentication, but also improves user access efficiency. The system can transmit data through HTTPS (Hypertext Transfer Protocol Secure) and implements fine-grained permission control based on RBAC (Role-Based Access Control), thereby strictly ensuring the security of code assets while supporting concurrent access to multiple systems.

[0063] Intelligent code analysis. The disclosed embodiment introduces a code analysis technology based on deep learning. By learning a large number of ABAP code samples, a code quality assessment model (code analysis model) is established, which can accurately identify the structural features, grammatical features and semantic features in the code. Through the adaptive rule weight adjustment mechanism, the system can dynamically optimize the analysis rules according to historical analysis results and user feedback, significantly improving the accuracy of the analysis. In particular, in terms of code similarity analysis, an improved text similarity algorithm can be used to effectively identify duplicate code and similar code fragments, and provide accurate optimization suggestions for code refactoring.

[0064] Regarding the processing of analysis results. The disclosed embodiment adopts an intelligent problem analysis and optimization suggestion generation mechanism. The system can not only classify and count the problems found in multiple dimensions, but also generate targeted optimization suggestions based on deep learning algorithms by analyzing historical optimization cases and code modification records. These suggestions include specific modification plans and expected effects, which can help developers improve code quality more efficiently. Regarding user experience issues. The disclosed embodiment implements adaptive interface layout and rich visualization functions. The system supports multi-terminal synchronous access, and users can get a consistent user experience on different devices. Through the personalized configuration function, users can customize analysis rules, interface layout and report templates according to their needs. At the same time, the system provides a standard API (Application Programming Interface) to support seamless integration with other development tools.

[0065] In summary, the embodiments of the present disclosure can solve the technical problems of ABAP code static analysis tools in terms of security, intelligent analysis, result processing and user experience, and provide a safe, efficient and easy-to-use code static analysis method, which can significantly improve the efficiency and effectiveness of code quality management.

[0066] The technical solutions provided by various embodiments of the present disclosure are described in detail below in conjunction with the accompanying drawings.

[0067] Figure 1 The present invention provides a flowchart of a method for static code analysis, which can be applied to a server, such as a single server or a server cluster, and is executed by a static code analysis system. Figure 1 As shown, the code static analysis method may include the following steps:

[0068] S101, obtaining code source files from multiple servers in parallel.

[0069] Among them, the code source file is ABAP code.

[0070] In an embodiment of the present disclosure, when performing code static analysis, code source files in multiple servers can be obtained in parallel. Exemplarily, the code source files can be obtained from multiple SAP servers in parallel and simultaneously through a concurrent processing mechanism, that is, the ABAP codes of multiple SAP servers can be obtained for subsequent static analysis processing. It can be understood that after obtaining the code source files from multiple servers in parallel, the source code files can also be cached, for example, using a multi-level cache strategy (such as LRU (Least Recently Used, cache replacement algorithm)) for caching to reduce the time of repeated calculations or repeated accesses and ensure efficient code access. As an example, it can be stored in a code warehouse, which can provide reliable code storage and code management functions. It should be noted that before the code is stored, the acquired code can also be preprocessed to remove unnecessary information, such as comment removal, macro expansion, code unified format, dead code elimination, etc.

[0071] S102, performing static analysis on the code source file to obtain code analysis results.

[0072] Among them, static analysis includes code static analysis based on deep learning.

[0073] In an embodiment of the present disclosure, after the code source files are obtained from multiple servers in parallel, code static analysis processing can be performed. Exemplarily, code static analysis can be performed on the ABAP code source files through a deep learning algorithm to implement intelligent static analysis of the code and obtain code analysis results. The code analysis results may include, for example, code quality issues, potential bugs, code style issues, etc.; or, it may also include interpreting the analysis results of the deep learning model, converting the technical output into information useful to developers, such as specific error locations, possible repair suggestions, code improvement suggestions, etc.

[0074] In some possible implementations, static analysis is performed on the code source file to obtain code analysis results, including:

[0075] Inputting the code source file into the code analysis model; wherein the code analysis model is trained by a deep learning algorithm based on historical code training samples;

[0076] The code source file is statically analyzed by a code static analysis model to obtain a first code analysis result; wherein the first code analysis result includes at least one of a structural feature analysis result, a grammatical feature analysis result, and a semantic feature analysis result of the code source file.

[0077] In an embodiment of the present disclosure, when a code source file is statically analyzed based on a deep learning algorithm, the code source file can be input into a code analysis model. For example, the code features of the code source file can be extracted through the code analysis model, including structural features, grammatical features, semantic features, etc., and the code features of these code source files, including structural features, grammatical features, semantic features, etc., are subjected to intelligent code static analysis to obtain code analysis results, that is, the first code analysis results, which may include structural feature analysis results, grammatical feature analysis results, semantic feature analysis results, etc. It can be understood that the code analysis model can be obtained in advance by training a deep learning algorithm based on historical code training samples. The deep learning algorithm can be, for example, ASTNN (Abstract Syntax Tree-based Neural Network, a neural network method based on an abstract syntax tree), an integration of a deep learning method and static analysis (static analysis and additional context can be integrated into the source code representation of a deep learning model), and CNN (Convolutional Neural Network, a convolutional neural network).

[0078] In a further possible implementation, performing static analysis on the code source file to obtain a code analysis result further includes:

[0079] Performing static analysis on the code source file using predefined code analysis rules to obtain a second code analysis result;

[0080] A code analysis result is determined based on the first code analysis result and the second code analysis result.

[0081] In an embodiment of the present disclosure, rule analysis can also be included on the basis of intelligent code analysis. Exemplarily, predefined code analysis rules can be obtained, and then the code source file can be statically analyzed according to the predefined code analysis rules. For example, the syntax of the predefined code analysis rules can be parsed and verified, and the code can be analyzed according to the parsed code analysis rules to obtain the code analysis results of the rule analysis, that is, the second code analysis results. It can be understood that the predefined code quality rules (code analysis rules) can be stored in a rule base. Then, the final code analysis results can be determined based on the first code analysis results of the intelligent analysis and the second code analysis results of the rule analysis. For example, the first code analysis results and the second code analysis results can be summarized and merged to obtain a complete analysis report, that is, the code analysis results. In this way, the accuracy and completeness of the code analysis results can be improved on the basis of improving the efficiency of code static analysis.

[0082] S103, displaying the code analysis result.

[0083] In an embodiment of the present disclosure, after obtaining the code analysis results, the code analysis results can be displayed so that relevant personnel can receive and view the code analysis results. Exemplarily, a multi-terminal synchronous access function can be supported so that relevant personnel can view the code analysis results on different devices. As an example, a user can customize the interface layout of the device's display interface as needed to meet the user's personalized needs.

[0084] In the embodiment of the present disclosure, code source files are obtained from multiple servers in parallel; wherein the code source files are ABAP codes; the code source files are statically analyzed to obtain code analysis results; wherein the static analysis includes code static analysis based on deep learning; and the code analysis results are displayed. In this way, not only can the parallel acquisition of ABAP codes from multiple servers and the cross-system ABAP code analysis be achieved, but also the intelligent static analysis of ABAP codes based on deep learning can be achieved, thereby effectively improving the efficiency and effect of code static analysis.

[0085] In some possible implementations, before obtaining code source files from multiple servers in parallel, the method further includes:

[0086] Upon receiving a login request from a user, performing single sign-on authentication on the user's login credentials;

[0087] If the user's identity authentication and access rights verification are passed, an access token for the user is generated;

[0088] Get the user's user request;

[0089] Get source code files from multiple servers in parallel, including:

[0090] Based on the user request and access token, code source files are obtained from multiple servers in parallel.

[0091] In the embodiments of the present disclosure, user authentication can also be performed in advance. Exemplarily, the user can enter login credentials to log in. When receiving the user's login request, the user's login credentials can be authenticated by single sign-on, that is, when the user accesses the system, the SSO single sign-on authentication is first required. If the user's identity and access rights are both authenticated, an access token for the user, such as a JWT access token, can be generated. Then, the user's user request can be received, and the code source files can be obtained from multiple SAP servers in parallel according to the user's user request and the JWT access token. As an example, the system can receive the login credentials provided by the user, and perform user login verification through the authentication service. The authentication service can query the user information library, verify the validity of the user's identity, and check the user's access rights. If the authentication is successful, the system will automatically generate a JWT access token containing the user's identity and permission information; if the authentication fails, the corresponding error message can be returned. The successfully authenticated user can carry the token to access various functions of the system. In this way, not only can the reliability of identity authentication be ensured, the security in code access can be improved, but also the user access efficiency can be improved.

[0092] In some possible implementations, upon receiving a login request from a user, before performing single sign-on authentication on the login credentials of the user, the method further includes:

[0093] Obtain a configuration file; wherein the configuration file is encrypted and stored using a symmetric encryption algorithm;

[0094] Decrypt the configuration file to obtain configuration information;

[0095] Load configuration information.

[0096] In an embodiment of the present disclosure, before executing code static analysis, when the system is started, an initialization phase can be performed first. In this phase, an encrypted configuration file is obtained from the configuration storage, and the configuration file can be encrypted and stored using a symmetric encryption algorithm. The symmetric encryption algorithm can be, for example, an AES-256 algorithm, that is, the configuration file can be encrypted using the AES-256 algorithm, and the encryption process can include three steps: key generation, data encryption, and ciphertext storage. Then, the configuration file can be decrypted in real time to obtain various parameters required for system operation, obtain configuration information, and ensure the safe use of the configuration information. After that, the configuration information can be loaded, for example, each service component can be initialized according to the decrypted configuration information, including an authentication service, a task scheduler, an analysis engine, etc. It can be understood that a connection pool with a SAP server can also be established to prepare for subsequent code acquisition; the entire initialization process is performed in an asynchronous manner to ensure that the system can be quickly started and put into use. In this way, the leakage of configuration information can be effectively prevented and data security can be improved.

[0097] In some possible implementations, displaying code analysis results includes at least one of the following:

[0098] Responsive display of code analysis results through a web interface;

[0099] Display code analysis results locally through the GUI client;

[0100] Display code analysis results through API interface;

[0101] Generate an analysis report based on the code analysis results through the report generator; display the analysis report.

[0102] In the embodiments of the present disclosure, the code analysis results can be displayed in multiple ways. Exemplarily, it can be displayed through a Web interface, a GUI (Graphical User Interface, graphical user interface) client, an API interface and a report generator. As an example, the code analysis results can be displayed through a network interface Web, and the Web interface can adopt a responsive design to support access from multiple devices. The code analysis results can be displayed through a GUI client, which is implemented based on JavaFX to provide a localized analysis experience. The code analysis results can be displayed through an API interface, and the API interface can adopt a RESTful design to support third-party system integration. An analysis report can also be generated based on the code analysis results through a report generator, and the analysis report can be displayed. The report generator can generate analysis reports in multiple formats according to user needs. It can be understood that all display components can obtain data through a unified API interface, ensuring the consistency and real-time nature of the data. In this way, users can choose different display methods according to their needs, and the system will convert and optimize the data accordingly. In this way, a flexible and efficient interaction method can be provided to users, while ensuring the security and reliability of data access, and also providing a good foundation for function expansion.

[0103] To make the code static analysis method, apparatus, device, medium, and program product provided by the embodiments of the present disclosure clearer, an explanation is provided below with reference to examples.

[0104] Figure 2 Schematic diagram of a code static analysis system provided by an embodiment of the present disclosure. Figure 2 ,This system (code static analysis system) adopts a layered architecture design, which includes configuration management layer, authentication service layer, code acquisition layer, analysis engine layer and display layer from bottom to top. Among them:

[0105] 1) Configuration management layer implementation

[0106] As the basic layer of the system, the configuration management layer is responsible for the secure storage and distribution of system configuration information. This layer contains four core components: configuration encryption module, configuration decryption module, configuration storage, and configuration distribution service. The configuration encryption module uses the AES-256 algorithm to encrypt the configuration file. The encryption process includes three steps: key generation, data encryption, and ciphertext storage. The configuration decryption module decrypts the encrypted configuration in real time when the system is running to ensure the safe use of the configuration information. The configuration storage component uses a distributed database to achieve persistent storage of configuration information. The configuration distribution service is responsible for securely distributing the decrypted configuration information to various components of the system.

[0107] 2) Authentication service layer implementation

[0108] The authentication service layer provides unified identity authentication and permission control services. This layer consists of four parts: SSO authentication center, token management, permission control, and user information library. The SSO authentication center implements the single sign-on function based on JWT, and users only need to log in once to access all system functions; the token management module is responsible for the generation, verification, and invalidation of JWT tokens to ensure the validity of user identities; the permission control module implements fine-grained access control based on the RBAC model and accurately manages the permissions of users with different roles; the user information library stores basic information such as user accounts, roles, and permissions.

[0109] 3) Code acquisition layer implementation

[0110] The code acquisition layer is responsible for acquiring ABAP code from multiple SAP servers in parallel. This layer includes four core components: task scheduler, parallel processing engine, code cache, and code warehouse. The task scheduler is responsible for formulating the code acquisition plan and dynamically adjusting the task execution order according to the system load and priority; the parallel processing engine implements an efficient concurrent processing mechanism and can acquire code from multiple SAP servers at the same time; the code cache module adopts a multi-level cache strategy to reduce the number of times duplicate code is acquired; and the code warehouse provides reliable code storage and version management functions.

[0111] 4) Implementation of the analysis engine layer

[0112] The analysis engine layer is the core processing layer of the system, which is divided into two subsystems: rule analysis and intelligent analysis. The rule analysis subsystem includes three components: rule parser, rule execution engine and rule base. The rule parser is responsible for parsing and verifying the syntax of the analysis rules. The rule execution engine analyzes the code according to the parsed rules. The rule base stores predefined code quality rules. The intelligent analysis subsystem includes a machine learning model, a code feature extraction module and a training database. It realizes intelligent analysis of the code through deep learning technology. The machine learning model is trained with a large number of real code samples and can accurately identify the structural features, grammatical features and semantic features in the code.

[0113] 5) Presentation layer implementation

[0114] The presentation layer provides users with a variety of interactive interfaces. This layer includes four components: Web interface, GUI client, API interface, and report generator. The Web interface adopts responsive design and supports access from multiple devices; the GUI client is implemented based on JavaFX and provides a localized analysis experience; the API interface adopts RESTful design and supports third-party system integration; the report generator can generate analysis reports in multiple formats according to user needs. All presentation components obtain data through a unified API interface, ensuring data consistency and real-time performance.

[0115] Through this layered architecture design, the system achieves decoupling and reuse of functional modules, while ensuring the scalability and maintainability of the system. Each layer communicates through a standard interface, and the upper layer implements its functions by calling the services provided by the lower layer. Changes in the lower layer will not affect the implementation of the upper layer, thereby improving the stability and reliability of the system.

[0116] Based on the above code static analysis system, see Figure 3 , the code static analysis workflow can include the following main stages:

[0117] 1) Initialization phase

[0118] When the system starts, it first enters the initialization phase. In this phase, the system first loads the encrypted configuration file from the configuration storage, decrypts it through the configuration decryption module, and obtains the various parameters required for system operation. Subsequently, the system initializes various service components according to the decrypted configuration information, including the authentication service, task scheduler, and analysis engine. At the same time, the system will establish a connection pool with the SAP server to prepare for subsequent code acquisition. The entire initialization process is performed asynchronously to ensure that the system can be quickly started and put into use.

[0119] 2) User authentication stage

[0120] When a user accesses the system, he or she must first pass the SSO single sign-on authentication. The system receives the login credentials provided by the user and verifies them through the authentication service. The authentication service queries the user information database, verifies the validity of the user's identity, and checks the user's access rights. If the authentication is successful, the system generates a JWT access token containing the user's identity and permission information; if the authentication fails, the corresponding error message is returned. Users who have successfully authenticated can use the token to access various functions of the system.

[0121] 3) Code acquisition stage

[0122] After completing the authentication, the system enters the code acquisition phase. The task scheduler first initializes the parallel processing task according to the user request and system configuration. The parallel processing engine connects to multiple SAP servers at the same time and acquires ABAP code in parallel through the optimized network transmission protocol. The acquired code is first preprocessed to remove unnecessary information, and then cached by the code cache module. The cache strategy adopts the LRU (least recently used) algorithm to ensure efficient code access.

[0123] 4) Code analysis phase

[0124] The code analysis phase includes two parallel sub-processes: rule analysis and intelligent analysis. In the rule analysis process, the system first loads the predefined analysis rules, the rule parser parses and optimizes these rules, and then the rule execution engine analyzes the code. At the same time, in the intelligent analysis process, the system extracts code features and inputs these features into the trained machine learning model for in-depth analysis. The results of the two analysis processes are finally merged to form a complete analysis report.

[0125] 5) Results display stage

[0126] After the analysis is completed, the system enters the result display stage. First, the system generates a detailed analysis report based on the analysis results, including code quality assessment, problem list, and optimization suggestions. These results can be displayed in a variety of ways: the Web interface displays the analysis results in a visual way, supporting interactive operations and data drilling; the GUI client provides localized result viewing and management functions; the API interface returns the analysis data in a standard format for third-party system integration. Users can choose different display methods according to their needs, and the system will convert and optimize the data accordingly.

[0127] Through this pipeline workflow, the system can efficiently complete the entire process from code acquisition to result display. Each stage communicates through asynchronous message queues to ensure the efficiency and reliability of the processing process. At the same time, the system implements the necessary error handling and recovery mechanisms at each stage to ensure the stability of the entire analysis process.

[0128] This system adopts a multi-level interface design architecture and provides three interaction modes: Web interface, GUI client and API interface to meet the usage requirements in different scenarios. Figure 4 ,as follows:

[0129] 1) Main interface design

[0130] The main interface adopts a modular design, including four core functional areas: server selection, user login, program input and analysis results. The interface layout adopts a responsive design and can adapt to display devices of different sizes. The server selection module displays the available SAP servers in the form of a drop-down list, and obtains server status information in real time asynchronously. The user login module integrates the SSO authentication function and supports multiple login methods, including username and password, domain account and certificate login. The program input module provides intelligent prompts and automatic completion functions to help users quickly locate the target program. The analysis result module adopts a multi-dimensional display method, including problem lists, statistical charts and code preview functions.

[0131] 2) Web interface implementation

[0132] The web interface is developed based on a modern front-end framework, using component-based and modular design concepts. The overall interface adopts a single-page application (SPA) architecture, and front-end routing is used to achieve page switching without refresh. Data display uses virtual scrolling technology to effectively handle the display of large amounts of data. Chart display uses a visualization library that supports a variety of chart types and interactive operations. The interface style adopts a themed design, and users can switch between different display themes according to their personal preferences. At the same time, a responsive layout is implemented to ensure a good user experience on different devices.

[0133] 3) GUI client implementation

[0134] The GUI client is developed based on the JavaFX framework, providing a user experience that is closer to local applications. The client adopts the MVC architecture to separate the interface and business logic. The data processing uses a local cache mechanism to reduce the number of server requests. The interface controls use custom styles to provide a unified visual experience. The client supports offline analysis functions and can continue to work when the network is unavailable. At the same time, an automatic update mechanism is implemented to ensure that the client version is always up to date.

[0135] 4) API interface design

[0136] The API interface adopts RESTful architecture design and provides a standardized data access method. The interface uses JSON format for data exchange and supports GZIP compression to reduce the amount of data transmitted. The authentication adopts JWT mechanism to ensure the security of interface calls. The interface supports batch operations and paging queries, which improves data processing efficiency. At the same time, detailed API documentation is provided, including interface descriptions, parameter descriptions and sample codes, to facilitate third-party system integration.

[0137] 5) Backend service interaction

[0138] The interaction between the interface and the background service adopts an asynchronous communication mechanism. The server selection module obtains the SAP server status through regular polling; the user login module interacts with the user information library in real time for identity authentication; the program input module obtains program information from the code repository through incremental query; the analysis result module uses WebSocket technology to achieve real-time data updates. All data interactions are encrypted to ensure communication security.

[0139] Through this multi-level interface design, the system provides users with a flexible and efficient way of interaction while ensuring the security and reliability of data access. The modular design and standardized interface of the interface also provide a good foundation for future functional expansion.

[0140] The data flow processing of the code static analysis method provided by the embodiment of the present disclosure is as follows: Figure 5 As shown:

[0141] The data flow processing of this system involves five main links: configuration data, user authentication, code acquisition, analysis and processing, and result display, forming a complete data processing closed loop.

[0142] 1) Configure data stream processing

[0143] The configuration data flow starts from the configuration storage, and the system reads the encrypted configuration information through the configuration management module. The configuration data contains core information such as server information, security parameters, and system configuration. The configuration management module first reads the encrypted configuration file from the configuration storage, decrypts it using the AES-256 algorithm, and then distributes the decrypted configuration information to each functional module. To ensure the security of the configuration data, the system adopts a configuration management mechanism based on version control. Each configuration update will generate a new version number and retain the configuration modification history. The configuration data is updated using a push mechanism to ensure that each module can obtain the latest configuration information in a timely manner.

[0144] 2) Authentication data stream processing

[0145] The authentication data flow involves three entities: users, authentication services, and user information base. When a user accesses the system, he or she first provides login credentials to the authentication service. The authentication service compares and verifies the credential information with the data stored in the user information base, and generates an SSO token containing the user's identity and permission information after verification. This token will be used for all subsequent operation authorizations. The system uses a multi-level cache mechanism to store user authentication information and reduce the frequency of access to the user information base. At the same time, an automatic token renewal mechanism is implemented, which automatically renews the token when it is about to expire, providing a non-perceptible continuous access experience.

[0146] 3) Code acquisition data stream processing

[0147] The code acquisition data flow connects the SAP server, code acquisition module, and code repository. The code acquisition module acquires ABAP source code from the SAP server with the access token based on the user's request. The acquired code data includes source code content, metadata information, and version information. The system adopts an incremental acquisition strategy to acquire only the changed code and uses a difference comparison algorithm to calculate the changed code. The acquired code is first preprocessed to remove comments and formatting characters, and then stored in the code repository. The code repository adopts a distributed storage architecture to ensure high availability and fast access to data.

[0148] 4) Analyze and process data flow

[0149] The code analysis data flow is divided into two branches: rule analysis and intelligent analysis. The rule analysis branch obtains analysis rules from the rule library and performs a normative check on the code; the intelligent analysis branch uses the model in the training database to perform in-depth feature analysis. The analysis results of the two branches are finally summarized in the analysis result library. The system adopts a streaming processing architecture to support parallel analysis of large-scale codes. Memory mapping technology is used to accelerate data access during the analysis process, and a breakpoint-resume mechanism for analysis tasks is implemented to ensure the reliability of long-term analysis tasks.

[0150] 5) Results display data flow

[0151] The result display data stream delivers the analysis results to the user in different display methods. The system reads data from the analysis result library and converts and formats the data according to different display requirements. For the Web interface, the system uses paging loading and virtual scrolling technology to optimize the display effect of large amounts of data; for the GUI client, a local cache mechanism is implemented to reduce the amount of data transmission; for the API interface, data compression and batch query functions are provided to improve data transmission efficiency. All display data is filtered by permissions to ensure that users can only access content they have permission to view.

[0152] Through this multi-level data flow design, the system achieves secure data transmission, efficient processing and flexible display. Each data flow link implements necessary security control and performance optimization measures to ensure the reliability and efficiency of the entire system.

[0153] The specific implementation and technical effects of each step of this embodiment are similar to those of the above method embodiments, and will not be repeated here.

[0154] Based on the same inventive concept, the present disclosure also provides a code static analysis device. Figure 6 As shown, the code static analysis device 600 includes:

[0155] The acquisition module 610 is used to acquire code source files from multiple servers in parallel; wherein the code source files are ABAP codes;

[0156] An analysis module 620 is used to perform static analysis on the code source file to obtain a code analysis result; wherein the static analysis includes code static analysis based on deep learning;

[0157] The display module 630 is used to display the code analysis result.

[0158] In a possible implementation, the analysis module 620 is used to:

[0159] Inputting the code source file into a code analysis model; wherein the code analysis model is trained by a deep learning algorithm based on historical code training samples;

[0160] The code source file is statically analyzed by the code static analysis model to obtain a first code analysis result; wherein the first code analysis result includes at least one of a structural feature analysis result, a grammatical feature analysis result, and a semantic feature analysis result of the code source file.

[0161] In a possible implementation, the code static analysis device 600 further includes a rule analysis module for:

[0162] Performing static analysis on the code source file using predefined code analysis rules to obtain a second code analysis result;

[0163] The code analysis result is determined based on the first code analysis result and the second code analysis result.

[0164] In a possible implementation, the code static analysis device 600 further includes:

[0165] An authentication module, configured to perform single sign-on authentication on the login credentials of the user upon receiving a login request from the user;

[0166] A token generation module, used to generate an access token for the user if the identity authentication and access permission verification of the user are passed;

[0167] A request acquisition module, used to acquire a user request of the user;

[0168] The acquisition module 610 is used to:

[0169] According to the user request and the access token, code source files are obtained from multiple servers in parallel.

[0170] In a possible implementation, the code static analysis device 600 further includes:

[0171] A configuration acquisition module is used to acquire a configuration file; wherein the configuration file is encrypted and stored using a symmetric encryption algorithm;

[0172] A decryption module, used to decrypt the configuration file to obtain configuration information;

[0173] A configuration loading module is used to load the configuration information.

[0174] In a possible implementation, the display module 630 is configured to perform at least one of the following:

[0175] Responsively display the code analysis results through a network interface;

[0176] Displaying the code analysis result locally through a GUI client;

[0177] Display the code analysis results through an API interface;

[0178] Generate an analysis report based on the code analysis result through a report generator; and display the analysis report.

[0179] The specific implementation method and technical effect of the device provided in the embodiment of the present disclosure are similar to those of the above-mentioned method embodiment, and will not be repeated here.

[0180] According to an embodiment of the present disclosure, the present disclosure also discloses an electronic device, a computer-readable storage medium, and a computer program product.

[0181] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device 700 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0182] like Figure 7As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0183] Multiple components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0184] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running deep learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as a code static analysis method. For example, in some embodiments, the code static analysis method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the code static analysis method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the code static analysis method in any other appropriate manner (e.g., by means of firmware).

[0185] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0186] The program code of the computer program product for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0187] In the context of the present disclosure, a computer-readable storage medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may be a machine-readable signal medium or a machine-readable storage medium. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a computer-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0188] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0189] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0190] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0191] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0192] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A code static analysis method, characterized in that: include: Acquire code source files from multiple servers in parallel; wherein the code source files are ABAP codes; Performing static analysis on the code source file to obtain a code analysis result; wherein the static analysis includes code static analysis based on deep learning; Display the code analysis results.

2. The code static analysis method according to claim 1, characterized in that: The static analysis of the code source file to obtain the code analysis result includes: Inputting the code source file into a code analysis model; wherein the code analysis model is trained by a deep learning algorithm based on historical code training samples; The code source file is statically analyzed by the code static analysis model to obtain a first code analysis result; wherein the first code analysis result includes at least one of a structural feature analysis result, a grammatical feature analysis result, and a semantic feature analysis result of the code source file.

3. The code static analysis method according to claim 1, characterized in that: The performing static analysis on the code source file to obtain a code analysis result also includes: Performing static analysis on the code source file using predefined code analysis rules to obtain a second code analysis result; The code analysis result is determined based on the first code analysis result and the second code analysis result.

4. The code static analysis method according to claim 1, characterized in that: Before obtaining code source files from multiple servers in parallel, the method further includes: Upon receiving a login request from a user, performing single sign-on authentication on the login credentials of the user; If the identity authentication and access permission verification of the user are passed, generating an access token for the user; Obtaining a user request of the user; The step of obtaining code source files from multiple servers in parallel includes: According to the user request and the access token, code source files are obtained from multiple servers in parallel.

5. The code static analysis method according to claim 4, characterized in that: In the case of receiving a login request from a user, before performing single sign-on authentication on the login credentials of the user, the method further includes: Obtain a configuration file; wherein the configuration file is encrypted and stored using a symmetric encryption algorithm; Decrypting the configuration file to obtain configuration information; The configuration information is loaded.

6. The code static analysis method according to claim 1, characterized in that: The displaying of the code analysis result includes at least one of the following: Responsively display the code analysis results through a network interface; Displaying the code analysis result locally through a GUI client; Display the code analysis results through an API interface; Generate an analysis report based on the code analysis result by a report generator; The analysis report is displayed.

7. A code static analysis device, characterized in that: include: An acquisition module, used for acquiring code source files from multiple servers in parallel; wherein the code source files are ABAP codes; An analysis module, used to perform static analysis on the code source file to obtain a code analysis result; wherein the static analysis includes code static analysis based on deep learning; The display module is used to display the code analysis result.

8. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.