Static code analysis method, electronic equipment and medium

Through the DevOps platform, the problem of manual analysis is solved, and efficient and automated code analysis and quality monitoring is achieved.

CN119440991APending Publication Date: 2025-02-14KOSTAL SHANGHAI ELECTROMECHANICAL CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411527224.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Manual analysis of static code in the prior art requires a lot of manpower and time resources, and the analysis of delivered reports is not traceable.

Method used

Provide a static code analysis method. Through the DevOps platform, it obtains the project code and related parameters sent by the project management platform, downloads it to the local storage space, modifys the configuration platform parameters, and analyzes the project code based on the modified configuration platform and code analysis platform. , generate analysis reports and send them to the project management platform.

Benefits of technology

It realizes automation of static code analysis, reduces human resources consumption, improves the traceability of analysis reports, and monitors code quality in real time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440991A_ABST
    Figure CN119440991A_ABST
Patent Text Reader

Abstract

The invention discloses a static code analysis method, electronic equipment and a medium, and is applied to the field of code analysis. Wherein the DevOps platform obtains a project code sent by a project management platform and related parameters corresponding to the project code; downloading the project code to a local storage space, and modifying parameters in the configuration platform into related parameters; and analyzing the project code stored in the local space based on the modified configuration platform and the code analysis platform to obtain an analysis report, and sending the analysis report to the project management platform. It can be seen that project personnel only need to configure options and related parameters in the project management platform and trigger execution during version release, the parameters can be transmitted to the DevOps platform, then the configuration platform modifies the parameters, finally, static code analysis is conducted on different projects according to customized configuration, the whole steps are all automatic, and the efficiency is high. And moreover, the inspection efficiency is improved, the deliverable is traceable, and the quality can be monitored in real time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of code analysis, and in particular to a static code analysis method, electronic device and medium. Background Art

[0002] Most embedded system applications have high requirements for reliability and real-time performance, and require analysis of static code in embedded systems before use in different scenarios to meet the needs of different scenarios. Currently, static code analysis is usually done manually, and the analysis results are backed up and delivered.

[0003] However, in scenarios where software versions are released frequently or there are many parallel projects, manual analysis, backup, and delivery of static code will consume more manpower and time resources, and the analysis and delivery reports will not be traceable.

[0004] In view of the above technologies, seeking a static code analysis method is an urgent problem to be solved by those skilled in the art. Summary of the invention

[0005] The purpose of this application is to provide a static code analysis method, electronic device and medium, which can solve the problems of manual static code analysis in the prior art, which consumes a lot of manpower and time resources, and the lack of traceability of the analysis report.

[0006] To solve the above technical problems, the present application provides a static code analysis method, which is applied to a DevOps platform including a configuration platform and a code analysis platform, including:

[0007] Obtain the project code sent by the project management platform and the relevant parameters corresponding to the project code;

[0008] Download the project code to the local storage space and modify the parameters in the configuration platform to relevant parameters;

[0009] The project code stored in the local space is analyzed based on the modified configuration platform and code analysis platform to obtain an analysis report, and the analysis report is sent to the project management platform.

[0010] Preferably, the project code stored in the local space is analyzed based on the modified configuration platform and code analysis platform, including:

[0011] Perform security compliance checks on project codes based on the modified configuration platform and code analysis platform;

[0012] If the project code meets the requirements of the corresponding security specifications, the analysis report is a first-class analysis report, and the first-class analysis report is sent to the project management platform;

[0013] If the project code does not meet the requirements of the corresponding security specifications, the analysis report will be a second-class analysis report, and the second-class analysis report will be sent to the project management platform and the alarm system will be triggered so that project personnel can repair the project code according to the second-class analysis report.

[0014] Preferably, the project code is tested for security specifications based on the modified configuration platform and code analysis platform, including:

[0015] Preprocess the project code based on the modified configuration platform to obtain the target project code;

[0016] Based on the code analysis platform, the target project code is tested for security standards file by file and line by line;

[0017] If any file or any line of code in the target project code meets the requirements corresponding to the safety specification, then the target project code is determined to meet the requirements corresponding to the safety specification;

[0018] If any file or any line of code in the target project code does not meet the requirements corresponding to the security specification, it is determined that the target project code does not meet the requirements corresponding to the security specification.

[0019] Preferably, it also includes:

[0020] Based on the modified configuration platform and code analysis platform, statistical analysis is performed on the project code stored in the local space to obtain a statistical report;

[0021] The statistical report is sent to the project management platform through the storage platform so that the project management platform can generate quality analysis charts based on the statistical report and display them.

[0022] Preferably, the analysis report includes hypertext markup language and an excel spreadsheet.

[0023] On the other hand, a static code analysis method is applied to a project management platform, including:

[0024] Get the project code corresponding to the target project and the related parameters corresponding to the project code;

[0025] Send the project code and related parameters to the DevOps platform so that the DevOps platform can download the project code to the local storage space and modify the parameters in the configuration platform to the related parameters; analyze the project code stored in the local space based on the modified configuration platform and code analysis platform to obtain an analysis report;

[0026] Get analysis reports sent by the DevOps platform.

[0027] Preferably, after obtaining the analysis report sent by the DevOps platform, the method further includes:

[0028] Obtain statistical reports sent by the DevOps platform through the storage platform;

[0029] Generate quality analysis charts based on statistical reports and display them to intuitively judge the quality status of project codes.

[0030] Preferably, before obtaining the project code corresponding to the target project and the related parameters corresponding to the project code, the following steps are included:

[0031] Obtaining an original project code corresponding to the original project, and determining corresponding original related parameters according to the original project code; wherein the original related parameters include: blacklist parameters, security specification parameters, source file parameters, header file parameters and check mode parameters;

[0032] If the analysis signal and approval signal of the target project are received, the project requirements corresponding to the target project are obtained;

[0033] The original project code and original related parameters are modified based on project requirements to obtain the project code and related parameters.

[0034] To solve the above technical problems, the present application also provides an electronic device, including a memory for storing a computer program;

[0035] A processor is used to implement the steps of the above-mentioned static code analysis method when executing a computer program.

[0036] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above static code analysis method are implemented.

[0037] A static code analysis method provided by the present application is applied to a DevOps platform including a configuration platform and a code analysis platform, including: obtaining the project code sent by the project management platform and the relevant parameters corresponding to the project code; downloading the project code to the local storage space, and modifying the parameters in the configuration platform to the relevant parameters; analyzing the project code stored in the local space based on the modified configuration platform and code analysis platform to obtain an analysis report, and sending the analysis report to the project management platform. It can be seen that the present application implements static code analysis by using a project management platform and a DevOps platform. Project personnel only need to configure options and related parameters in the project management platform and trigger execution when the version is released. The parameters will be passed to the DevOps platform, and the DevOps platform will continue to pass the parameters to the configuration platform for real-time modification. Then different projects perform static code analysis according to the customized configuration. The whole process only requires the project personnel to input parameters in the early stage and trigger the version release process. The subsequent analysis and delivery backup are no longer manually operated. Static code analysis is completed automatically, which improves inspection efficiency, traceability of delivery items, and real-time monitoring of quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0039] FIG1 is a flow chart of a DevOps platform side in a static code analysis method provided in an embodiment of the present application;

[0040] FIG2 is a schematic diagram of a platform provided in an embodiment of the present application;

[0041] FIG3 is a structural diagram of the DevOps platform side in the static code analysis method provided in an embodiment of the present application;

[0042] FIG4 is a structural diagram of the project management platform side in the static code analysis method provided in an embodiment of the present application;

[0043] FIG5 is a structural diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0045] The core of this application is to provide a static code analysis method, electronic device and medium.

[0046] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0047] To solve the above technical problems, the present application provides a static code analysis method, which is applied to a DevOps platform including a configuration platform and a code analysis platform, as shown in FIG1 , and includes the following processes:

[0048] S10: Obtain the project code sent by the project management platform and related parameters corresponding to the project code.

[0049] S11: Download the project code to the local storage space and modify the parameters in the configuration platform to relevant parameters.

[0050] S12: Analyze the project code stored in the local space based on the modified configuration platform and code analysis platform to obtain an analysis report, and send the analysis report to the project management platform.

[0051] In a specific embodiment, the schematic diagram of the platform used in this application is shown in Figure 2, wherein the project management platform 1, the DevOps platform 2, the configuration platform 21 and the code analysis platform 22. With the project management platform 1 as the entrance, the project code and the relevant parameters corresponding to the project code are obtained according to the project requirements. The configurations of different projects are different, and the configurations of different sample stages of the same project may also be different. The configuration here can be changed. In the early stage, the project leader completes the initial configuration according to the project requirements file in the project management platform. If there are changes, the development engineer will propose a process and merge it into the basic configuration of the project after approval by the project leader. When a version is to be released, the version release process is proposed in the project management platform 1. The project management platform 1 will automatically trigger the tasks in the downstream DevOps platform 2, and pass the project code configured in the project management platform 1 and the relevant parameters corresponding to the project code to the DevOps platform 2. The DevOps platform 2 downloads the project code to the local storage space; and interacts with the configuration platform 21 according to the relevant parameters corresponding to the acquired project code, and completes the update of the static code checking tool configuration in combination with the preset tool. The tool can realize customized updates of blacklist, macro definition, source file, header file, rules and check mode. After the configuration modification is completed, the code analysis platform 22 generates a complete report for the project code analysis and pushes the analysis report to the project management platform 1. The analysis report represents a detailed report of the project code, including Hyper Text Markup Language (html) and Excel tables.

[0052] The specific process of analyzing the project code and the corresponding standards vary according to the different codes, so they can be set according to user needs.

[0053] A static code analysis method provided by the present application is applied to a DevOps platform including a configuration platform and a code analysis platform, including: obtaining the project code sent by the project management platform and the relevant parameters corresponding to the project code; downloading the project code to the local storage space, and modifying the parameters in the configuration platform to the relevant parameters; analyzing the project code stored in the local space based on the modified configuration platform and code analysis platform to obtain an analysis report, and sending the analysis report to the project management platform. It can be seen that the present application implements static code analysis by using a project management platform and a DevOps platform. Project personnel only need to configure options and related parameters in the project management platform and trigger execution when the version is released. The parameters will be passed to the DevOps platform, and the DevOps platform will continue to pass the parameters to the configuration platform for real-time modification. Then different projects perform static code analysis according to the customized configuration. The whole process only requires the project personnel to input parameters in the early stage and trigger the version release process. The subsequent analysis and delivery backup are no longer manually operated. Static code analysis is completed automatically, which improves inspection efficiency, traceability of delivery items, and real-time monitoring of quality.

[0054] Based on the above embodiment, as a preferred embodiment, the project code stored in the local space is analyzed based on the modified configuration platform and code analysis platform, including:

[0055] Perform security compliance checks on project codes based on the modified configuration platform and code analysis platform;

[0056] If the project code meets the requirements of the corresponding security specifications, the analysis report is a first-class analysis report, and the first-class analysis report is sent to the project management platform;

[0057] If the project code does not meet the requirements of the corresponding security specifications, the analysis report will be a second-class analysis report, and the second-class analysis report will be sent to the project management platform and the alarm system will be triggered so that project personnel can repair the project code according to the second-class analysis report.

[0058] In a specific embodiment, before analyzing the project code, it is necessary to perform a security check on it to ensure that the project code itself is free of abnormalities in the security specification, so as to ensure the accuracy of subsequent analysis. Specifically, the security specification check on the project code includes: preprocessing the project code based on the modified configuration platform to obtain the target project code; performing file-by-file and line-by-line security specification checks on the target project code based on the code analysis platform; if any file or any line of code in the target project code meets the requirements corresponding to the security specification, then the target project code is judged to meet the requirements corresponding to the security specification; if any file or any line of code in the target project code does not meet the requirements corresponding to the security specification, then the target project code is judged to not meet the requirements corresponding to the security specification. Therefore, if the project code meets the requirements corresponding to the safety specifications, it means that the current project code has no abnormalities, and the analysis report is a first-class analysis report, and the first-class analysis report is sent to the project management platform. The main content of the first-class analysis report is the analysis conclusion on the quality of the current project code; if the project code does not meet the requirements corresponding to the safety specifications, it means that the current project code has abnormalities, and the analysis report is a second-class analysis report, and the second-class analysis report is sent to the project management platform, and the alarm system is triggered so that project personnel can repair the project code according to the second-class analysis report. The main content of the second-class analysis specification is the conclusion on which point in the current project code does not meet the safety specification detection.

[0059] In order to ensure the smoothness of the entire set of static code analysis methods of DevOps Platform 2, it also includes email triggering. When the static code analysis of DevOps Platform 2 is completed, the second type of report will detect an alarm, and the project-related personnel will be notified by email; or when DevOps Platform 2 has an execution exception, the report is not generated normally, and it is interrupted and exited in a certain step, then the tool maintenance personnel will be notified to repair it.

[0060] Among them, in addition to pushing two types of reports to the project management platform 1, the Devops platform 2 also pushes status feedback: it is specifically classified into three categories. The first category: there is an analysis report, and there are no alarms in the inspection, and the process inspection status feedback is normal; the second category: there is an analysis report, and there are alarms in the inspection, and the process inspection status feedback is normal; the third category: static code analysis fails, the inspection process is abnormal, and the status is abnormal. Feedback.

[0061] Among them, it is convenient for project personnel to view the quality analysis of project codes more intuitively. Therefore, as a preferred embodiment, it is also necessary to: perform statistical analysis on the project codes stored in the local space based on the modified configuration platform and code analysis platform to obtain statistical reports; send the statistical reports to the project management platform through the storage platform so that the project management platform can generate quality analysis charts based on the statistical reports and display them. Among them, the information written by DevOps platform 2 to the storage platform is the data statistics after analysis and processing, that is, the statistical report, and the statistical report specifically includes, for example, the number of high-level, medium-level, and low-level alarms for each file; then the storage platform will push this valid information to the quality monitoring module in the project management platform 1 for report display; among them, the storage platform is actually a database, a data management system, which stores the static code scanning results in the database after effective data analysis, mainly for quality analysis charts, and displays the historical trends of the number and level of alarms in different dimensions. According to the trends, the improvement of code quality can be seen; at the same time, storing valid information in the database can also make a comparison of the quality of different projects of the same customer in this dimension.

[0062] Therefore, it can be seen from the above-mentioned embodiments that, as shown in Figure 3, 3 is a storage platform. The complete process of the static code analysis method on the DevOps platform 2 side is: after obtaining the project code sent by the project management platform 1 and the relevant parameters corresponding to the project code, the static code analysis task of the specified project on the DevOps platform 2 is automatically triggered. The task is composed of a workflow (jenkins pipline), and the parameters are configured to the pipline at the same time. The specific steps of the pipline are: download the project code to the local storage space (workspace); use the preset tool to complete the modification of the configuration file of the static code checking tool Astree, mainly modifying the following information blacklist (blacklist), macro definition (defines), source file (files), header file (includes), rules (rules), check parameters (check mode). Among them, the preset tool can be the RuleCheck Config Editor tool, because the RuleCheck Config Editor tool will configure files and includes according to the blacklist delivered by the project management platform 1 and the difference set of files in the entire Source folder, and introduce the actual compiler header file path used in the project into includes; after the configuration modification is completed, the jenkins pipline script will call the Astree tool to start static code analysis of the project code. Among them, the tool analysis process is divided into Prerocess and Start Analysis. Among them, the tool built-in preprocessor will be used during Prerocess precompilation, and the above configuration will be used for precompilation; Start Analysis will check whether the code meets the security specifications configured in rules. The Astree tool will check the preprocessed code file by file and line by line. If there is a code that violates the security coding specification, an alarm will be issued. For the alarm that violates the embedded software coding standard (Motor Industry Software Reliability Association, MISRA), high, medium and low levels will be given. If a line of code violates multiple specifications, they will be listed one by one. After the analysis is completed, an HTML analysis report will be generated and stored in the workspace of the Jenkins pipline. The HTML analysis report is published to the Artifacts of Jenkins, and a self-developed Python script is used to extract data and generate an Excel data table report. Finally, the analysis report including HTML and Excel tables is uploaded to the project management platform 1 for delivery archiving. At the same time, the valid data is saved on the storage platform 3.The storage platform 3 retains the data of each version release, and pushes the data to the project management platform 1 in real time for quality analysis chart display. During the whole process, the execution status (success / failure) of the pipeline will be fed back to the project management platform 1; and according to the execution status of the pipeline, an email will be sent to the relevant personnel. If the execution fails, an email will be sent to the tool group, who will locate and solve the problem; if the execution is successful, an email will be sent to the project personnel, including the report link information, and the project personnel will repair the alarm. Finally, after the repair, the static code analysis will be triggered again.

[0063] It can be seen that this application implements static code analysis by using a project management platform and a DevOps platform. Project personnel only need to configure options and related parameters in the project management platform and trigger execution when the version is released. The parameters will be passed to the DevOps platform, and the DevOps platform will pass the parameters to the configuration platform for real-time modification. Then different projects will perform static code analysis according to the customized configuration. The entire process only requires project personnel to input parameters in the early stage and trigger the version release process. The subsequent analysis and backup of deliverables are no longer manually operated, and static code analysis is completed automatically, which improves inspection efficiency, traceability of deliverables, and real-time monitoring of quality.

[0064] On the other hand, a static code analysis method is applied to a project management platform, comprising the following steps:

[0065] Get the project code corresponding to the target project and the related parameters corresponding to the project code.

[0066] Send the project code and related parameters to the DevOps platform so that the DevOps platform can download the project code to the local storage space and modify the parameters in the configuration platform to the related parameters; analyze the project code stored in the local space based on the modified configuration platform and code analysis platform to obtain an analysis report.

[0067] Get analysis reports sent by the DevOps platform.

[0068] After obtaining the analysis report sent by the DevOps platform, it also includes:

[0069] Obtain statistical reports sent by the DevOps platform through the storage platform;

[0070] Generate quality analysis charts based on statistical reports and display them to intuitively judge the quality status of project codes.

[0071] Before obtaining the project code corresponding to the target project and the related parameters corresponding to the project code, it also includes:

[0072] Obtaining an original project code corresponding to the original project, and determining corresponding original related parameters according to the original project code; wherein the original related parameters include: blacklist parameters, security specification parameters, source file parameters, header file parameters and check mode parameters;

[0073] If the analysis signal and approval signal of the target project are received, the project requirements corresponding to the target project are obtained;

[0074] The original project code and original related parameters are modified based on project requirements to obtain the project code and related parameters.

[0075] In a specific embodiment, as shown in FIG4 , the project management platform 1 supports project1 (project 1)…projectn (project n), which represents that the project management platform 1 is isolated and managed according to the project number. Each project has multiple functions, including parameter configuration functions, which are provided for downstream platform processing tasks, including project code path, blacklist, defines, rules, check mode, etc. The configuration can be modified according to demand changes. In the early stage, the project leader will perform initial basic configuration management according to the customer demand document and the company's project management specifications in the project management platform 1. If there are configuration changes, the development engineer will propose a change process, and the project leader will approve and merge it into the basic configuration, otherwise the process will be returned. If the configuration is modified after the version release process has been submitted, as long as it is before the unit test static code analysis flow node, the latest configuration will be used for static code analysis.

[0076] Among them, some embodiments of the static code analysis method applied to the project management platform provided in this application are the same as the embodiments of the static code analysis method applied to the DevOps platform mentioned above, so this application will not repeat them here.

[0077] The static code analysis method provided in this application is applied to the project management platform, including: obtaining the project code corresponding to the target project and the relevant parameters corresponding to the project code; sending the project code and the relevant parameters to the DevOps platform so that the DevOps platform can download the project code to the local storage space and modify the parameters in the configuration platform to the relevant parameters; analyzing the project code stored in the local space based on the modified configuration platform and code analysis platform to obtain an analysis report. It can be seen that this application realizes static code analysis by using the project management platform and the DevOps platform. The project personnel only need to configure the options and relevant parameters in the project management platform and trigger the execution when the version is released. The parameters will be passed to the DevOps platform, and the DevOps platform will continue to pass the parameters to the configuration platform for real-time modification. Then different projects perform static code analysis according to the customized configuration. The whole process only requires the project personnel to input the parameters in the early stage and trigger the version release process. The subsequent analysis and delivery backup are no longer manually operated. Static code analysis is completed automatically, which improves the inspection efficiency, the delivery is traceable, and the quality can be monitored in real time.

[0078] FIG5 is a structural diagram of an electronic device provided by another embodiment of the present application. As shown in FIG5 , the electronic device includes: a memory 50 for storing a computer program;

[0079] The processor 51 is used to implement the steps of the static code analysis method mentioned in the above embodiment when executing a computer program.

[0080] The electronic device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer.

[0081] Among them, the processor 51 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 51 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 51 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 51 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 51 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0082] The memory 50 may include one or more computer-readable storage media, which may be non-transitory. The memory 50 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 50 is at least used to store the following computer program 501, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the static code analysis method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 50 may also include an operating system 502 and data 503, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 502 may include Windows, Unix, Linux, etc.

[0083] In some embodiments, the electronic device may further include a display screen 52 , an input / output interface 53 , a communication interface 54 , a power supply 55 , and a communication bus 56 .

[0084] Those skilled in the art will appreciate that the structure shown in FIG. 5 does not limit the electronic device and may include more or fewer components than those shown in the figure.

[0085] The electronic device provided in an embodiment of the present application includes a memory and a processor. When the processor executes a program stored in the memory, it can implement the above-mentioned static code analysis method and have the same beneficial effects.

[0086] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps recorded in the above method embodiment (which may be a method corresponding to the DevOps platform side, or a method corresponding to the DevOps platform side, or a method corresponding to both the DevOps platform side and the DevOps platform side) are implemented.

[0087] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0088] The above is a detailed introduction to a static code analysis method, electronic device and medium provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can refer to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can refer to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

[0089] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A static code analysis method, characterized in that: Applicable to DevOps platforms including configuration platforms and code analysis platforms, including: Obtain the project code sent by the project management platform and related parameters corresponding to the project code; Downloading the project code to a local storage space, and modifying the parameters in the configuration platform to the relevant parameters; The project code stored in the local space is analyzed based on the modified configuration platform and the code analysis platform to obtain an analysis report, and the analysis report is sent to the project management platform.

2. The static code analysis method according to claim 1, characterized in that: The analyzing the project code stored in the local space based on the modified configuration platform and the code analysis platform includes: Performing security specification detection on the project code based on the modified configuration platform and the code analysis platform; If the project code meets the requirements corresponding to the security specification, the analysis report is a first-category analysis report, and the first-category analysis report is sent to the project management platform; If the project code does not meet the requirements corresponding to the security specifications, the analysis report is a second type of analysis report, and the second type of analysis report is sent to the project management platform, and the alarm system is triggered so that project personnel can repair the project code according to the second type of analysis report.

3. The static code analysis method according to claim 2, characterized in that: The performing security specification detection on the project code based on the modified configuration platform and the code analysis platform includes: Preprocessing the project code based on the modified configuration platform to obtain a target project code; Based on the code analysis platform, the security specification detection is performed on the target project code file by file and line by line; If any file or any line of code in the target project code meets the requirements corresponding to the security specification, then it is determined that the target project code meets the requirements corresponding to the security specification; If any file or any line of code in the target project code does not meet the requirements corresponding to the security specification, it is determined that the target project code does not meet the requirements corresponding to the security specification.

4. The static code analysis method according to claim 1, characterized in that: Also includes: Performing statistical analysis on the project code stored in the local space based on the modified configuration platform and the code analysis platform to obtain a statistical report; The statistical report is sent to the project management platform via the storage platform so that the project management platform can generate a quality analysis chart based on the statistical report and display it.

5. The static code analysis method according to any one of claims 1 to 4, characterized in that: The analysis report includes hypertext markup language and excel table.

6. A static code analysis method, characterized in that: Applied to project management platforms, including: Obtain the project code corresponding to the target project and related parameters corresponding to the project code; Sending the project code and the related parameters to the DevOps platform so that the DevOps platform downloads the project code to a local storage space and modifies the parameters in the configuration platform to the related parameters; analyzing the project code stored in the local space based on the modified configuration platform and the code analysis platform to obtain the analysis report; Obtain an analysis report sent by the DevOps platform.

7. The static code analysis method according to claim 6, characterized in that: After obtaining the analysis report sent by the DevOps platform, it also includes: Obtaining a statistical report sent by the DevOps platform via a storage platform; A quality analysis chart is generated based on the statistical report and displayed to intuitively determine the quality status of the project code.

8. The static code analysis method according to claim 6 or 7, characterized in that: Before obtaining the project code corresponding to the target project and the related parameters corresponding to the project code, the following steps are included: Obtaining an original project code corresponding to the original project, and determining corresponding original related parameters according to the original project code; wherein the original related parameters include: blacklist parameters, security specification parameters, source file parameters, header file parameters and check mode parameters; If an analysis signal and a review approval signal of the target project are received, then the project requirements corresponding to the target project are obtained; The original project code and the original related parameters are modified based on the project requirements to obtain the project code and the related parameters.

9. An electronic device, characterized in that: comprising a memory for storing a computer program; A processor, configured to implement the steps of the static code analysis method as described in any one of claims 1 to 5 or 6 to 8 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the static code analysis method according to any one of claims 1 to 5 or 6 to 8 are implemented.