Automatic classification method and tool for code inspection reports

Through the automated classification tool, the problem of inefficient processing of code inspection reports is solved, and efficient processing and structured output of reports are achieved.

CN120428981APending Publication Date: 2025-08-05SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510541142.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

The code inspection reports generated by existing electronic design automation tools are too complex, which consumes a lot of labor and time when viewing and processing code inspection reports, reducing processing efficiency.

Method used

It provides an automated classification method and tool for code checking reports. It analyzes user parameters through the input module. The report processing module uses regular expressions to parse the report and extracts the specified report items of the violation record. The classification output module classifies the violation record based on the path information and writes a comma-separated value file.

Benefits of technology

It reduces the time and labor costs of manual review and manual screening, improves the processing efficiency of code check reports, and converts unstructured reports into structured formats for easier subsequent analysis and processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120428981A_ABST
    Figure CN120428981A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of hardware code development, in particular to an automatic classification method and tool for code inspection reports, and the method comprises the steps that an input module analyzes input parameters of a user, and determines an input path, configuration information and an output path; a report processing module reads the target code inspection report and extracts a specified report item of each violation record; and the classification output module obtains the path information, identifies the subsystem information or the code file path corresponding to the path information, classifies the at least one violation record according to the subsystem information or the code file path, and writes at least one classification result into the corresponding comma separation value file in the output path. According to the method disclosed by the invention, by automatically extracting the violation records and writing the violation records into the comma separation value file in a classified manner, a large amount of manpower and time cost required by manually looking up a code check report and manually screening and classifying is avoided, and the report processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of hardware code development, and in particular to an automated classification method and tool for code inspection reports. Background Art

[0002] In the process of hardware code development technology, code checking is an indispensable key link. Code checking can help developers accurately identify potential problems in hardware design codes in the early stages of development.

[0003] The code review reports generated by current Electronic Design Automation (EDA) tools are overly complex, and the related art methods for reviewing code review reports require significant time and manpower, resulting in inefficient code review report processing. Therefore, reducing the time and manpower consumed in reviewing code review reports, thereby improving code review report processing efficiency, has become an urgent issue. Summary of the Invention

[0004] In view of this, the present application provides an automated classification method and tool for code inspection reports, so as to at least solve the problem of how to reduce the manpower and time cost consumed in reviewing code inspection reports, thereby improving the efficiency of code inspection report processing.

[0005] The present application provides an automated classification method for code inspection reports, which is applied to an automated classification tool. The tool includes: an input module, a report processing module, and a classification output module. The method includes: the input module parses the user's input parameters, determines the input path of the target code inspection report, the configuration information of the specified report items, and the output path of the classification results; the report processing module reads the target code inspection report according to the input path, parses the target code inspection report using a regular expression, and extracts the specified report items of each violation record in at least one violation record; the classification output module obtains the path information in at least one violation record, identifies the subsystem information or code file path corresponding to the path information, classifies the at least one violation record according to the subsystem information or the code file path, and writes the at least one classification result into the corresponding comma-separated value file in the output path.

[0006] The present application also provides an automated classification tool, which includes: an input module, a report processing module, and a classification output module, wherein: the input module is used to parse the user's input parameters, determine the input path of the target code inspection report, the configuration information of the specified report item, and the output path of the classification result; the report processing module is used to read the target code inspection report according to the input path, parse the target code inspection report using regular expressions, and extract the specified report item of each violation record in at least one violation record; the classification output module is used to obtain the path information in at least one violation record, identify the subsystem information or code file path corresponding to the path information, classify at least one violation record according to the subsystem information or code file path, and write at least one classification result into the corresponding comma-separated value file in the output path.

[0007] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned methods for automatically classifying code inspection reports when executing the computer program.

[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for automatically classifying code inspection reports are implemented.

[0009] The present application also provides a computer program product, comprising a computer program, which implements the steps of any of the above-mentioned methods for automatically classifying code inspection reports when the computer program is executed by a processor.

[0010] In the automated classification method and tool for code inspection reports in the above-mentioned embodiment of the present application, by automatically extracting violation records and classifying them into comma-separated value files, the large amount of manpower and time costs required for manually reviewing code inspection reports and manually screening and classifying are avoided, thereby improving report processing efficiency.

[0011] In addition, the specified report items extracted from the unstructured code inspection report are structured and output in a standard comma-separated value format, which facilitates subsequent analysis, statistics, or importing into other tools for processing, improving the structure and visualization of violation records. Different classification results are output as separate comma-separated value files and saved to the user-specified output path, making it easier for users to trace and archive the classification results. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] 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 any creative work.

[0013] Figure 1a An exemplary schematic diagram of the architecture of an automated classification tool used in an automated classification method for code inspection reports provided in an embodiment of the present application;

[0014] Figure 1b A flowchart of an automated classification method for code inspection reports provided in an embodiment of the present application;

[0015] Figure 2 A schematic diagram of a code inspection report for an automated classification method of code inspection reports provided in an embodiment of the present application;

[0016] Figure 3 A schematic diagram of the output content of a comma-separated value file of an automated classification method for code inspection reports provided in an embodiment of the present application;

[0017] Figure 4 A schematic diagram of a specific process of an automated classification method for code inspection reports provided in an embodiment of the present application;

[0018] Figure 5 This is a schematic diagram of the structure of an automated classification tool provided in an embodiment of the present application;

[0019] Figure 6 This is a schematic diagram of the structure of another automated classification tool provided in an embodiment of the present application. DETAILED DESCRIPTION

[0020] In the process of hardware code development technology, code checking is an essential and key link. Code checking can help developers accurately identify potential problems in hardware design code in the early stages of development. For example, Spyglass and VCspyglass tools, as professional EDA tools, can help hardware developers accurately identify potential problems in hardware design code in the early stages of development, covering multiple dimensions such as code style, syntax specifications, signal redundancy, multi-driver conditions, design structure analysis, cross-clock domain and cross-reset domain inspections. Through this comprehensive and detailed inspection, problems that are difficult to detect during simulation and Field-Programmable Gate Array (FPGA) testing can be discovered, and early intervention can be made to improve the quality and reliability of the code and reduce development risks and costs.

[0021] The current EDA tool workflow consists of three main phases: setup, target and run, and results analysis. Users can operate the tool through a graphical interface, command line, or automated scripts. These operations include reading design files, defining top-level modules, setting black boxes, setting constraints, and compiling the design, ultimately generating a detailed code review report.

[0022] Code inspection reports categorize violations by tag. However, for large-scale hardware code inspections, violation information reported by various subsystems is intertwined. Developers reviewing reports need to sift through thousands of violation records, which not only requires a lot of manpower and time, but also easily miss violations related to their specific area due to subjective factors.

[0023] To solve the above problems, various embodiments of the present application provide an automated classification method for code inspection reports, which is applied to an automated classification tool. The tool includes: an input module, a report processing module, and a classification output module. The method includes: the input module parses the user's input parameters, determines the input path of the target code inspection report, the configuration information of the specified report item, and the output path of the classification result; the report processing module reads the target code inspection report according to the input path, parses the target code inspection report using a regular expression, and extracts the specified report item of each violation record in at least one violation record; the classification output module obtains the path information in at least one violation record, identifies the subsystem information or code file path corresponding to the path information, classifies at least one violation record according to the subsystem information or code file path, and writes at least one classification result into the corresponding comma-separated value file in the output path.

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

[0025] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.

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

[0027] Please refer to Figure 1a , Figure 1a This is an exemplary schematic diagram of the architecture of an automated classification tool used in an automated classification method for code inspection reports provided in an embodiment of the present application. Figure 1a As shown, the tool includes: input module, report processing module, and classification output module.

[0028] The automated classification tool can be a complete software program for performing the automated classification process of code inspection reports. The multiple modules in the automated classification tool belong to the functional module division in the hardware architecture, which refers to the components in the code organized according to their functional responsibilities.

[0029] For example, the automated classification tool can be a command-line script implemented in Python that automatically parses, extracts, and classifies code inspection reports. Optionally, the automated classification tool as a Python script can be deployed locally or as a remote service.

[0030] Further references Figure 1b , Figure 1b A flowchart of a method for automatically classifying code inspection reports provided in an embodiment of the present application is provided. The method may include the following steps:

[0031] Step S101 : The input module parses the user's input parameters to determine the input path of the target code inspection report, the configuration information of the specified report items, and the output path of the classification result.

[0032] In this embodiment, the input module receives the parameter string input by the user through the command line interface, and uses the parameter parsing tool to parse the user's input parameters to obtain the input path of the target code inspection report, the configuration information of the specified report item and the output path of the classification result.

[0033] The code inspection report may refer to a structured text file generated by a code analysis tool, a compiler, or a third-party code quality detection platform, which is used to record potential problems in the source code, violations of coding standards, and the like.

[0034] The input path of the target code check report may refer to the storage location path of the target code check report provided by the user, which may be used by the report processing module to read the target code check report file from the path after the tool is started.

[0035] The specified report items may refer to specific information fields extracted from the target code inspection report that the user is interested in. The configuration information of the specified report items may refer to the content information in the configuration file provided by the user, which is used to guide the report processing module to identify and extract the specified report items.

[0036] For example, taking the code inspection report of lint code as an example, it may include but is not limited to the following report items: Tag: points out the violated rule; Description: gives a specific description of the violation; Violation: gives the violation number; Goal: indicates the inspection target, such as lint, cdc, rdc, dft, etc.; Filename: displays the name of the inspected file; LineNumber: records the line number of the violation code in the hardware code; Statement: presents the specific content of the violation code; Value_Name: lists the variable names involved in the violation code; DesignObjSignal: displays the signal related to the violation; SrcObject: reports the starting point of the violation, which is related to the cdc / rdc check; DestObject: reports the end point of the violation, which is related to the cdc / rdc check; Module: displays the name of the module where the violation code is located; Hierarchy: describes the hierarchical structure of the violation code in the overall inspection code.

[0037] Furthermore, if the user's input parameters are missing or have incorrect formats, a prompt message will be returned to the user through the command line interface.

[0038] In step S102 , the report processing module reads the target code inspection report according to the input path, parses the target code inspection report using a regular expression, and extracts a specified report item from each violation record in at least one violation record.

[0039] In this embodiment, the report processing module calls the file reading interface and loads the target code inspection report through the input path; uses a preset regular expression to parse the target code inspection report and identify the text range of at least one violation record in the target code inspection report.

[0040] The report processing module uses the preset regular expression again to extract the specified report items configured by the user from the text range of each violation record.

[0041] For example, the report processing module extracts the Tag, FileName, and Description from each violation record according to the specified report items configured by the user.

[0042] Step S103, the classification output module obtains the path information in at least one violation record, identifies the subsystem information or code file path corresponding to the path information, classifies at least one violation record according to the subsystem information or code file path, and writes at least one classification result into the corresponding comma-separated value file in the output path.

[0043] In this embodiment, the path information of the violation record may refer to the path field Filename included in the violation record.

[0044] For example, the path information of the violation record may include: “hicode / project / rtl / SUB_1”, “hicode / project / ip / SUB_3”.

[0045] The classification output module obtains the path information in at least one violation record, which may include: the classification output module traversing each violation record and extracting the path field of each violation record.

[0046] Furthermore, the subsystem information corresponding to the path system can represent the functional module or logical subcomponent where the code resides. For example, if the path information of a violation record is "app / ui", then the violation record corresponds to the User Interface (UI) subsystem. The code file path corresponding to the path system can represent the full path of a single source code file.

[0047] The classification output module may identify the subsystem information or code file path corresponding to the path information in a manner including but not limited to: path prefix matching, regular expression matching, configuration file matching, etc.

[0048] Furthermore, the classification output module creates a comma-separated values (CSV) file for each classification, and saves the corresponding violation records under each classification into the corresponding CSV file.

[0049] For example, if the target code check report contains three violation records, the path information of the first violation record is hicode / project / rtl / SUB_1, the path information of the second violation record is hicode / project / ip / SUB_1, and the path information of the third violation record is hicode / project / rtl / SUB_1.

[0050] Among them, the path information of the first and third violation records is the same, and the path information of the first and third violation records belongs to the same classification result. A SUB_1.CSV file is created in the hicode / project / rtl directory for the path information of the first and third violation records, and a SUB_1.CSV file is created in the hicode / project / ip directory for the path information of the second violation record; and the specified report item of each violation record of the first and third violation records is stored in the SUB_1.CSV file in the hicode / project / rtl directory, and the specified report item of each violation record of the second violation record is stored in the SUB_1.CSV file in the hicode / project / ip directory.

[0051] In the automated classification method and tool for code inspection reports in the above-mentioned embodiment of the present application, by automatically extracting violation records and writing them into comma-separated value files, the large amount of manpower and time costs required for manually reviewing code inspection reports and manually screening and classifying are avoided, thereby improving the efficiency of report processing. In addition, the specified report items extracted from the unstructured code inspection report are structured and output in a standard comma-separated value format, which is convenient for users to conduct subsequent analysis, statistics, or import into other tools for processing, thereby improving the degree of structuring and visualization of violation records. Different classification results are output as separate comma-separated value files and saved to the output path specified by the user, which is convenient for users to trace and archive the classification results.

[0052] In a possible implementation of step S101, the input module includes an input processing unit and a configuration file reading unit. The input module parses the user's input parameters, determines the input path of the target code inspection report, specifies the report items, and outputs the classification results of the specified report items, including:

[0053] The input processing module obtains the command line parameters input by the user through the command line interface, parses the command line parameters, and determines the input path and output path of the target code inspection report;

[0054] The configuration file reading unit obtains the configuration file provided by the user, reads the configuration file line by line, removes blank characters at the end of each line in the configuration file, and writes the specified report item selected by the user in the configuration file into the first list.

[0055] In this embodiment, the tool builds a command line interface through Python's argparse library, uses the command line interface to receive command line parameters entered by the user, parses the command line parameters, and determines the input path and output path of the target code inspection report.

[0056] For example, the command line parameters input by the user may include the name of the Python script of the automated classification tool, the input path (an absolute path) of the target code inspection report, and the output path (the name of the output directory). For example, the reference format of the command line parameters may be as follows: <xxx>.py / reports / <xxx>.rpt spyglass_csv_dir. Among them, <xxx>.py represents the Python script name of the automated classification tool, / reports / <xxx>.rpt indicates the input path of the target code inspection report, and spyglass_csv_dir indicates the name of the output path.

[0057] Furthermore, the configuration file reading unit receives a configuration file cfg_target.txt provided by the user, wherein the configuration file cfg_target.txt includes fields (ie, specified report items) that the user needs to extract from the target code inspection report.

[0058] For example, the specified report items in the configuration file cfg_target.txt may be as shown in Table 1 below:

[0059] Tags Violation Module FileName LineNumber Statement ……

[0060] Table 1

[0061] Furthermore, the configuration file reading unit reads the configuration file cfg_target.txt line by line, removes blank characters at the end of each line in the configuration file, and stores the specified report items selected by the user in the processed configuration file into a first list for use in subsequent field extraction. Here, the first list can be named target_item list.

[0062] Each line in the configuration file represents a specific report item required by the user. Remove the line break, space, carriage return, and other characters at the end of each line to avoid failure or errors when searching for fields in the report.

[0063] In the automated classification method and tool for code inspection reports in the above-mentioned embodiments of the present application, users only need to specify the code inspection report path, configuration file path, and output path through the command line. This is simple and intuitive, reducing the manpower and time costs required for manual intervention. By writing the specified report items into the configuration file and dynamically loading it via the configuration file reading unit, the system can flexibly adapt to report files with different formats or field structures, facilitating future expansion and improving the flexibility and versatility of hardware code inspections.

[0064] In a possible implementation of step S102, the report processing module includes a report parsing engine and a data processing unit. The report processing module reads the target code inspection report according to the input path, parses the target code inspection report using a regular expression, and extracts specified report items from each violation record in at least one violation record, including:

[0065] The report parsing engine obtains the target code inspection report according to the input path, reads the target code inspection report line by line, identifies the start and end tags of each violation record through a preset regular expression, extracts multiple specified report items in each violation record, and the field information of each specified report item, and stores the field information in the violation dictionary;

[0066] The data processing unit traverses the description field of each violation record in the violation dictionary, and if the description field contains placeholder content of other specified report items, replaces the placeholder content with the actual field value corresponding to the placeholder content.

[0067] In an embodiment, the report parsing engine obtains a target code inspection report according to an input path, reads the target code inspection report line by line, identifies the start and end markers of each violation record using a preset regular expression, extracts multiple specified report items in each violation record, and field information of each specified report item, and stores the field information in a violation dictionary, including:

[0068] The report parsing engine uses a preset regular expression to match the line starting with the first preset tag in each violation record as the start mark of the violation record, and matches the line containing the first preset character as the end mark of the violation record;

[0069] The report parsing engine matches the designated report items separated by the second preset character line by line between the start tag and the end tag, and extracts the field information of each designated report item;

[0070] The report parsing engine stores multiple specified report items and field information of each specified report item in the violation dictionary in the form of key-value pairs.

[0071] Here, please refer to Figure 2 , Figure 2 A schematic diagram of a code inspection report for an automated classification method of a code inspection report provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the code checking report generated by the EDA tool in the related art for the hardware code can be a plain text block structure, where each violation belongs to an independent block, and different blocks are separated by continuous dashes "------------". Figure 2 The report contains two violations: the first violation, w401, and the second violation, w415. The first violation, w401, is used as an example. The violation includes multiple report items, each corresponding to a field describing the violation. Each report item begins with "Tag" and ends with "------------."

[0072] In one possible implementation, the report parsing engine uses a preset regular expression to match the line starting with the first preset tag in each violation record as the start mark of the violation record, and matches the line containing the first preset character as the end mark of the violation record, which may include:

[0073] The report parsing engine uses Python's built-in regular expression (RE) processing module to match the start and end markers of each violation record. When the first preset tag "Tag" is matched, the line containing the "Tag" field is used as the start line of the violation record; if the first preset characters "------------" are matched, the line containing "------------" is used as the end line of the violation record.

[0074] Furthermore, the report parsing engine matches the specified report items separated by the second preset character line by line between the start tag and the end tag, and extracts the field information of each specified report item, which may include:

[0075] The report parsing engine uses colon ":" as the second preset character between the start tag and the end tag, and uses colon ":" as the split key value to store the content of each specified report item of the violation record in the form of a key-value pair in the violation dictionary.

[0076] For example, Figure 2 Take the following as an example the partial violation records in the target code inspection report:

[0077] "Tag:W401

[0078] Description:Clock'[DesignObjSignal]'is not an input to design unit'[HDLModName]'

[0079] Violation:Lint:33139

[0080] ------------------------------------", use the above preset regular expression to match some violation records line by line, and the specified report items in the form of key-value pairs are as follows:

[0081]

[0082]

[0083] In one possible implementation, the data processing unit traverses the description field of each violation record in the violation dictionary, and if the description field contains placeholder content for other specified report items, replaces the placeholder content with the actual field value corresponding to the placeholder content, including:

[0084] The data processing unit traverses the Description field of each violation record and uses regular expressions to identify and replace other report items appearing in the Description.

[0085] For example, if the Description field contains DesignObjSignal, the content corresponding to DesignObjSignal is directly matched to the Description field content. DesignObjSignal can represent a placeholder.

[0086] Furthermore, the data processing unit traverses the Description field of each violation record, extracts the placeholder name in '[]' using a regular expression, and replaces the placeholder name with the corresponding field value.

[0087] Specifically, before data processing, the Description field displays the following content:

[0088] "Description: Signal'[DesignObjSignal]'has multiple simultaneousdrivers DesignObjSignal:PAD_CH10_IO_1".

[0089] After data processing, the Description field displays the following content:

[0090] "Description: Signal'[PAD_CH10_IO_1]'has multiple simultaneousdrivers".

[0091] In the automated classification method and tool for code inspection reports in the above-mentioned embodiment of the present application, the report parsing engine uses regular expressions to identify the start tag "Tag" and the end tag "------------" of the violation block, so that the originally unformatted or semi-structured text is converted into a data structure with structured fields (violation dictionary), which is convenient for subsequent logical processing and classification. Through a unified key-value pair extraction rule (using ":" as a delimiter), code inspection reports of different formats and content structures can be adapted to improve the adaptability and reuse capabilities of the tool. The data processing unit converts vague expressions into concrete expressions through a placeholder recognition and replacement mechanism, making the violation description clearer and helping developers to quickly locate problems.

[0092] In a possible implementation of step S103, the classification output module obtains path information in at least one violation record, identifies subsystem information or a code file path corresponding to the path information, classifies the at least one violation record according to the subsystem information or the code file path, and writes at least one classification result into a comma-separated value file corresponding to the output path, including:

[0093] The classification output module parses the path information of each violation record according to the preset path matching rules and determines the subsystem information or code file path to which each path information belongs;

[0094] The classification output module classifies each violation record according to the subsystem information or code file path, and classifies the violation records with the same subsystem information or code file path into the same category;

[0095] The classification output module constructs a corresponding comma-separated value file for each subsystem information or code file path, writes the violation records under each category into the comma-separated value file corresponding to the category in sequence according to the field order of the specified report items of each violation record, and saves the comma-separated value file as the classification result to the output path specified by the user.

[0096] In this embodiment, since the codes involved in the subsystems are usually stored in the same directory, the directories where different subsystems or codes are located can be identified with the help of the path information in the file name.

[0097] For example, the code involved in the audio subsystem is stored in the " / proj / core / audio" directory. If the code path information contains the audio subsystem path information, the code belongs to the audio subsystem.

[0098] The classification output module parses the path information of each violation record according to the preset path matching rules and determines the subsystem information or code file path to which each path information belongs, which may include:

[0099] The classification output module reads the path information field of each violation record and extracts the subsystem information or code file path corresponding to each violation record through the preset path matching rules. Among them, the path information field is the FileName field.

[0100] Here, the preset path matching rule may be to intercept the directory name of a specific level in the FileName field. For example, if the FileName field of the violation record is " / proj / soc / audio / adc_driver.v", the preset path matching rule may determine that the violation record belongs to the audio subsystem.

[0101] The classification output module classifies each violation record according to the subsystem information or code file path, and classifies violation records with the same subsystem information or code file path into the same category, which can include:

[0102] The classification output module uses the subsystem information or code file path to which each violation record belongs as a classification label, classifies the violation records with the same subsystem information or code file path into one category, and temporarily stores them in a cache table or dictionary.

[0103] For example, the data interface for temporary storage can be as follows: {'audio':[dict1,dict2,dict3],'video':[dict4,dict5],...}.

[0104] Furthermore, a CSV file of a corresponding category is created for a designated report item of each violation record, and the designated report item is stored in the CSV file of the corresponding category.

[0105] For example, the code includes a first part and a second part, where the first part is stored in the trl directory in hicode / project / rtl. The trl directory can include multiple subsystems, such as SUB_1, SUB_2, SUB_3, etc., and the code of each subsystem is stored in the corresponding subsystem directory; the second part is stored in the ip directory in hicode / project / ip. The ip directory can include multiple subsystems, such as SUB_1, SUB_2, SUB_3, etc., and the code of each subsystem is stored in the corresponding subsystem directory.

[0106] The classification output module creates corresponding classification CSV files for violation records in the code check report corresponding to the code of each subsystem. For example, the CSV files may include rtl-SUB_1.csv, rtl-SUB_2.csv, rtl-SUB_3.csv, ip-SUB_1.csv, ip-SUB_2.csv, ip-SUB_3.csv, etc.

[0107] In one possible implementation, the classification output module can also create Extensible Markup Language (XML) files for each violation record in the code inspection report or directly import them into the database to meet the needs of different users. Furthermore, to prevent the path information in certain violation records from not matching any existing subsystem information or code file path, the classification output module will output the unclassifiable violation records to a preset CSV file. For example, the preset CSV file can be other.csv.

[0108] Here, users can check other.csv to find out whether the path matching rules are missing or invalid, so as to correct the rules or verify the integrity of the report data.

[0109] For a specific example, see Figure 3 , Figure 3 A schematic diagram of the output content of a comma-separated value file of an automated classification method for a code inspection report provided in an embodiment of the present application is shown as follows: Figure 3 As shown, each CSV file may include multiple violation records with the same FileName, and each violation record contains the specified report items configured by the user.

[0110] Here, the designated report items selected by the user in the configuration file in the first list may be input into the CSV file as the first row of the CSV file.

[0111] In the automated classification method and tool for code inspection reports in the above-mentioned embodiment of the present application, by extracting the FileName path field in each violation record and combining it with the preset path matching rules, the subsystem or code file path to which the violation record belongs can be accurately identified, avoiding manual judgment one by one and greatly improving the classification efficiency. An independent CSV file is automatically constructed for each subsystem or path, and the output is uniformly output according to the field order of the report item, so that the classification result structure is clear and convenient for users to quickly review, compare and analyze. If some violation paths fail to match any defined subsystem or directory, these records are automatically classified into the other.csv file to ensure that information is not lost, and a user feedback mechanism is provided to correct or supplement the path matching rules.

[0112] In a possible implementation of the above embodiment, the system further includes: a directory management module, and the method further includes:

[0113] The directory management module checks whether the output path exists. If the output path does not exist, it creates the output path and writes the comma-separated value file corresponding to each category into the output path.

[0114] In this embodiment, the directory management module obtains the report output path set by the user and calls the system interface to detect whether the path exists in the current file system; if the path does not exist, the path is created; if the output path does not exist, the directory management module automatically calls the file system interface to recursively create the corresponding directory structure to ensure that subsequent classification reports can be written smoothly; the directory management module receives multiple classification CSV files generated by the classification output module, and writes them into the subdirectory of the output path or the specified naming structure according to category.

[0115] For example, suppose the user sets the output path to / user / output / reports. The directory management module determines whether the path exists. If so, the file is written directly. If not, the / user / output / reports path is automatically created. Multiple CSV files, such as rtl-SUB_1.csv, ip-SUB_2.csv, and other.csv, are then saved to the path.

[0116] In the automated classification method and tool for code inspection reports in the above-mentioned embodiment of the present application, the above steps can improve the stability and automation level of report output, avoid the tedious manual creation of directories, provide higher robustness and error tolerance, and ensure that the classification process is less likely to fail due to missing paths.

[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0118] In a specific embodiment, Figure 4 A schematic diagram of a specific process of an automated classification method for code inspection reports provided in an embodiment of the present application, the process may include the following steps:

[0119] Step S401: input processing.

[0120] Here, the input module parses the user's input parameters, determines the input path of the target code inspection report, specifies the configuration information of the report items, and the output path of the classification results.

[0121] Step S402: configure the target.

[0122] Here, the configuration file reading unit obtains the configuration file provided by the user, reads the configuration file line by line, and determines the user's designated report items.

[0123] Step S403: subsystem division and file output.

[0124] Here, the classification output module classifies each violation record according to the subsystem information or the code file path, and classifies the violation records with the same subsystem information or code file path into the same category.

[0125] Step S404: data conversion.

[0126] Here, regular expressions are used to identify and replace placeholders in Description.

[0127] Step S405: Analyze the report.

[0128] Here, the inspection report is read line by line, the start and end tags of each violation are matched using regular expressions, and the fields are extracted and stored as a dictionary.

[0129] Step S406: Create an output directory and write the CSV file.

[0130] Here, the directory management module checks whether the output path exists. If the output path does not exist, it creates the output path and writes the CSV file corresponding to each category into the output path.

[0131] In one embodiment, an automated classification tool 500 for solid state drives is provided, which corresponds one-to-one to the automated classification method for code inspection reports in the above embodiment. Figure 5 As shown, the tool includes: an input module 501, a report processing module 502, and a classification output module 503, wherein each functional module is described in detail as follows:

[0132] Input module 501, used to parse the user's input parameters, determine the input path of the target code inspection report, the configuration information of the specified report items and the output path of the classification results;

[0133] A report processing module 502 is configured to read a target code inspection report according to an input path, parse the target code inspection report using a regular expression, and extract a specified report item from each violation record in at least one violation record;

[0134] The classification output module 503 is used to obtain path information in at least one violation record, identify the subsystem information or code file path corresponding to the path information, classify at least one violation record according to the subsystem information or code file path, and write at least one classification result into the corresponding comma-separated value file in the output path.

[0135] In one embodiment, the input module 501 includes an input processing unit 5011 and a configuration file reading unit 5012, wherein:

[0136] The input processing unit 5011 is used to obtain the command line parameters input by the user through the command line interface, parse the command line parameters, and determine the input path and the output path of the target code inspection report;

[0137] The configuration file reading unit 5012 is used to obtain the configuration file provided by the user, read the configuration file line by line, remove the blank characters at the end of each line in the configuration file, and write the specified report item selected by the user in the configuration file into the first list.

[0138] In one embodiment, the report processing module 502 includes a report parsing engine 5021 and a data processing unit 5022, wherein:

[0139] The report parsing engine 5021 is used to obtain the target code inspection report according to the input path, read the target code inspection report line by line, identify the start and end tags of each violation record using a preset regular expression, extract multiple specified report items in each violation record, and the field information of each specified report item, and store the field information in the violation dictionary;

[0140] The data processing unit 5022 is used to traverse the description field of each violation record in the violation dictionary, and if the description field contains placeholder content of other specified report items, replace the placeholder content with the actual field value corresponding to the placeholder content.

[0141] In one embodiment, the report parsing engine 5021 is configured to match, using a preset regular expression, a line in each violation record that begins with a first preset tag as a start mark of the violation record, and a line that begins with the first preset character as an end mark of the violation record;

[0142] The report parsing engine 5021 is used to match the specified report items separated by the second preset character between the start tag and the end tag line by line, and extract the field information of each specified report item;

[0143] The report parsing engine 5021 is used to store multiple specified report items and field information of each specified report item in the violation dictionary in the form of key-value pairs.

[0144] In one embodiment, the classification output module 503 is configured to parse the path information of each violation record according to a preset path matching rule, and determine the subsystem information or code file path to which each path information belongs;

[0145] The classification output module 503 is used to classify each violation record according to the subsystem information or code file path, and classify the violation records with the same subsystem information or code file path into the same category;

[0146] The classification output module 503 is used to construct a corresponding comma-separated value file for each subsystem information or code file path, write the violation records under each category into the comma-separated value file corresponding to the category in sequence according to the field order of the specified report item of each violation record, and save the comma-separated value file as the classification result to the output path specified by the user.

[0147] In one embodiment, the system further includes a directory management module 504, wherein:

[0148] The directory management module 504 is used to check whether the output path exists. If the output path does not exist, it creates the output path and writes the comma-separated value file corresponding to each category into the output path.

[0149] It should be noted that: the automatic classification tool provided in the above embodiment only uses the division of the above program modules as an example to illustrate the implementation of the corresponding automatic classification method for code inspection reports. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the above system can be divided into different program modules to complete all or part of the above-described processing. In addition, the system provided in the above embodiment and the corresponding Figure 1b The embodiments of the method shown belong to the same concept, and their specific implementation processes are detailed in the method embodiments, which will not be repeated here.

[0150] The present disclosure also provides an electronic device having the above Figure 5 The automated classification tool shown.

[0151] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of another automatic classification tool provided in an embodiment of the present application. Figure 6 As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.

[0152] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.

[0153] The memory 20 stores instructions that can be executed by at least one processor 10, so as to enable at least one processor 10 to execute the method shown in the above embodiment.

[0154] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0155] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0156] The electronic device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The bus connection is taken as an example.

[0157] The input device 30 can receive input digital or character information and generate key signal input related to user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a trackpad, a touch pad, an indicator stick, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 can include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor). The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display, and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0158] The electronic device also includes a communication interface for the electronic device to communicate with other devices or a communication network.

[0159] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0160] A portion of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes but is not limited to a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium that can be accessed by the computer.

[0161] Although the embodiments of the present disclosure have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.< / xxx> < / xxx> < / xxx> < / xxx>

Claims

1. A method for automatically classifying code inspection reports, characterized in that: Applied to an automated classification tool, the tool includes: an input module, a report processing module, and a classification output module, and the method includes: The input module parses the user's input parameters, determines the input path of the target code inspection report, specifies the configuration information of the report items, and outputs the classification results. The report processing module reads the target code inspection report according to the input path, parses the target code inspection report using a regular expression, and extracts a specified report item of each violation record in at least one violation record; The classification output module obtains the path information in the at least one violation record, identifies the subsystem information or code file path corresponding to the path information, classifies the at least one violation record according to the subsystem information or code file path, and writes at least one classification result into the corresponding comma-separated value file in the output path.

2. The method according to claim 1, characterized in that The input module includes an input processing unit and a configuration file reading unit. The input module parses the user's input parameters, determines the input path of the target code inspection report, specifies the report items, and outputs the classification results of the specified report items, including: The input processing module obtains the command line parameters input by the user through the command line interface, parses the command line parameters, and determines the input path and the output path of the target code inspection report; The configuration file reading unit obtains a configuration file provided by a user, reads the configuration file line by line, removes blank characters at the end of each line in the configuration file, and writes the specified report item selected by the user in the configuration file into a first list.

3. The method according to claim 1, characterized in that The report processing module includes a report parsing engine and a data processing unit. The report processing module reads the target code inspection report according to the input path, parses the target code inspection report using a regular expression, and extracts a specified report item from each violation record in at least one violation record, including: The report parsing engine obtains a target code inspection report according to an input path, reads the target code inspection report line by line, identifies the start and end markers of each violation record using a preset regular expression, extracts multiple specified report items from each violation record, and field information of each specified report item, and stores the field information in a violation dictionary; The data processing unit traverses the description field of each violation record in the violation dictionary, and if the description field contains placeholder content of other specified report items, replaces the placeholder content with the actual field value corresponding to the placeholder content.

4. The method according to claim 3, characterized in that The report parsing engine obtains a target code inspection report according to an input path, reads the target code inspection report line by line, identifies the start and end markers of each violation record using a preset regular expression, extracts multiple specified report items in each violation record, and field information of each specified report item, and stores the field information in a violation dictionary, including: The report parsing engine matches the line starting with the first preset tag in each violation record as the start mark of the violation record, and matches the line containing the first preset character as the end mark of the violation record through a preset regular expression; The report parsing engine matches the designated report items separated by the second preset character line by line between the start tag and the end tag, and extracts the field information of each designated report item; The report parsing engine stores multiple specified report items and field information of each specified report item in the violation dictionary in the form of key-value pairs.

5. The method according to claim 1, wherein The classification output module obtains path information in the at least one violation record, identifies subsystem information or a code file path corresponding to the path information, classifies the at least one violation record according to the subsystem information or the code file path, and writes at least one classification result into a comma-separated value file corresponding to the output path, including: The classification output module parses the path information of each violation record according to the preset path matching rules and determines the subsystem information or code file path to which each path information belongs; The classification output module classifies each violation record according to the subsystem information or code file path, and classifies violation records with the same subsystem information or code file path into the same category; The classification output module constructs a corresponding comma-separated value file for each subsystem information or code file path, and writes the violation records under each category into the comma-separated value file corresponding to the category in sequence according to the field order of the specified report item of each violation record, and saves the comma-separated value file as the classification result to the output path specified by the user.

6. The method according to any one of claims 1 to 5, characterized in that The system further includes: a directory management module, and the method further includes: The directory management module checks whether the output path exists. If the output path does not exist, the directory management module creates the output path and writes the comma-separated value file corresponding to each category into the output path.

7. An automated classification tool, characterized in that The tool includes: an input module, a report processing module, and a classification output module, wherein: The input module is used to parse the user's input parameters, determine the input path of the target code inspection report, specify the configuration information of the report items, and output the classification result path; a report processing module, configured to read the target code inspection report according to the input path, parse the target code inspection report using a regular expression, and extract a specified report item from each violation record in at least one violation record; A classification output module is used to obtain the path information in the at least one violation record, identify the subsystem information or code file path corresponding to the path information, classify the at least one violation record according to the subsystem information or code file path, and write at least one classification result into the corresponding comma-separated value file in the output path.

8. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method for automatically classifying code inspection reports according to any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method for automatically classifying code inspection reports according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the automatic classification method of the code inspection report according to any one of claims 1 to 6 are implemented.