Method and device for generating static inspection project

By determining the project path and processing the content of Excel and xml files, a new project that adapts to the code needs to be checked is solved, and the problem of time-consuming and frequent communication of static inspection tool configuration in embedded software development is achieved, and efficient static inspection and clear Responsibility allocation improves development efficiency and traceability.

CN119128216APending Publication Date: 2024-12-13SINO TRUK JINAN POWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411292084.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

在嵌入式软件开发中,静态检查工具的配置过程耗费大量时间,导致设计与测试之间的沟通频繁且测试人员工作过于重复冗余,且现有平台化方式追溯性差且成本高。

Method used

By determining the project path and code location, reading and processing Excel tables and xml file contents, a static check project is generated, including modification of configuration collections and processing of header files, forming new projects that need to be checked, and reducing developers' learning and testing tools time and reduce ineffective communication.

Benefits of technology

It reduces developers' time investment in testing, clarifies problem responsibilities, reliable design principles, simple structure, wide application prospects, and improves the efficiency and traceability of static inspections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119128216A_ABST
    Figure CN119128216A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of software development, and particularly provides a static check project generation method and device, and the method comprises the following steps: reading Excel table content under a project directory and processing the Excel table content into a configuration set, reading the content of a configuration xml file under a project, and modifying or adding the content of the configuration set according to a format; when trigger information of a project name button is detected, reading a modified project name, and modifying related contents according to formats by reading all xml files related to the project name under the project; the method comprises the following steps: reading Excel table content under an engineering directory, respectively processing content related to the type and size of a metric unit into a configuration set, reading the content of an engineering metric unit configuration xml file, and modifying or adding the content of the configuration set according to a format; and when the trigger information of the generation project button is detected, generating a static inspection project. The time consumed by developers on testing is shortened, and communication between invalid testers and developers is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to a method and device for generating a static inspection project. Background Art

[0002] In the process of embedded software development, static checking tools are used for static testing of handwritten code or MATLAB generated code. As a testing tool, not all personnel need to have a set, which is a waste of equipment resources. However, with the increasing complexity of embedded software structure and the increasing importance of software security issues, static checking has become particularly important. Therefore, how to use limited static checking tools to efficiently and orderly complete static testing has become a technical problem that needs to be solved.

[0003] The process of static checking is to convert the model or handwritten C code and H code into a static checking project executable by the static checking tool after configuration, and then the static checking tool performs the check on the code. Due to the diversity of the code, the implementation of the configuration process has become a direction that can be optimized. Some existing technical solutions adopt the workstation method, that is, the test tool is installed on one computer and other personnel take turns to use it. In this way, software code developers are not familiar with static checking tools, which will consume a lot of learning time and occupy the valuable development time of developers, and the time for everyone to use static checking tools for configuration will conflict. There is also a method of using a separate tester, but when the static checking project is established, some configuration items need to be configured, including header files, macro definitions, and style options. To complete these configurations, a lot of time will be spent on communication between design and testing, and the work of testers is too repetitive and redundant. There is also a platform-based approach, but most of them adopt a completely platform-based approach, completing the configuration process through a packaged platform, so it is not easy to trace after a problem occurs, and such a static checking project is a process product, not very concrete, and the platformization cost is high. Summary of the invention

[0004] In order to solve the problem that a lot of time is spent on communication between design and testing when establishing a static inspection project, and the work of testers is too repetitive and redundant, the technical solution of the present invention provides a method and device for generating a static inspection project.

[0005] In a first aspect, the technical solution of the present invention provides a method for generating a static inspection project, comprising the following steps: Determine the project path and the location of the project in the computer; Read the contents of the Excel table in the project directory and process it into a configuration set, read the contents of the configuration XML file in the project, and modify or add the contents of the configuration set according to the format; When the trigger information of the project name button is detected, the modified project name is read, and the relevant content is modified according to the format by reading all XML files related to the project name under the project; Read the Excel table content in the project directory, process the metric type and size-related content into configuration sets, read the content of the project metric configuration xml file, and modify or add the configuration set content according to the format; When the trigger information of the Generate Project button is detected, the directory location of the header file is captured, the relative position of the header file is processed into a set according to the format, the content of the header file configuration XML file under the project is read, the content of the set is modified or added according to the format, and a static inspection project is generated.

[0006] As a further limitation of the technical solution of the present invention, the step of determining the project path and the location of the project in the computer includes: Selecting a blank project through the project selection box triggers the callback function of the project selection box to drive the path positioning function, open a modal dialog box that displays the folders in the current working directory, and return the path selected by the user from the dialog box to form a string project path; At the same time, determine the location of the code in the computer and add / src after the project path to form a code path string.

[0007] As a further limitation of the technical solution of the present invention, the steps of reading the content of the Excel table in the project directory and processing it into a configuration set, reading the content of the configuration XML file in the project, and modifying or adding the content of the configuration set according to the format include: Get the location of excel configured by the named program config through the code path string, and open the Excel file through the OpenFile function.

[0008] As a further limitation of the technical solution of the present invention, the content of the Excel table under the project directory includes macro definition related content and style related content.

[0009] As a further limitation of the technical solution of the present invention, the steps of reading the contents of an Excel table in a project directory and processing it into a configuration set, reading the contents of a configuration XML file in a project, and modifying or adding the contents of the configuration set according to a format include: Read the Excel table content in the project directory, process the macro definition related content into a configuration set, read the content of the macro definition configuration xml file in the project, and modify or add the configuration set content according to the format; Read the Excel table content in the project directory, process the style-related content into a configuration set, read the content of the style configuration XML file in the project, and modify or add the configuration set content according to the format.

[0010] As a further limitation of the technical solution of the present invention, the steps of reading the content of the Excel table in the project directory, processing the macro definition related content into a configuration set, reading the content of the macro definition configuration xml file in the project, and modifying or adding the content of the configuration set according to the format include: Through keyword search, read the Excel table contents in the project directory one by one. If the macro definition word is found, copy the macro definition content text to the software workspace, then enter different cases through switch case, replace the macro definition content, and then read the next macro definition content. After the macro definition is processed, process the setting warning of the calling function, complete the reading of the configuration Excel content in sequence, and write it to the workspace.

[0011] Through keyword search, read the content of the macro definition configuration xml file under the project, and write the macro definition content string in the workspace line by line according to the fixed format of the xml file through the write function. After the macro definition is processed, the setting warning of the calling function is processed, and the text in the workspace is written to the xml file in sequence.

[0012] As a further limitation of the technical solution of the present invention, when the trigger information of the project name button is detected, the modified project name is read, and the steps of modifying the relevant content in a format by reading all XML files related to the project name under the project include: After detecting the trigger information of the project name button, start the callback function of the project name button, take the project path string as a parameter, and read the modified project name through the dir function; Read all xml files related to the project name under the project, modify the file content according to the format, and replace the old project name with the new project name.

[0013] As a further limitation of the technical solution of the present invention, the steps of reading the Excel table content in the project directory, processing the type and size-related contents of the measurement element into configuration sets respectively, reading the contents of the engineering measurement element configuration xml file, and modifying or adding the contents of the configuration set according to the format include: Get the location of the threshold measurement element excel through the code path string, and open the Excel file through the OpenFile function; Search by keywords and read the Excel table contents in the project directory one by one. If the word STCBO is found, copy the STCBO text to the software workspace, then enter different cases through switch case, replace it with STCBO, read the next STCBO content, and after STCBO is processed, process STMIF, and complete the reading of the metric Excel content in sequence and write it to the workspace; Through keyword search, read the content of the metric xml file under the project, and write the STCBO size string in the workspace row by row through the write function according to the fixed format of the xml file. After STCBO is processed, STMIF is processed again, and the text in the workspace is written into the metric xml file in sequence.

[0014] As a further limitation of the technical solution of the present invention, when the trigger information of the generate project button is detected, the directory location of the header file is captured, the relative position of the header file is processed into a set according to the format, the content of the header file configuration xml file under the project is read, and the content of the set is modified or added according to the format. The steps of generating a static inspection project include: When the trigger information of the Generate Project button is detected, the callback function of the Generate Project button is started, and the positions of all H files are listed in rows by driving the Dir library function and loop detection to form multiple H file path strings. The project path string in front of the H file path string is replaced with the generated file relative path string by the replacement function; Through keyword search, read the content of the H file xml file under the project, and write the file relative path string line by line according to the fixed format of the xml file through the write function, complete the writing of the H text in the H file xml file in sequence, and generate a static inspection project.

[0015] In a second aspect, the technical solution of the present invention provides a device for generating a static inspection project, including a path location determination module, a project configuration processing module, a project name processing module, a metric configuration processing module and a static inspection project generation module; A path location determination module is used to determine the project path and the location of the project in the computer; The project configuration processing module is used to read the contents of the Excel table in the project directory and process it into a configuration set, read the contents of the configuration XML file under the project, and modify or add the contents of the configuration set according to the format; The project name processing module is used to read the modified project name when the trigger information of the project name button is detected, and modify the relevant content according to the format by reading all XML files related to the project name under the project; The measurement element configuration processing module is used to read the Excel table content in the project directory, process the measurement element type and size related content into configuration sets respectively, read the content of the project measurement element configuration xml file, and modify or add the configuration set content according to the format; The static inspection project generation module is used to capture the directory location of the header file when the trigger information of the generate project button is detected, process the relative position of the header file into a set according to the format, read the content of the header file configuration XML file under the project, modify or add the content of the set according to the format, and generate a static inspection project.

[0016] As a further limitation of the technical solution of the present invention, the path location determination module is specifically used to trigger the callback function of the project selection box by selecting a blank project through the project selection box to drive the path positioning function, open a modal dialog box displaying the folders in the current working directory, and return the path selected by the user from the dialog box to form a string project path; at the same time, the location of the code in the computer is determined, and / src is added after the project path to form a code path string.

[0017] As a further limitation of the technical solution of the present invention, the engineering configuration processing module is also used to obtain the location of the excel configuration file named config through the code path string, and open the Excel file through the OpenFile function.

[0018] As a further limitation of the technical solution of the present invention, the project configuration processing module is used to read the content of the Excel table under the project directory, process the macro definition related content into a configuration set, read the content of the macro definition configuration xml file under the project, and modify or add the content of the configuration set according to the format; read the content of the Excel table under the project directory, process the style related content into a configuration set, read the content of the style configuration xml file under the project, and modify or add the content of the configuration set according to the format.

[0019] As a further limitation of the technical solution of the present invention, the project configuration processing module is specifically used to search through keywords and read the contents of the Excel table under the project directory one by one. If the macro definition word is found, the macro definition content text is copied to the software workspace, and then different cases are entered through switch case to replace the macro definition content, and then the next macro definition content is read. After the macro definition is processed, the setting warning of the calling function is processed, and the reading of the configuration Excel content is completed in sequence and written into the workspace; through keyword search, the content of the macro definition configuration xml file under the project is read, and according to the fixed format of the xml file, the macro definition content string in the workspace is written one by one by line through the writing function. After the macro definition is processed, the setting warning of the calling function is processed, and the writing of the text in the workspace into the xml file is completed in sequence.

[0020] As a further limitation of the technical solution of the present invention, the project name processing module is specifically used to start the callback function of the project name button after detecting the trigger information of the project name button, taking the project path string as a parameter, and reading the modified project name through the dir function; reading all xml files related to the project name under the project, modifying the file content according to the format, and replacing the old project name with the new project name.

[0021] As a further limitation of the technical solution of the present invention, the metric element configuration processing module is specifically used to obtain the location of the threshold metric element excel through the code path string, and open the Excel file through the OpenFile function; through keyword search, read the Excel table contents in the project directory one by one, if the word STCBO is found, copy the STCBO text to the software workspace, and then enter different cases through switch case, replace it with STCBO, read the next STCBO content, after STCBO is processed, process STMIF, complete the reading of the metric element Excel content in turn, and write it into the workspace; through keyword search, read the content of the metric element xml file under the project, according to the fixed format of the xml file, write the STCBO size string in the workspace row by row through the write function, after STCBO is processed, process STMIF, and complete the writing of the text in the workspace in the metric element xml file in turn.

[0022] As a further limitation of the technical solution of the present invention, the static inspection project generation module is specifically used to start the callback function of the generate project button when the trigger information of the generate project button is detected, and the positions of all H files are listed by line by driving the Dir library function and loop detection to form multiple H file path strings, and the project path string in front of the H file path string is replaced by the generated file relative path string through the replacement function; through keyword search, the content of the H file xml file under the project is read, and according to the fixed format of the xml file, the file relative path string is written one by one by line through the write function, and the writing of the H text in the H file xml file is completed in sequence to generate a static inspection project.

[0023] It can be seen from the above technical solution that the present invention has the following advantages: the configuration related to the code to be checked is written into a blank project, and a new project adapted to the code to be checked is generated. The generated new project can be handed over to testers or platforms for inspection later, reducing the time spent by developers on testing, eliminating the need for developers to learn testing tools, reducing ineffective communication between testers and developers, and clarifying responsibility for problems.

[0024] In addition, the invention has a reliable design principle, a simple structure and a very broad application prospect. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0026] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention.

[0027] Figure 2 It is a logical flow diagram of the method implementation of the embodiment of the present invention.

[0028] Figure 3 It is a schematic diagram of a method for using a device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0030] like Figure 1 As shown, an embodiment of the present invention provides a method for generating a static inspection project, comprising the following steps: S1: Determine the project path and the location of the project in the computer; In this step, the callback function of the project selection box is triggered by selecting a blank project through the project selection box to drive the path positioning function, open a modal dialog box that displays the folders in the current working directory, and return the path selected by the user from the dialog box to form a string project path; At the same time, determine the location of the code in the computer and add / src after the project path to form a code path string.

[0031] S2: Read the Excel table content in the project directory and process it into a configuration set, read the content of the configuration XML file in the project, and modify or add the configuration set content according to the format; This step includes: reading the contents of the Excel table in the project directory and processing it into a configuration set, reading the contents of the configuration XML file in the project, and modifying or adding the contents of the configuration set according to the format. The steps include: Read the Excel table content in the project directory, process the macro definition related content into a configuration set, read the content of the macro definition configuration xml file in the project, and modify or add the configuration set content according to the format; Read the Excel table content in the project directory, process the style-related content into a configuration set, read the content of the style configuration XML file in the project, and modify or add the configuration set content according to the format.

[0032] Specifically, the location of the excel configuration file named config is obtained through the code path string, and the Excel file is opened through the OpenFile function.

[0033] Through keyword search, read the Excel table contents in the project directory one by one. If the macro definition word is found, copy the macro definition content text to the software workspace, then enter different cases through switch case, replace the macro definition content, and then read the next macro definition content. After the macro definition is processed, process the setting warning of the calling function, complete the reading of the configuration Excel content in sequence, and write it to the workspace.

[0034] Through keyword search, read the content of the macro definition configuration xml file under the project, and write the macro definition content string in the workspace line by line according to the fixed format of the xml file through the write function. After the macro definition is processed, the setting warning of the calling function is processed, and the text in the workspace is written to the xml file in sequence.

[0035] S3: When the trigger information of the project name button is detected, the modified project name is read, and the relevant content is modified according to the format by reading all the XML files related to the project name under the project; Specifically, after detecting the trigger information of the project name button, the callback function of the project name button is started, the project path string is used as a parameter, and the modified project name is read through the dir function; Read all xml files related to the project name under the project, modify the file content according to the format, and replace the old project name with the new project name.

[0036] S4: Read the Excel table content in the project directory, process the measurement element type and size related content into configuration sets respectively, read the content of the project measurement element configuration xml file, and modify or add the configuration set content according to the format; It should be noted that in this step, the location of the threshold metric excel is obtained through the code path string, and the Excel file is opened through the OpenFile function; Search by keywords and read the Excel table contents in the project directory one by one. If the word STCBO is found, copy the STCBO text to the software workspace, then enter different cases through switch case, replace it with STCBO, read the next STCBO content, and after STCBO is processed, process STMIF, and complete the reading of the metric Excel content in sequence and write it to the workspace; Through keyword search, read the content of the metric xml file under the project, and write the STCBO size string in the workspace row by row through the write function according to the fixed format of the xml file. After STCBO is processed, STMIF is processed again, and the text in the workspace is written into the metric xml file in sequence.

[0037] S5: When the trigger information of the Generate Project button is detected, the directory location of the header file is captured, the relative position of the header file is processed into a set according to the format, the content of the header file configuration XML file under the project is read, the content of the set is modified or added according to the format, and a static inspection project is generated.

[0038] It should be further explained that when the trigger information of the Generate Project button is detected, the callback function of the Generate Project button is started, and the positions of all H files are listed in rows by driving the Dir library function and loop detection to form multiple H file path strings, and the project path string in front of the H file path string is replaced by the generated file relative path string through the replacement function; Through keyword search, read the content of the H file xml file under the project, and write the file relative path string line by line according to the fixed format of the xml file through the write function, complete the writing of the H text in the H file xml file in sequence, and generate a static inspection project.

[0039] The embodiment of the present invention also provides a method for generating a static inspection project, which realizes the logic as follows Figure 2 As shown: Step 1. When the user selects a blank project through the project selection box, the callback function of the project selection box can be triggered. The callback function drives the path positioning function. The path positioning function can open a modal dialog box, display the folders in the current working directory and return the path selected by the user from the dialog box. In this way, the location of the project in the computer can be determined through the path positioning function, and a string "project path" can be formed for subsequent use.

[0040] Step 2. At the same time, due to the fixed settings of the project, the code will be placed in the src folder under the project directory subdirectory. This can also determine the location of the code in the computer, and add " / src" after the project path to form a "code path" string for subsequent use.

[0041] Step 3. Due to the diversity of codes, the macro definition of the code, the setting warning of calling functions, the code style, the suppression of header file output without influence and other configurations are all different. In this way, the user needs to fill these contents into the configuration Excel cell named config, such as filling in the macro definition: "macro definition content".

[0042] Step 4. The configuration excel file named config and the code are placed in the src folder of the project. Through the "code path" string in step 2, the location of the configuration excel file named config is obtained, and then the excel file can be opened through the OpenFile function to read the relevant content. The OpenFile function can open a file for editing through two parameters: the file path and the file name.

[0043] Step 5. Search by keywords and read the Excel table contents in the project directory one by one. If the macro definition word is found, copy the macro definition: "macro definition content" text to the software workspace, and then enter different cases through switch case, replace it with -d: "macro definition content", wrap, and then read the next macro definition content. After the macro definition is processed, process the setting warning of the calling function, so as to complete the reading of the configuration Excel content in sequence and write it to the workspace.

[0044] Step 6. The location of the configuration xml file in the project is fixed. The file can be opened and edited in the same way as in step 4. The content of the macro definition configuration xml file under the project can be read by keyword search. For example, the macro definition part is processed first. According to the fixed format of the xml file, the "macro definition content" string in the workspace of step 5 is written line by line by writing functions, and other characters required by the format are added, such as equal signs, commas, semicolons, etc. After the macro definition is processed, the setting warning of the calling function is processed, and the text in the workspace is written into the xml file in sequence.

[0045] Step 7. Detect the triggering of the project name button, start the callback function of the project name button, take the "project path" string of step 1 as a parameter, and read the modified project name through the dir function. All xml files related to the project name under the project, including system and configuration ones, are fixed in the project. The same method as step 6, read all xml files related to the project name under the project, modify the file content according to the format, and replace the old project name with the new project name, so that the subsequent static inspection software can recognize the new project name, use the new project name to complete the static inspection work, and the inspection report name will be modified accordingly.

[0046] Step 8. Due to the diversity of codes and different controllers, the requirements for code complexity are also different, which leads to different types and sizes of metrics. In this way, users need to fill these contents into the configuration Excel cell named threshold. For example, fill in STCBO (coupling with other classes): "25". STCBO is a type of metric, and 25 is the set threshold size.

[0047] Step 9. The metric excel named threshold and the code are placed in the src folder of the project. Same as step 4, the location of the metric excel named threshold is obtained through the "code path" string in step 2, and then the OpenFile function can be used to open the excel to read the relevant content. The OpenFile function can open the file for editing through the two parameters of file path and file name.

[0048] Step 10. Same as step 5. Search by keywords and read the contents of the Excel table in the project directory one by one. If the word STCBO is found, copy the text STCBO (coupling with other classes): "25" to the workspace, and then enter different cases through switch case, replace it with STCBO: 25, wrap, and then read the next STCBO content. After STCBO is processed, process STMIF, and thus complete the reading of the metric Excel content in sequence and write it to the workspace.

[0049] Step 11. Same as step 6, the location of the metric xml file in the project is fixed. The method in step 4 can open the file and edit it. By searching by keywords, read the content of the metric xml file under the project. For example, first process the STCBO part, and write the "STCBO size" string in the workspace of step 10 by line according to the fixed format of the xml file through the write function, and add other characters required by the format, such as equal sign, comma, semicolon, etc. After STCBO is processed, process STMIF, and then complete the writing of the text in the workspace into the metric xml file in sequence, so that the metric setting of the entire project is completed.

[0050] Step 12. The triggering of the Generate Project button is detected, and the callback function of the Generate Project button is started. By driving the Dir library function and loop detection, the location of all H files can be listed by line to form multiple "H file path" strings. Since the subsequent static inspection is not performed on the designer's computer, the project path will change, so the "project path" string in step 1 needs to be replaced with the "${SOURCE_ROOT}" string. After generating multiple "H file path" strings, process them one by one, and replace the "project path" string in front of the "H file path" string through the replacement function, so that it can be written into the xml file.

[0051] Step 13. Same as step 6, the location of the H file xml file in the project is fixed. The method in step 4 can open the file and edit it. By searching by keywords, read the content of the H file xml file under the project. According to the fixed format of the xml file, write the "${SOURCE_ROOT}\H file relative path" string processed in step 12 line by line through the write function, and add other characters required by the format, such as equal sign, comma, semicolon, etc. In this way, the H file text is written into the H file xml file in sequence, and the H file is partially processed.

[0052] Step 14. A project that can be directly statically checked is generated, and the project configuration part is all done. Then the generated project can be passed to the platform or tester who specializes in static checking. The platform or tester can sort out and complete the subsequent static checking work, including executing the check and determining errors, without communicating with the developer.

[0053] In the method provided by the present invention: 1. Configuration work can be completed without using a test tool, and a project adapted to the code to be tested is generated, which saves tool resources and saves time for ineffective communication between developers and testers, and saves a lot of manpower and material resources; 2. It can be integrated into MTALAB or an exe file, which is convenient and fast to use and has strong applicability. For people familiar with MATLAB, it is integrated into the software and only needs an API to call the software; 3. A complete project is generated before static inspection, rather than a process product. The project is generated without occupying the tool. If problems occur in the subsequent static inspection, the traceability is strong, the solution efficiency is greatly improved, and both local software static inspection and platform static inspection can be performed; 4. The visual interface is relatively intuitive, simple to operate, easy to promote, and can be quickly used to help developers quickly understand and solve problems; 5. In view of the need to modify the project name and metric, function expansion is carried out, with multiple options to meet the various needs of users; 6. The time cost of designers learning tools is reduced, and the configuration of the project can be completed by simply operating the software.

[0054] The embodiment of the present invention provides a device for generating a static inspection project, including a path location determination module, a project configuration processing module, a project name processing module, a metric configuration processing module and a static inspection project generation module; A path location determination module is used to determine the project path and the location of the project in the computer; The project configuration processing module is used to read the contents of the Excel table in the project directory and process it into a configuration set, read the contents of the configuration XML file under the project, and modify or add the contents of the configuration set according to the format; The project name processing module is used to read the modified project name when the trigger information of the project name button is detected, and modify the relevant content according to the format by reading all XML files related to the project name under the project; The measurement element configuration processing module is used to read the Excel table content in the project directory, process the measurement element type and size related content into configuration sets respectively, read the content of the project measurement element configuration xml file, and modify or add the configuration set content according to the format; The static inspection project generation module is used to capture the directory location of the header file when the trigger information of the generate project button is detected, process the relative position of the header file into a set according to the format, read the content of the header file configuration XML file under the project, modify or add the content of the set according to the format, and generate a static inspection project.

[0055] The path location determination module is specifically used to select a blank project through the project selection box to trigger the callback function of the project selection box to drive the path positioning function, open a modal dialog box that displays the folders in the current working directory, and return the path selected by the user from the dialog box to form a string project path; at the same time, the location of the code in the computer is determined, and / src is added after the project path to form a code path string.

[0056] The project configuration processing module is also used to obtain the location of the excel configuration file named config through the code path string, and open the Excel file through the OpenFile function.

[0057] In some embodiments, the project configuration processing module is used to read the contents of the Excel table under the project directory, process the macro definition-related contents into a configuration set, read the contents of the macro definition configuration xml file under the project, and modify or add the contents of the configuration set according to the format; read the contents of the Excel table under the project directory, process the style-related contents into a configuration set, read the contents of the style configuration xml file under the project, and modify or add the contents of the configuration set according to the format.

[0058] In some embodiments, the project configuration processing module is specifically used to search through keywords and read the contents of the Excel table under the project directory one by one. If the macro definition word is found, the macro definition content text is copied to the software workspace, and then different cases are entered through switch case to replace the macro definition content, and then the next macro definition content is read. After the macro definition is processed, the setting warning of the calling function is processed, and the reading of the configuration Excel content is completed in sequence and written into the workspace; through keyword search, the content of the macro definition configuration xml file under the project is read, and according to the fixed format of the xml file, the macro definition content string in the workspace is written one by one by line through the write function. After the macro definition is processed, the setting warning of the calling function is processed, and the writing of the text in the workspace into the xml file is completed in sequence.

[0059] In some embodiments, the project name processing module is specifically used to start the callback function of the project name button after detecting the trigger information of the project name button, taking the project path string as a parameter, and reading the modified project name through the dir function; reading all xml files related to the project name under the project, modifying the file content according to the format, and replacing the old project name with the new project name.

[0060] In some embodiments, the metric configuration processing module is specifically used to obtain the location of the threshold metric excel file through the code path string, and open the Excel file through the OpenFile function; through keyword search, read the Excel table contents in the project directory one by one, if the word STCBO is found, copy the STCBO text to the software workspace, and then enter different cases through switch case, replace it with STCBO, read the next STCBO content, after STCBO is processed, process STMIF, complete the reading of the metric Excel content in sequence, and write it into the workspace; through keyword search, read the content of the metric xml file under the project, according to the fixed format of the xml file, write the STCBO size string in the workspace row by row through the write function, after STCBO is processed, process STMIF, and complete the writing of the text in the workspace in the metric xml file in sequence.

[0061] In some embodiments, the static inspection project generation module is specifically used to start the callback function of the generate project button when the trigger information of the generate project button is detected, and the locations of all H files are listed in lines by driving the Dir library function and loop detection to form multiple H file path strings, and the project path string in front of the H file path string is replaced with the generated file relative path string through the replacement function; through keyword search, the content of the H file xml file under the project is read, and according to the fixed format of the xml file, the file relative path string is written one by one by line through the write function, and the writing of the H text in the H file xml file is completed in sequence to generate a static inspection project.

[0062] The specific usage of the device is as follows: Figure 3 As shown: 1. Copy the code and header files to be checked to a blank project directory file, and fill in the configuration items such as macro definition and style into the Excel table.

[0063] 2. Select the blank project in the project code selection box and click the Generate Project button to generate the basic project.

[0064] 3. To modify the project name, first change the project name to what you need, then click the "Project Name" button on the software, and you can use the new name for static checking.

[0065] 4. Modify the type and size requirements of the measurement element, write the type and size into the Excel table according to the format, click the "Measurement Element" button on the software, and the new measurement element information will be written into the project.

[0066] The software of the present invention can be integrated into MATLAB. When checking the code generated by MATLAB, it is more convenient and quick. Only one API is needed. For handwritten code, exe or bat can also be used to implement the corresponding function, which is highly selective. When the software code developer has code to check, he only needs to copy the code into the blank inspection project directory. The code developer does not need to use static inspection tools. Through the software device of the present invention, the configuration related to the code to be checked can be written into the blank project, and a new project adapted to the code to be checked can be generated. The generated new project can be handed over to the tester or platform for inspection without any further processing.

[0067] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0068] An embodiment of a device for generating a static inspection project provided in an embodiment of the present invention belongs to the same inventive concept as the method for generating a static inspection project in the above-mentioned embodiments. For details not described in detail in the embodiment of the device for generating a static inspection project, reference can be made to the embodiment of the method for generating a static inspection project in the above-mentioned embodiments.

[0069] Although the present invention has been described in detail with reference to the accompanying drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, a person of ordinary skill in the art may make various equivalent modifications or substitutions to the embodiments of the present invention, and these modifications or substitutions shall be within the scope of the present invention. Any person of ordinary skill in the art may easily think of changes or substitutions within the technical scope disclosed by the present invention, and these shall be within the scope of protection of the present invention.

Claims

1. A method for generating a static inspection project, characterized in that: The steps include: Determine the project path and the location of the project in the computer; Read the contents of the Excel table in the project directory and process it into a configuration set, read the contents of the configuration XML file in the project, and modify or add the contents of the configuration set according to the format; When the trigger information of the project name button is detected, the modified project name is read, and the relevant content is modified according to the format by reading all XML files related to the project name under the project; Read the Excel table content in the project directory, process the metric type and size-related content into configuration sets, read the content of the project metric configuration xml file, and modify or add the configuration set content according to the format; When the trigger information of the Generate Project button is detected, the directory location of the header file is captured, the relative position of the header file is processed into a set according to the format, the content of the header file configuration XML file under the project is read, the content of the set is modified or added according to the format, and a static inspection project is generated.

2. The method for generating a static inspection project according to claim 1, characterized in that: The steps to determine the project path and the location of the project on the computer include: Selecting a blank project through the project selection box triggers the callback function of the project selection box to drive the path positioning function, open a modal dialog box that displays the folders in the current working directory, and return the path selected by the user from the dialog box to form a string project path; At the same time, determine the location of the code in the computer and add / src after the project path to form a code path string.

3. The method for generating a static inspection project according to claim 2, characterized in that: Read the contents of the Excel table in the project directory and process it into a configuration set, read the contents of the configuration XML file in the project, and modify or add the contents of the configuration set according to the format, including: Get the location of excel configured by the named program config through the code path string, and open the Excel file through the OpenFile function.

4. The method for generating a static inspection project according to claim 3, characterized in that: The Excel table contents under the project directory include macro definition related contents and style related contents.

5. The method for generating a static inspection project according to claim 4, characterized in that: Read the contents of the Excel table in the project directory and process it into a configuration set, read the contents of the configuration XML file in the project, and modify or add the contents of the configuration set according to the format. The steps include: Read the Excel table content in the project directory, process the macro definition related content into a configuration set, read the content of the macro definition configuration xml file in the project, and modify or add the configuration set content according to the format; Read the Excel table content in the project directory, process the style-related content into a configuration set, read the content of the style configuration XML file in the project, and modify or add the configuration set content according to the format.

6. The method for generating a static inspection project according to claim 5, characterized in that: Read the Excel table content in the project directory, process the macro definition related content into a configuration set, read the content of the macro definition configuration xml file in the project, and modify or add the configuration set content according to the format. The steps include: Search by keywords and read the Excel table contents in the project directory one by one. If the macro definition word is found, copy the macro definition content text to the software workspace, then enter different cases through switch case, replace the macro definition content, and then read the next macro definition content. After the macro definition is processed, process the setting warning of the calling function, complete the reading of the configuration Excel content in sequence, and write it to the workspace; Through keyword search, read the content of the macro definition configuration xml file under the project, and write the macro definition content string in the workspace line by line according to the fixed format of the xml file through the write function. After the macro definition is processed, the setting warning of the calling function is processed, and the text in the workspace is written to the xml file in sequence.

7. The method for generating a static inspection project according to claim 6, characterized in that: When the trigger information of the project name button is detected, the modified project name is read, and the steps of reading all XML files related to the project name under the project and modifying the relevant content according to the format include: After detecting the trigger information of the project name button, start the callback function of the project name button, take the project path string as a parameter, and read the modified project name through the dir function; Read all xml files related to the project name under the project, modify the file content according to the format, and replace the old project name with the new project name.

8. The method for generating a static inspection project according to claim 7, characterized in that: Read the Excel table content in the project directory, process the measurement element type and size-related content into configuration sets, read the content of the project measurement element configuration XML file, and modify or add the configuration set content according to the format. The steps include: Get the location of the threshold measurement element excel through the code path string, and open the Excel file through the OpenFile function; Search by keywords and read the Excel table contents in the project directory one by one. If the word STCBO is found, copy the STCBO text to the software workspace, then enter different cases through switch case, replace it with STCBO, read the next STCBO content, and after STCBO is processed, process STMIF, and complete the reading of the metric Excel content in sequence and write it to the workspace; Through keyword search, read the content of the metric xml file under the project, and write the STCBO size string in the workspace row by row through the write function according to the fixed format of the xml file. After STCBO is processed, STMIF is processed again, and the text in the workspace is written into the metric xml file in sequence.

9. The method for generating a static inspection project according to claim 8, characterized in that: When the trigger information of the Generate Project button is detected, the directory location of the header file is captured, the relative location of the header file is processed into a set according to the format, the content of the header file configuration xml file under the project is read, and the content of the set is modified or added according to the format. The steps of generating a static inspection project include: When the trigger information of the Generate Project button is detected, the callback function of the Generate Project button is started, and the positions of all H files are listed in rows by driving the Dir library function and loop detection to form multiple H file path strings. The project path string in front of the H file path string is replaced with the generated file relative path string by the replacement function; Through keyword search, read the content of the H file xml file under the project, and write the file relative path string line by line according to the fixed format of the xml file through the write function, complete the writing of the H text in the H file xml file in sequence, and generate a static inspection project.

10. A device for generating a static inspection project, characterized in that: It includes a path location determination module, a project configuration processing module, a project name processing module, a metric configuration processing module and a static inspection project generation module; A path location determination module is used to determine the project path and the location of the project in the computer; The project configuration processing module is used to read the contents of the Excel table in the project directory and process it into a configuration set, read the contents of the configuration XML file under the project, and modify or add the contents of the configuration set according to the format; The project name processing module is used to read the modified project name when the trigger information of the project name button is detected, and modify the relevant content according to the format by reading all XML files related to the project name under the project; The measurement element configuration processing module is used to read the Excel table content in the project directory, process the measurement element type and size related content into configuration sets respectively, read the content of the project measurement element configuration xml file, and modify or add the configuration set content according to the format; The static inspection project generation module is used to capture the directory location of the header file when the trigger information of the generate project button is detected, process the relative position of the header file into a set according to the format, read the content of the header file configuration XML file under the project, modify or add the content of the set according to the format, and generate a static inspection project.