WO2017181631A1 - Method and device for processing capacity information of project file - Google Patents

Method and device for processing capacity information of project file Download PDF

Info

Publication number
WO2017181631A1
WO2017181631A1 PCT/CN2016/102415 CN2016102415W WO2017181631A1 WO 2017181631 A1 WO2017181631 A1 WO 2017181631A1 CN 2016102415 W CN2016102415 W CN 2016102415W WO 2017181631 A1 WO2017181631 A1 WO 2017181631A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
tested
preset
character
capacity information
Prior art date
Application number
PCT/CN2016/102415
Other languages
French (fr)
Chinese (zh)
Inventor
吕玉军
余军
代康伟
赵磊
曹文峰
王亮
马丽娜
韩斌
佟世蒙
Original Assignee
北京新能源汽车股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京新能源汽车股份有限公司 filed Critical 北京新能源汽车股份有限公司
Publication of WO2017181631A1 publication Critical patent/WO2017181631A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/113Details of archiving
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing capacity information of a project file.
  • the prior art roughly estimates the number of lines of code and the like by the size of each file given by the engineering compilation environment.
  • the method is to use the averaging principle, divide the size of a typical file by the total number of lines of the file, and get the average size of each line of code, and then divide the size of the entire project by the size of each line, you can get a rough The number of lines of code.
  • this method is more convenient than manual statistics, the accuracy is too low.
  • the present application aims to solve at least one of the technical problems in the related art to some extent.
  • the first object of the present application is to provide a capacity information processing method for a project file, which implements an adaptive identification of a project path, avoids manually adding a path to be counted, and improves the statistical granularity of the project file capacity information. Accuracy.
  • a second object of the present application is to provide a capacity information processing apparatus for a project file.
  • a third object of the invention is to propose an apparatus.
  • a fourth object of the present invention is to provide a non-volatile computer storage medium.
  • the first aspect of the present application provides a method for processing capacity information of a project file, including: traversing all files of the project to be tested, and saving the file name and file path of each file to a preset global In the variable, the file to be tested corresponding to the preset file type is obtained from the global variable; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined.
  • the capacity information includes: the number of lines of code, the number of blank lines, and the number of comment lines.
  • the correspondence between the file name and the capacity information of each file to be tested is established according to a preset report format.
  • the capacity information processing method of the engineering file in the embodiment of the present application saves the file name and the file path of each file into a preset global variable by traversing all the files of the project to be tested, and obtains and predicts from the global variable.
  • the file to be tested corresponding to the file type; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined, and the capacity information includes: the number of lines of code, and the space The number of rows and lines and the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to the preset report format.
  • the second aspect of the present application provides a capacity information processing apparatus for a project file, including: an obtaining module, configured to traverse all files of a project to be tested, and save a file name and a file path of each file. Go to the preset global variable, and obtain a file to be tested corresponding to the preset file type from the global variable; and the detecting module is configured to detect code information of each file to be tested according to the preset character feature library, and determine The capacity information corresponding to each file to be tested, the capacity information includes: a number of code lines, a number of blank lines, and a number of comment lines; and a processing module, configured to establish a file name of each file to be tested according to a preset report format Correspondence with capacity information.
  • the capacity information processing apparatus of the project file of the embodiment of the present application saves the file name and the file path of each file into a preset global variable by traversing all the files of the project to be tested, and obtains and predicts from the global variable.
  • the file to be tested corresponding to the file type; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined, and the capacity information includes: the number of lines of code, and the space The number of rows and lines and the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to the preset report format.
  • a third aspect of the present invention provides an apparatus comprising: one or more processors; a memory; one or more programs, the one or more programs being stored in the memory when When multiple processors are executed, the following steps are performed: traversing all the files of the project to be tested, saving the file name and file path of each file to a preset global variable, and obtaining the preset file from the global variable.
  • the file to be tested corresponding to the type; detecting code information of each file to be tested according to the preset character feature library, and determining capacity information corresponding to each file to be tested, the capacity information includes: number of lines of code, number of lines of blank lines And the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to a preset report format.
  • a fourth aspect of the present invention provides a non-volatile computer storage medium storing one or more programs, when the one or more programs are executed by one device, causing the device
  • the following steps are performed: traversing all the files of the project to be tested, saving the file name and file path of each file to a preset global variable, and obtaining a file to be tested corresponding to the preset file type from the global variable; Detecting code information of each file to be tested according to a preset character feature library, and determining capacity information corresponding to each file to be tested, the capacity
  • the quantity information includes: the number of code lines, the number of blank lines, and the number of comment lines; and the correspondence between the file name and the capacity information of each file to be tested is established according to a preset report format.
  • FIG. 1 is a flowchart of a method for processing capacity information of a project file according to an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a capacity information processing apparatus of a project file according to an embodiment of the present application.
  • FIG. 1 is a flow chart of a method for processing capacity information of a project file according to an embodiment of the present application.
  • the capacity information processing method of the project file includes:
  • Step 101 Traverse all the files of the project to be tested, save the file name and file path of each file to a preset global variable, and obtain a file to be tested corresponding to the preset file type from the global variable.
  • the file to be tested corresponding to the preset file type is obtained from the global variable.
  • preset file types for example, (.c, .h..H file), which can be set according to actual application requirements, which is not limited in this embodiment.
  • Step 102 Detect code information of each file to be tested according to a preset character feature library, and determine capacity information corresponding to each file to be tested, where the capacity information includes: number of lines of code, number of lines of blank lines, and number of comment lines .
  • a character feature library is preset, wherein the character feature library includes identification characters for identifying code lines, blank lines, and comment lines in the project file.
  • the code information of each file to be tested is detected according to a preset character feature library, and the capacity information corresponding to each file to be tested is determined by the number of matches in the code information with the preset characters in the character feature library, wherein Capacity information Including: the number of lines of code, the number of blank lines, and the number of comment lines.
  • the character feature library includes: a first character type of a blank line start character and an end character;
  • the code information of each file to be tested is detected according to the blank start and end characters in the first character type, and if the character information matching the blank start character and the end character appears, it is determined to be a blank line, and then The code information of the entire file is detected, and the number of blank lines corresponding to each file to be tested is determined.
  • the character signature library includes: a second character type of a comment start character and a terminator;
  • the code information of each file to be tested is detected according to the comment start and end characters in the second character type, and if the character information matching the comment start and end characters appears, it is determined as a comment line, and the entire file is sequentially The code information is detected to determine the number of comment lines corresponding to each file to be tested.
  • the character signature library includes: a third character type of a code start character and a terminator;
  • the code information of each file to be tested is detected, and if the character information matching the code start character and the end character appears, it is determined as a code line, and the entire file is sequentially The code information is detected to determine the number of lines of code corresponding to each file to be tested.
  • Step 103 Establish a correspondence between file names and capacity information of each file to be tested according to a preset report format.
  • the corresponding relationship between the file name and the capacity information of each file to be tested is established according to the preset report format.
  • report formats There are many types of report formats, which are not limited in this embodiment.
  • the report including the correspondence between the file name and the capacity information is saved to the preset path.
  • the capacity information processing method of the engineering file in the embodiment of the present application saves the file name and the file path of each file into a preset global variable by traversing all the files of the project to be tested, and obtains and predicts from the global variable.
  • the file to be tested corresponding to the file type; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined, and the capacity information includes: the number of lines of code, and the space The number of rows and lines and the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to the preset report format.
  • the present application also proposes a capacity information processing apparatus for a project file.
  • FIG. 2 is a schematic structural diagram of a capacity information processing apparatus of a project file according to an embodiment of the present application.
  • the capacity information processing apparatus of the project file includes:
  • the obtaining module 11 is configured to traverse all the files of the project to be tested, and save the file name and file path of each file. Go to a preset global variable, and obtain a file to be tested corresponding to the preset file type from the global variable;
  • the detecting module 12 is configured to detect code information of each file to be tested according to a preset character feature library, and determine capacity information corresponding to each file to be tested, where the capacity information includes: a number of lines of code, a number of lines of blank lines, and Number of comment lines;
  • the processing module 13 is configured to establish, according to a preset report format, a correspondence between file names and capacity information of each file to be tested.
  • a character feature library is preset, wherein the character feature library includes identification characters for identifying code lines, blank lines, and comment lines in the project file.
  • the code information of each file to be tested is detected according to a preset character feature library, and the capacity information corresponding to each file to be tested is determined by the number of matches in the code information with the preset characters in the character feature library, wherein
  • the capacity information includes: the number of lines of code, the number of blank lines, and the number of comment lines.
  • the detecting module 12 is configured to:
  • the detecting module 12 is configured to:
  • the detecting module 12 is configured to:
  • processing module 13 is further configured to:
  • the capacity information processing apparatus of the project file of the embodiment of the present application saves the file name and the file path of each file into a preset global variable by traversing all the files of the project to be tested, and obtains and predicts from the global variable.
  • the file to be tested corresponding to the file type; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined, and the capacity information includes: the number of lines of code, and the space The number of rows and lines and the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to the preset report format.
  • first and second are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated.
  • features defining “first” or “second” may include at least one of the features, either explicitly or implicitly.
  • the meaning of "a plurality” is at least two, such as two, three, etc., unless specifically defined otherwise.
  • a "computer-readable medium” can be any apparatus that can contain, store, communicate, propagate, or transport a program for use in an instruction execution system, apparatus, or device, or in conjunction with the instruction execution system, apparatus, or device.
  • computer readable media include the following: electrical connections (electronic devices) having one or more wires, portable computer disk cartridges (magnetic devices), random access memory (RAM), Read only memory (ROM), erasable editable read only memory (EPROM or flash memory), fiber optic devices, and portable compact disk read only memory (CDROM).
  • the computer readable medium may even be a paper or other suitable medium on which the program can be printed, as it may be optically scanned, for example by paper or other medium, followed by editing, interpretation or, if appropriate, other suitable The method is processed to obtain the program electronically and then stored in computer memory.
  • portions of the application can be implemented in hardware, software, firmware, or a combination thereof.
  • multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system.
  • a suitable instruction execution system For example, if implemented in hardware, as in another embodiment, it can be used in the art.

Abstract

Disclosed are a method and a device for processing capacity information of a project file. The method comprises: traversing all files of a project to be detected, storing a file name and a file path of each file in a preset global variable, and acquiring from the global variable a file to be detected that corresponds to a preset file type (101); detecting, according to a preset character feature library, code information of each file to be detected, and determining capacity information corresponding to each file to be detected, wherein the capacity information includes: the number of code rows, the number of blank rows, and the number of comment rows (102); and establishing, according to a preset report format, a correspondence between a file name of each file to be detected and capacity information (103). In this way, the present invention enables self-adaptive recognition of project paths, avoids the need to manually add file paths to be statistically analyzed, and improves statistical granularity of capacity information of a project file.

Description

工程文件的容量信息处理方法及装置Capacity information processing method and device for engineering file
相关申请的交叉引用Cross-reference to related applications
本申请要求北京新能源汽车股份有限公司于2016年04月19日提交的、发明名称为“工程文件的容量信息处理方法及装置”的、中国专利申请号“201610245424.3”的优先权。This application claims the priority of the Chinese Patent Application No. "201610245424.3" filed on April 19, 2016 by Beijing New Energy Automobile Co., Ltd., entitled "Process Information Processing Method and Apparatus for Engineering Documents".
技术领域Technical field
本发明涉及计算机技术领域,特别涉及一种工程文件的容量信息处理方法及装置。The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing capacity information of a project file.
背景技术Background technique
由于工程文件很多,逐个文件统计,不仅耗时费力,且不能保证准确性。因此,现有技术通过借助工程编译环境给出的各个文件的大小,粗略估算出代码行数等方法。该方法是利用平均原则,以某个典型文件的大小,除以该文件的总行数,得出平均每行代码的大小,然后再用整个工程的大小除以每一行的大小,可以得到一个大概的代码行数。该方法虽然比人工统计便捷,但是准确度太低。Due to the large number of engineering documents, the statistics of each file are not only time-consuming and laborious, but also cannot guarantee accuracy. Therefore, the prior art roughly estimates the number of lines of code and the like by the size of each file given by the engineering compilation environment. The method is to use the averaging principle, divide the size of a typical file by the total number of lines of the file, and get the average size of each line of code, and then divide the size of the entire project by the size of each line, you can get a rough The number of lines of code. Although this method is more convenient than manual statistics, the accuracy is too low.
发明内容Summary of the invention
本申请旨在至少在一定程度上解决相关技术中的技术问题之一。The present application aims to solve at least one of the technical problems in the related art to some extent.
为此,本申请的第一个目的在于提出一种工程文件的容量信息处理方法,该方法实现了自适应识别工程路径,避免手动添加待统计文件路径,提高了工程文件容量信息的统计粒度和准确度。Therefore, the first object of the present application is to provide a capacity information processing method for a project file, which implements an adaptive identification of a project path, avoids manually adding a path to be counted, and improves the statistical granularity of the project file capacity information. Accuracy.
本申请的第二个目的在于提出一种工程文件的容量信息处理装置。A second object of the present application is to provide a capacity information processing apparatus for a project file.
本发明的第三个目的在于提出一种设备。A third object of the invention is to propose an apparatus.
本发明的第四个目的在于提出一种非易失性计算机存储介质。A fourth object of the present invention is to provide a non-volatile computer storage medium.
为达上述目的,本申请第一方面实施例提出了一种工程文件的容量信息处理方法,包括:遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数。根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。 To achieve the above objective, the first aspect of the present application provides a method for processing capacity information of a project file, including: traversing all files of the project to be tested, and saving the file name and file path of each file to a preset global In the variable, the file to be tested corresponding to the preset file type is obtained from the global variable; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined. The capacity information includes: the number of lines of code, the number of blank lines, and the number of comment lines. The correspondence between the file name and the capacity information of each file to be tested is established according to a preset report format.
本申请实施例的工程文件的容量信息处理方法,通过遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。由此,实现了自适应识别工程路径,避免手动添加待统计文件路径,提高了工程文件容量信息的统计粒度和准确度。The capacity information processing method of the engineering file in the embodiment of the present application saves the file name and the file path of each file into a preset global variable by traversing all the files of the project to be tested, and obtains and predicts from the global variable. The file to be tested corresponding to the file type; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined, and the capacity information includes: the number of lines of code, and the space The number of rows and lines and the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to the preset report format. Thereby, the adaptive identification engineering path is realized, and the path of the file to be counted is manually added, and the statistical granularity and accuracy of the capacity information of the project file are improved.
为达上述目的,本申请第二方面实施例提出了一种工程文件的容量信息处理装置,包括:获取模块,用于遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;检测模块,用于根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;处理模块,用于根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。To achieve the above objective, the second aspect of the present application provides a capacity information processing apparatus for a project file, including: an obtaining module, configured to traverse all files of a project to be tested, and save a file name and a file path of each file. Go to the preset global variable, and obtain a file to be tested corresponding to the preset file type from the global variable; and the detecting module is configured to detect code information of each file to be tested according to the preset character feature library, and determine The capacity information corresponding to each file to be tested, the capacity information includes: a number of code lines, a number of blank lines, and a number of comment lines; and a processing module, configured to establish a file name of each file to be tested according to a preset report format Correspondence with capacity information.
本申请实施例的工程文件的容量信息处理装置,通过遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。由此,实现了自适应识别工程路径,避免手动添加待统计文件路径,提高了工程文件容量信息的统计粒度和准确度。The capacity information processing apparatus of the project file of the embodiment of the present application saves the file name and the file path of each file into a preset global variable by traversing all the files of the project to be tested, and obtains and predicts from the global variable. The file to be tested corresponding to the file type; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined, and the capacity information includes: the number of lines of code, and the space The number of rows and lines and the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to the preset report format. Thereby, the adaptive identification engineering path is realized, and the path of the file to be counted is manually added, and the statistical granularity and accuracy of the capacity information of the project file are improved.
本发明第三方面实施例提供了一种设备,包括:一个或者多个处理器;存储器;一个或者多个程序,所述一个或者多个程序存储在所述存储器中,当被所述一个或者多个处理器执行时,执行以下步骤:遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。A third aspect of the present invention provides an apparatus comprising: one or more processors; a memory; one or more programs, the one or more programs being stored in the memory when When multiple processors are executed, the following steps are performed: traversing all the files of the project to be tested, saving the file name and file path of each file to a preset global variable, and obtaining the preset file from the global variable. The file to be tested corresponding to the type; detecting code information of each file to be tested according to the preset character feature library, and determining capacity information corresponding to each file to be tested, the capacity information includes: number of lines of code, number of lines of blank lines And the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to a preset report format.
本发明第四方面实施例提供了一种非易失性计算机存储介质,所述计算机存储介质存储有一个或者多个程序,当所述一个或者多个程序被一个设备执行时,使得所述设备执行以下步骤:遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容 量信息包括:代码行数、空行行数以及注释行数;根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。A fourth aspect of the present invention provides a non-volatile computer storage medium storing one or more programs, when the one or more programs are executed by one device, causing the device The following steps are performed: traversing all the files of the project to be tested, saving the file name and file path of each file to a preset global variable, and obtaining a file to be tested corresponding to the preset file type from the global variable; Detecting code information of each file to be tested according to a preset character feature library, and determining capacity information corresponding to each file to be tested, the capacity The quantity information includes: the number of code lines, the number of blank lines, and the number of comment lines; and the correspondence between the file name and the capacity information of each file to be tested is established according to a preset report format.
附图说明DRAWINGS
本发明上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present invention will become apparent and readily understood from
图1是本申请一个实施例的工程文件的容量信息处理方法的流程图;1 is a flowchart of a method for processing capacity information of a project file according to an embodiment of the present application;
图2是本申请一个实施例的工程文件的容量信息处理装置的结构示意图。2 is a schematic structural diagram of a capacity information processing apparatus of a project file according to an embodiment of the present application.
具体实施方式detailed description
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本申请,而不能理解为对本申请的限制。The embodiments of the present application are described in detail below, and the examples of the embodiments are illustrated in the drawings, wherein the same or similar reference numerals are used to refer to the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are intended to be illustrative, and are not to be construed as limiting.
下面参考附图描述本申请实施例的工程文件的容量信息处理方法及装置。The method and apparatus for processing capacity information of a project file according to an embodiment of the present application are described below with reference to the accompanying drawings.
图1是本申请一个实施例的工程文件的容量信息处理方法的流程图。1 is a flow chart of a method for processing capacity information of a project file according to an embodiment of the present application.
如图1所示,该工程文件的容量信息处理方法包括:As shown in FIG. 1, the capacity information processing method of the project file includes:
步骤101,遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件。Step 101: Traverse all the files of the project to be tested, save the file name and file path of each file to a preset global variable, and obtain a file to be tested corresponding to the preset file type from the global variable.
具体地,由于工程文件的代码量很大,包含的文件多,子路径深,因此,工程中需要统计的文件分布在所有的路径中。所以当需要统计工程代码容量时,首先需要遍历工程中所有路径下的文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,并对所有文件进行编号排序。Specifically, since the code size of the project file is large, there are many files and the sub-path is deep. Therefore, files that need to be counted in the project are distributed in all paths. Therefore, when you need to calculate the engineering code capacity, you first need to traverse the files in all the paths in the project, save the file name and file path of each file to the preset global variables, and sort all the files.
进而,从该全局变量中获取与预设的文件类型对应的待测文件。其中,预设的文件类型有很多,例如:(.c,.h..H文件),可以根据实际应用需要进行设置,本实施例对此不作限制。Further, the file to be tested corresponding to the preset file type is obtained from the global variable. There are a plurality of preset file types, for example, (.c, .h..H file), which can be set according to actual application requirements, which is not limited in this embodiment.
步骤102,根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数。Step 102: Detect code information of each file to be tested according to a preset character feature library, and determine capacity information corresponding to each file to be tested, where the capacity information includes: number of lines of code, number of lines of blank lines, and number of comment lines .
具体地,为了提高工程文件代码容量的统计粒度和精确度,预先设置字符特征库,其中,字符特征库中包括了用于识别工程文件中代码行、空行、以及注释行的标识字符。Specifically, in order to improve the statistical granularity and accuracy of the engineering file code capacity, a character feature library is preset, wherein the character feature library includes identification characters for identifying code lines, blank lines, and comment lines in the project file.
进而,根据预设的字符特征库检测每个待测文件的代码信息,通过代码信息中与字符特征库中预设字符的匹配数量,确定与每个待测文件对应的容量信息,其中,该容量信息 包括:代码行数、空行行数以及注释行数。Further, the code information of each file to be tested is detected according to a preset character feature library, and the capacity information corresponding to each file to be tested is determined by the number of matches in the code information with the preset characters in the character feature library, wherein Capacity information Including: the number of lines of code, the number of blank lines, and the number of comment lines.
需要说明的是,针对不同的文件类型、代码类型、以及注释类型,可以根据应用需要设置不同的字符类型进行识别,具体说明如下:It should be noted that for different file types, code types, and annotation types, different character types can be identified according to the application requirements, as follows:
示例一:字符特征库包括:空行起始符和结束符的第一字符类型;Example 1: The character feature library includes: a first character type of a blank line start character and an end character;
根据第一字符类型中的空行起始符和结束符,检测每个待测文件的代码信息,如果出现与空行起始符和结束符匹配的字符信息,则确定为空行,依次对整个文件的代码信息进行检测,确定每个待测文件对应的空行行数。The code information of each file to be tested is detected according to the blank start and end characters in the first character type, and if the character information matching the blank start character and the end character appears, it is determined to be a blank line, and then The code information of the entire file is detected, and the number of blank lines corresponding to each file to be tested is determined.
示例二:字符特征库包括:注释起始符和结束符的第二字符类型;Example 2: The character signature library includes: a second character type of a comment start character and a terminator;
根据第二字符类型中的注释起始符和结束符,检测每个待测文件的代码信息,如果出现与注释起始符和结束符匹配的字符信息,则确定为注释行,依次对整个文件的代码信息进行检测,确定每个待测文件对应的注释行数。The code information of each file to be tested is detected according to the comment start and end characters in the second character type, and if the character information matching the comment start and end characters appears, it is determined as a comment line, and the entire file is sequentially The code information is detected to determine the number of comment lines corresponding to each file to be tested.
示例三:字符特征库包括:代码起始符和结束符的第三字符类型;Example 3: The character signature library includes: a third character type of a code start character and a terminator;
根据第三字符类型中的注释起始符和结束符,检测每个待测文件的代码信息,如果出现与代码起始符和结束符匹配的字符信息,则确定为代码行,依次对整个文件的代码信息进行检测,确定每个待测文件对应的代码行数。According to the comment start and end characters in the third character type, the code information of each file to be tested is detected, and if the character information matching the code start character and the end character appears, it is determined as a code line, and the entire file is sequentially The code information is detected to determine the number of lines of code corresponding to each file to be tested.
步骤103,根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。Step 103: Establish a correspondence between file names and capacity information of each file to be tested according to a preset report format.
具体地,为了直观的显示精确粒度的工程文件容量信息,根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。其中,报表格式的类型很多,本实施例对此不作限制。Specifically, in order to intuitively display the precise file size of the project file, the corresponding relationship between the file name and the capacity information of each file to be tested is established according to the preset report format. There are many types of report formats, which are not limited in this embodiment.
进一步地,将包含文件名称与容量信息对应关系的报表保存到预设的路径中。Further, the report including the correspondence between the file name and the capacity information is saved to the preset path.
本申请实施例的工程文件的容量信息处理方法,通过遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。由此,实现了自适应识别工程路径,避免手动添加待统计文件路径,提高了工程文件容量信息的统计粒度。The capacity information processing method of the engineering file in the embodiment of the present application saves the file name and the file path of each file into a preset global variable by traversing all the files of the project to be tested, and obtains and predicts from the global variable. The file to be tested corresponding to the file type; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined, and the capacity information includes: the number of lines of code, and the space The number of rows and lines and the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to the preset report format. Thereby, the adaptive identification engineering path is realized, and the path of the file to be counted is manually added, and the statistical granularity of the capacity information of the project file is improved.
为了实现上述实施例,本申请还提出一种工程文件的容量信息处理装置。In order to implement the above embodiment, the present application also proposes a capacity information processing apparatus for a project file.
图2是本申请一个实施例的工程文件的容量信息处理装置的结构示意图。2 is a schematic structural diagram of a capacity information processing apparatus of a project file according to an embodiment of the present application.
如图2所示,该工程文件的容量信息处理装置包括:As shown in FIG. 2, the capacity information processing apparatus of the project file includes:
获取模块11,用于遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存 到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;The obtaining module 11 is configured to traverse all the files of the project to be tested, and save the file name and file path of each file. Go to a preset global variable, and obtain a file to be tested corresponding to the preset file type from the global variable;
检测模块12,用于根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;The detecting module 12 is configured to detect code information of each file to be tested according to a preset character feature library, and determine capacity information corresponding to each file to be tested, where the capacity information includes: a number of lines of code, a number of lines of blank lines, and Number of comment lines;
处理模块13,用于根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。The processing module 13 is configured to establish, according to a preset report format, a correspondence between file names and capacity information of each file to be tested.
具体地,为了提高工程文件代码容量的统计粒度和精确度,预先设置字符特征库,其中,字符特征库中包括了用于识别工程文件中代码行、空行、以及注释行的标识字符。Specifically, in order to improve the statistical granularity and accuracy of the engineering file code capacity, a character feature library is preset, wherein the character feature library includes identification characters for identifying code lines, blank lines, and comment lines in the project file.
进而,根据预设的字符特征库检测每个待测文件的代码信息,通过代码信息中与字符特征库中预设字符的匹配数量,确定与每个待测文件对应的容量信息,其中,该容量信息包括:代码行数、空行行数以及注释行数。Further, the code information of each file to be tested is detected according to a preset character feature library, and the capacity information corresponding to each file to be tested is determined by the number of matches in the code information with the preset characters in the character feature library, wherein The capacity information includes: the number of lines of code, the number of blank lines, and the number of comment lines.
需要说明的是,针对不同的文件类型、代码类型、以及注释类型,可以根据应用需要设置不同的字符类型进行识别,具体说明如下:It should be noted that for different file types, code types, and annotation types, different character types can be identified according to the application requirements, as follows:
其中,在一个实施例中,检测模块12用于:Wherein, in one embodiment, the detecting module 12 is configured to:
根据所述字符特征库中的第一字符类型检测每个待测文件的代码信息,确定与每个待测文件对应的空行行数,其中,所述第一字符类型包括:空行起始符和结束符。Determining code information of each file to be tested according to the first character type in the character feature library, and determining a number of blank lines corresponding to each file to be tested, wherein the first character type includes: a blank line start Symbol and terminator.
其中,在另一个实施例中,所述检测模块12用于:In another embodiment, the detecting module 12 is configured to:
根据所述字符特征库中的第二字符类型检测每个待测文件的代码信息,确定与每个待测文件对应的注释行数,其中,所述第二字符类型包括:注释起始符和结束符。Determining code information of each file to be tested according to the second character type in the character feature library, and determining a number of comment lines corresponding to each file to be tested, wherein the second character type includes: a comment start character and End character.
其中,在另一个实施例中,所述检测模块12用于:In another embodiment, the detecting module 12 is configured to:
根据所述字符特征库中的第三字符类型检测每个待测文件的代码信息,确定与每个待测文件对应的代码行数,其中,所述第三字符类型包括:代码起始符和结束符。Determining code information of each file to be tested according to a third character type in the character feature library, and determining a number of code lines corresponding to each file to be tested, wherein the third character type includes: a code start character and End character.
进一步地,所述处理模块13还用于:Further, the processing module 13 is further configured to:
将包含所述文件名称与容量信息对应关系的报表保存到预设的路径中。Save the report containing the file name and capacity information to the preset path.
需要说明的是,前述对工程文件的容量信息处理方法实施例的解释说明也适用于该实施例的工程文件的容量信息处理装置,此处不再赘述。It should be noted that the foregoing explanation of the embodiment of the method for processing the capacity information of the project file is also applicable to the capacity information processing device of the project file of the embodiment, and details are not described herein again.
本申请实施例的工程文件的容量信息处理装置,通过遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。由此,实现了自适应识别工程路径,避免手动添加待统计文件路径,提高了工程文件容量信息的统计粒度。 The capacity information processing apparatus of the project file of the embodiment of the present application saves the file name and the file path of each file into a preset global variable by traversing all the files of the project to be tested, and obtains and predicts from the global variable. The file to be tested corresponding to the file type; the code information of each file to be tested is detected according to the preset character feature library, and the capacity information corresponding to each file to be tested is determined, and the capacity information includes: the number of lines of code, and the space The number of rows and lines and the number of comment lines; the correspondence between the file name and the capacity information of each file to be tested is established according to the preset report format. Thereby, the adaptive identification engineering path is realized, and the path of the file to be counted is manually added, and the statistical granularity of the capacity information of the project file is improved.
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征或者特点包含于本申请的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。In the description of the present specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" and the like means a specific feature described in connection with the embodiment or example. Or features are included in at least one embodiment or example of the present application. In the present specification, the schematic representation of the above terms is not necessarily directed to the same embodiment or example. Furthermore, the particular features or characteristics described may be combined in a suitable manner in any one or more embodiments or examples. In addition, various embodiments or examples described in the specification, as well as features of various embodiments or examples, may be combined and combined.
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本申请的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。Moreover, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, features defining "first" or "second" may include at least one of the features, either explicitly or implicitly. In the description of the present application, the meaning of "a plurality" is at least two, such as two, three, etc., unless specifically defined otherwise.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本申请的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本申请的实施例所属技术领域的技术人员所理解。Any process or method description in the flowcharts or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a particular logical function or process. And the scope of the preferred embodiments of the present application includes additional implementations, in which the functions may be performed in a substantially simultaneous manner or in the reverse order depending on the functions involved, in accordance with the illustrated or discussed order. It will be understood by those skilled in the art to which the embodiments of the present application pertain.
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,"计算机可读介质"可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式光盘只读存储器(CDROM)。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。The logic and/or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer readable medium, Used in conjunction with, or in conjunction with, an instruction execution system, apparatus, or device (eg, a computer-based system, a system including a processor, or other system that can fetch instructions and execute instructions from an instruction execution system, apparatus, or device) Or use with equipment. For the purposes of this specification, a "computer-readable medium" can be any apparatus that can contain, store, communicate, propagate, or transport a program for use in an instruction execution system, apparatus, or device, or in conjunction with the instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer readable media include the following: electrical connections (electronic devices) having one or more wires, portable computer disk cartridges (magnetic devices), random access memory (RAM), Read only memory (ROM), erasable editable read only memory (EPROM or flash memory), fiber optic devices, and portable compact disk read only memory (CDROM). In addition, the computer readable medium may even be a paper or other suitable medium on which the program can be printed, as it may be optically scanned, for example by paper or other medium, followed by editing, interpretation or, if appropriate, other suitable The method is processed to obtain the program electronically and then stored in computer memory.
应当理解,本申请的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下 列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。 It should be understood that portions of the application can be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be used in the art. Any one of the column technologies or a combination thereof: discrete logic circuits with logic gates for implementing logic functions on data signals, application specific integrated circuits with suitable combinational logic gates, programmable gate arrays (PGA) ), field programmable gate array (FPGA), etc.

Claims (12)

  1. 一种工程文件的容量信息处理方法,其特征在于,包括以下步骤:A method for processing capacity information of a project file, comprising the steps of:
    遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;Traversing all the files of the project to be tested, saving the file name and file path of each file to a preset global variable, and obtaining a file to be tested corresponding to the preset file type from the global variable;
    根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;Detecting code information of each file to be tested according to a preset character feature library, and determining capacity information corresponding to each file to be tested, where the capacity information includes: a number of code lines, a number of blank lines, and a number of comment lines;
    根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。The correspondence between the file name and the capacity information of each file to be tested is established according to a preset report format.
  2. 如权利要求1所述的方法,其特征在于,所述根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,包括:The method according to claim 1, wherein the detecting the code information of each file to be tested according to the preset character feature library, and determining the capacity information corresponding to each file to be tested, includes:
    根据所述字符特征库中的第一字符类型检测每个待测文件的代码信息,确定与每个待测文件对应的空行行数,其中,所述第一字符类型包括:空行起始符和结束符。Determining code information of each file to be tested according to the first character type in the character feature library, and determining a number of blank lines corresponding to each file to be tested, wherein the first character type includes: a blank line start Symbol and terminator.
  3. 如权利要求1所述的方法,其特征在于,所述根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,包括:The method according to claim 1, wherein the detecting the code information of each file to be tested according to the preset character feature library, and determining the capacity information corresponding to each file to be tested, includes:
    根据所述字符特征库中的第二字符类型检测每个待测文件的代码信息,确定与每个待测文件对应的注释行数,其中,所述第二字符类型包括:注释起始符和结束符。Determining code information of each file to be tested according to the second character type in the character feature library, and determining a number of comment lines corresponding to each file to be tested, wherein the second character type includes: a comment start character and End character.
  4. 如权利要求1所述的方法,其特征在于,所述根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,包括:The method according to claim 1, wherein the detecting the code information of each file to be tested according to the preset character feature library, and determining the capacity information corresponding to each file to be tested, includes:
    根据所述字符特征库中的第三字符类型检测每个待测文件的代码信息,确定与每个待测文件对应的代码行数,其中,所述第三字符类型包括:代码起始符和结束符。Determining code information of each file to be tested according to a third character type in the character feature library, and determining a number of code lines corresponding to each file to be tested, wherein the third character type includes: a code start character and End character.
  5. 如权利要求1-4任一所述的方法,其特征在于,在所述根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系之后,还包括:The method according to any one of claims 1-4, further comprising: after the mapping of the file name and the capacity information of each file to be tested according to the preset report format, the method further comprises:
    将包含所述文件名称与容量信息对应关系的报表保存到预设的路径中。Save the report containing the file name and capacity information to the preset path.
  6. 一种工程文件的容量信息处理装置,其特征在于,包括:A capacity information processing device for a project file, comprising:
    获取模块,用于遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;The obtaining module is configured to traverse all the files of the project to be tested, save the file name and file path of each file to a preset global variable, and obtain a file to be tested corresponding to the preset file type from the global variable. ;
    检测模块,用于根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;a detecting module, configured to detect code information of each file to be tested according to a preset character feature library, and determine capacity information corresponding to each file to be tested, where the capacity information includes: number of lines of code, number of lines of blank lines, and comments Rows;
    处理模块,用于根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。The processing module is configured to establish, according to a preset report format, a correspondence between file names and capacity information of each file to be tested.
  7. 如权利要求6所述的装置,其特征在于,所述检测模块用于:The apparatus of claim 6 wherein said detecting module is for:
    根据所述字符特征库中的第一字符类型检测每个待测文件的代码信息,确定与每个待 测文件对应的空行行数,其中,所述第一字符类型包括:空行起始符和结束符。Detecting code information of each file to be tested according to the first character type in the character feature library, determining and waiting for each The number of blank lines corresponding to the file is measured, wherein the first character type includes: a blank line start character and an end character.
  8. 如权利要求6所述的装置,其特征在于,所述检测模块用于:The apparatus of claim 6 wherein said detecting module is for:
    根据所述字符特征库中的第二字符类型检测每个待测文件的代码信息,确定与每个待测文件对应的注释行数,其中,所述第二字符类型包括:注释起始符和结束符。Determining code information of each file to be tested according to the second character type in the character feature library, and determining a number of comment lines corresponding to each file to be tested, wherein the second character type includes: a comment start character and End character.
  9. 如权利要求6所述的装置,其特征在于,所述检测模块用于:The apparatus of claim 6 wherein said detecting module is for:
    根据所述字符特征库中的第三字符类型检测每个待测文件的代码信息,确定与每个待测文件对应的代码行数,其中,所述第三字符类型包括:代码起始符和结束符。Determining code information of each file to be tested according to a third character type in the character feature library, and determining a number of code lines corresponding to each file to be tested, wherein the third character type includes: a code start character and End character.
  10. 如权利要求6-9任一所述的装置,其特征在于,所述处理模块还用于:The device according to any one of claims 6-9, wherein the processing module is further configured to:
    将包含所述文件名称与容量信息对应关系的报表保存到预设的路径中。Save the report containing the file name and capacity information to the preset path.
  11. 一种设备,包括:A device that includes:
    一个或者多个处理器;One or more processors;
    存储器;Memory
    一个或者多个程序,所述一个或者多个程序存储在所述存储器中,当被所述一个或者多个处理器执行时,执行以下步骤:One or more programs, the one or more programs being stored in the memory, and when executed by the one or more processors, performing the following steps:
    遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;Traversing all the files of the project to be tested, saving the file name and file path of each file to a preset global variable, and obtaining a file to be tested corresponding to the preset file type from the global variable;
    根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;Detecting code information of each file to be tested according to a preset character feature library, and determining capacity information corresponding to each file to be tested, where the capacity information includes: a number of code lines, a number of blank lines, and a number of comment lines;
    根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。The correspondence between the file name and the capacity information of each file to be tested is established according to a preset report format.
  12. 一种非易失性计算机存储介质,所述计算机存储介质存储有一个或者多个程序,当所述一个或者多个程序被一个设备执行时,使得所述设备执行以下步骤:A non-volatile computer storage medium storing one or more programs, when the one or more programs are executed by a device, causing the device to perform the following steps:
    遍历待测工程的所有文件,将每个文件的文件名称和文件路径保存到预设的全局变量中,从所述全局变量中获取与预设的文件类型对应的待测文件;Traversing all the files of the project to be tested, saving the file name and file path of each file to a preset global variable, and obtaining a file to be tested corresponding to the preset file type from the global variable;
    根据预设的字符特征库检测每个待测文件的代码信息,确定与每个待测文件对应的容量信息,所述容量信息包括:代码行数、空行行数以及注释行数;Detecting code information of each file to be tested according to a preset character feature library, and determining capacity information corresponding to each file to be tested, where the capacity information includes: a number of code lines, a number of blank lines, and a number of comment lines;
    根据预设的报表格式建立每个待测文件的文件名称与容量信息的对应关系。 The correspondence between the file name and the capacity information of each file to be tested is established according to a preset report format.
PCT/CN2016/102415 2016-04-19 2016-10-18 Method and device for processing capacity information of project file WO2017181631A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610245424.3A CN106407243A (en) 2016-04-19 2016-04-19 Capacity information processing method and apparatus for project files
CN201610245424.3 2016-04-19

Publications (1)

Publication Number Publication Date
WO2017181631A1 true WO2017181631A1 (en) 2017-10-26

Family

ID=58005860

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/102415 WO2017181631A1 (en) 2016-04-19 2016-10-18 Method and device for processing capacity information of project file

Country Status (2)

Country Link
CN (1) CN106407243A (en)
WO (1) WO2017181631A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113721824A (en) * 2021-08-10 2021-11-30 深圳市一博科技股份有限公司 Method for one-key setting of library path of CR5000 platform
CN116340186A (en) * 2023-05-25 2023-06-27 中汽研软件测评(天津)有限公司 Automobile electronic software detection system, method and medium
CN113721824B (en) * 2021-08-10 2024-05-03 深圳市一博科技股份有限公司 Method for setting library path by one key of CR5000 platform

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109558571A (en) * 2018-10-18 2019-04-02 深圳壹账通智能科技有限公司 File size recognition methods, device, computer equipment and storage medium
CN110427212A (en) * 2019-07-11 2019-11-08 上海易点时空网络有限公司 Suitable for the code statistical method and device of git, storage medium
CN110688320B (en) * 2019-09-30 2023-05-23 潍柴动力股份有限公司 Global variable detection method and device and terminal equipment
CN113609003A (en) * 2021-07-16 2021-11-05 深圳开源互联网安全技术有限公司 Code line number counting method, system, terminal and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5898872A (en) * 1997-09-19 1999-04-27 Tominy, Inc. Software reconfiguration engine
CN1395171A (en) * 2001-07-06 2003-02-05 华为技术有限公司 Code statistical tool of computer software program and its implementing method
CN101582072A (en) * 2008-05-16 2009-11-18 鸿富锦精密工业(深圳)有限公司 System and method for counting codes
CN101963970A (en) * 2010-01-12 2011-02-02 浪潮(山东)电子信息有限公司 Data statistics method with high efficiency and low maintenance
CN103699637A (en) * 2013-12-23 2014-04-02 国云科技股份有限公司 Code productivity statistic method and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103309747B (en) * 2013-05-20 2016-09-28 青岛海信传媒网络技术有限公司 The distribution method of a kind of code file statistics task and device
CN104750469B (en) * 2013-12-30 2018-01-02 中国银联股份有限公司 Source code statistical analysis technique and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5898872A (en) * 1997-09-19 1999-04-27 Tominy, Inc. Software reconfiguration engine
CN1395171A (en) * 2001-07-06 2003-02-05 华为技术有限公司 Code statistical tool of computer software program and its implementing method
CN101582072A (en) * 2008-05-16 2009-11-18 鸿富锦精密工业(深圳)有限公司 System and method for counting codes
CN101963970A (en) * 2010-01-12 2011-02-02 浪潮(山东)电子信息有限公司 Data statistics method with high efficiency and low maintenance
CN103699637A (en) * 2013-12-23 2014-04-02 国云科技股份有限公司 Code productivity statistic method and system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113721824A (en) * 2021-08-10 2021-11-30 深圳市一博科技股份有限公司 Method for one-key setting of library path of CR5000 platform
CN113721824B (en) * 2021-08-10 2024-05-03 深圳市一博科技股份有限公司 Method for setting library path by one key of CR5000 platform
CN116340186A (en) * 2023-05-25 2023-06-27 中汽研软件测评(天津)有限公司 Automobile electronic software detection system, method and medium
CN116340186B (en) * 2023-05-25 2023-09-19 中汽研软件测评(天津)有限公司 Automobile electronic software detection system, method and medium

Also Published As

Publication number Publication date
CN106407243A (en) 2017-02-15

Similar Documents

Publication Publication Date Title
WO2017181631A1 (en) Method and device for processing capacity information of project file
CN109086203B (en) Page detection method and device
US9430359B1 (en) Identifying and resolving software issues
US20120079460A1 (en) Instrumentation apparatus and method
US8353056B2 (en) Apparatus and method for detecting program plagiarism through memory access log analysis
US10643736B2 (en) Method, apparatus and electronic device for read/write speed testing
CA2811617C (en) Commit sensitive tests
CN111615688A (en) Assertion verification code binding method and device
CN108733674B (en) A2L file merging method and device
US20160314061A1 (en) Software Defect Detection Identifying Location of Diverging Paths
WO2015196962A1 (en) Method and apparatus for detecting changed data
US20150154103A1 (en) Method and apparatus for measuring software performance
CN110704686B (en) Quality detection method and device for semi-structured data, storage medium and equipment
CN108052441A (en) A kind of test method, system, device and the storage medium of hard disk performance level
CN110399132B (en) Method, device, computer equipment and storage medium for maintaining project codes
US8756580B2 (en) Instance-based field affinity optimization
CN108304330B (en) Content extraction method and device and computer equipment
CN107749838B (en) Method and device for detecting network hijacking
WO2019047392A1 (en) Differential line testing information determination method and device
CN109189672A (en) Automatic test approach, server and the computer readable storage medium of micro services
US8739279B2 (en) Implementing automatic access control list validation using automatic categorization of unstructured text
CN111400342A (en) Database updating method, device, equipment and storage medium
JP2020530629A (en) Technology that dynamically defines the format in a data record
CN111523179B (en) Pipe bundle checking method, device, equipment and storage medium
CN111124847A (en) Website user behavior analysis method and device

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16899215

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16899215

Country of ref document: EP

Kind code of ref document: A1