CN111581094B - Header file name detection method and device, storage medium and electronic equipment - Google Patents
Header file name detection method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN111581094B CN111581094B CN202010381594.0A CN202010381594A CN111581094B CN 111581094 B CN111581094 B CN 111581094B CN 202010381594 A CN202010381594 A CN 202010381594A CN 111581094 B CN111581094 B CN 111581094B
- Authority
- CN
- China
- Prior art keywords
- header
- target content
- file
- header file
- error detection
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/362—Debugging of software
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the disclosure discloses a method and a device for detecting a header file name, wherein the method comprises the following steps: extracting target content containing a quoted header file name from the code submitted at the time; determining whether a header file indicated by a header file name in the target content is in a currently used header file library; if the target content accords with the first error detection condition in the currently used header file library; and outputting first error information if the first error detection condition is met. The embodiment of the disclosure can detect the format of the reference header file in the code submitted at this time before the binary file is packed and generated, and an application program developer can modify the format of the reference header file in time according to the output error information, so that the binary file is packed successfully, and the efficiency of application program development is improved.
Description
Technical Field
The disclosure relates to the technical field of computers, in particular to a method and a device for detecting a header file name, a computer readable storage medium and electronic equipment.
Background
Currently, in application development, a header file needs to be referenced in a code, and there are various ways of referencing the header file, and there is no unified specification. For example: in object-c code, the way the header file is referenced includes import < A.h >, import < A/A.h >, and import 'a.h'. When the binary file is generated by packing, if the format of the reference header file is wrong, the packing failure can be caused. At this time, it is often necessary to manually find the cause of the error.
Disclosure of Invention
The embodiment of the disclosure provides a header file name detection method, a header file name detection device, a computer-readable storage medium and electronic equipment.
The embodiment of the disclosure provides a header file name detection method, which comprises the following steps: extracting target content containing a quoted header file name from the code submitted at the time; determining whether a header file indicated by a header file name in the target content is in a currently used header file library; if the target content accords with the first error detection condition in the currently used header file library; and outputting first error information if the first error detection condition is met.
In some embodiments, the first error detection condition is: the target content comprises at least one of a set of preset symbols.
In some embodiments, after determining whether the header indicated by the header name in the target content is in the currently used header library, the method further comprises: if not, determining whether the header file name meets a second error detection condition; and outputting second error information if the second error detection condition is met.
In some embodiments, after determining whether the header file name meets the second error detection condition, the method further comprises: and if the second error detection condition is not met and the header file library name included in the target content is not in the preset configuration file, outputting third error information.
In some embodiments, the second error detection condition is: the target content does not contain all of the preset symbol sets.
In some embodiments, extracting target content containing a referenced header filename from the currently submitted code includes: extracting a statement set formed by statements containing a quoted header file name from the submitted code, and outputting the statement set to a target file; performing duplication elimination treatment on the statement set in the target file to obtain a duplication-eliminated statement set; each statement in the deduplicated statement set is determined to be target content.
In some embodiments, the method further comprises: and deleting the target file in response to determining that the target content in the target file is extracted.
According to another aspect of the embodiments of the present disclosure, there is provided a header file name detecting apparatus including: the extraction module is used for extracting target content containing the head file name of the reference from the code submitted at the time; a first determining module, configured to determine whether a header indicated by a header name in the target content is in a currently used header library; a second determining module, configured to determine, if the target content meets a first error detection condition in a header file library currently used; and the first output module is used for outputting first error information if the first error detection condition is met.
In some embodiments, the first error detection condition is: the target content comprises at least one of a set of preset symbols.
In some embodiments, the apparatus further comprises: a third determining module, configured to determine, if the header file name does not meet the second error detection condition in the header file library that is currently used; and the second output module is used for outputting second error information if the second error detection condition is met.
In some embodiments, the apparatus further comprises: and the third output module is used for outputting third error information if the second error detection condition is not met and the header file library name included in the target content is not in the preset configuration file.
In some embodiments, the second error detection condition is: the target content does not contain all of the preset symbol sets.
In some embodiments, the extraction module comprises: the extraction unit is used for extracting a statement set formed by statements containing the head file names of references from the submitted codes and outputting the statement set to the target file; the duplicate removal unit is used for carrying out duplicate removal processing on the statement set in the target file to obtain a duplicate-removed statement set; and the determining unit is used for determining each statement in the duplicate removal statement set as target content.
In some embodiments, the apparatus further comprises: and the deleting module is used for deleting the target file in response to the fact that the target content in the target file is extracted.
According to another aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium storing a computer program for executing the above header filename detection method.
According to another aspect of an embodiment of the present disclosure, there is provided an electronic device including: a processor; a memory for storing processor-executable instructions; and the processor is used for reading the executable instructions from the memory and executing the instructions to realize the header file name detection method.
Based on the method, the device, the computer readable storage medium and the electronic equipment for detecting the header file names provided by the embodiments of the present disclosure, by extracting the target content including the reference header file names from the code submitted at this time, judging whether the reference header file is in the header file library used at present, if so, and if the header file names meet the first error detection condition in the header file library used at present, outputting the first error information, thereby realizing the detection of the format of the reference header file in the code submitted at this time before the binary file is generated by packaging, and the application program developer can modify the format of the reference header file in time according to the output error information, so as to ensure the success of packaging the binary file and improve the efficiency of application program development.
The technical scheme of the present disclosure is described in further detail below through the accompanying drawings and examples.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing embodiments thereof in more detail with reference to the accompanying drawings. The accompanying drawings are included to provide a further understanding of embodiments of the disclosure, and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure, without limitation to the disclosure. In the drawings, like reference numerals generally refer to like parts or steps.
Fig. 1 is a system diagram to which the present disclosure is applicable.
Fig. 2 is a flowchart illustrating a header name detection method according to an exemplary embodiment of the present disclosure.
Fig. 3 is a flowchart illustrating a header filename detection method according to another exemplary embodiment of the present disclosure.
Fig. 4 is a flowchart illustrating a header filename detection method according to still another exemplary embodiment of the present disclosure.
Fig. 5 is a schematic structural diagram of a header file name detecting apparatus according to an exemplary embodiment of the present disclosure.
Fig. 6 is a schematic structural view of a header filename detection apparatus provided in another exemplary embodiment of the present disclosure.
Fig. 7 is a block diagram of an electronic device provided in an exemplary embodiment of the present disclosure.
Detailed Description
Hereinafter, example embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present disclosure and not all of the embodiments of the present disclosure, and that the present disclosure is not limited by the example embodiments described herein.
It should be noted that: the relative arrangement of the components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless it is specifically stated otherwise.
It will be appreciated by those of skill in the art that the terms "first," "second," etc. in embodiments of the present disclosure are used merely to distinguish between different steps, devices or modules, etc., and do not represent any particular technical meaning nor necessarily logical order between them.
It should also be understood that in embodiments of the present disclosure, "plurality" may refer to two or more, and "at least one" may refer to one, two or more.
It should also be appreciated that any component, data, or structure referred to in the presently disclosed embodiments may be generally understood as one or more without explicit limitation or the contrary in the context.
In addition, the term "and/or" in this disclosure is merely an association relationship describing an association object, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" in the present disclosure generally indicates that the front and rear association objects are an or relationship.
It should also be understood that the description of the various embodiments of the present disclosure emphasizes the differences between the various embodiments, and that the same or similar features may be referred to each other, and for brevity, will not be described in detail.
Meanwhile, it should be understood that the sizes of the respective parts shown in the drawings are not drawn in actual scale for convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the techniques, methods, and apparatus should be considered part of the specification.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further discussion thereof is necessary in subsequent figures.
Summary of the application
When the binary file is generated by packing, if the format of the reference header file is wrong, the packing failure can be caused. At this time, it is usually time-consuming and laborious to find the cause of the error manually.
Exemplary System
Fig. 1 illustrates an exemplary system architecture 100 to which the header filename detection method or header filename detection apparatus of embodiments of the present disclosure may be applied.
As shown in fig. 1, a system architecture 100 may include a terminal device 101, a network 102, and a server 103. Network 102 is a medium used to provide communication links between terminal device 101 and server 103. Network 102 may include various connection types such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 103 via the network 102 using the terminal device 101 to receive or send messages or the like. The terminal device 101 may have various applications installed thereon, such as a programming application and the like.
The terminal device 101 may be various electronic devices including, but not limited to, mobile terminals such as mobile phones, notebook computers, PDAs (personal digital assistants), PADs (tablet computers), and the like, and fixed terminals such as desktop computers, and the like.
The server 103 may be a server providing various services, such as a background server providing support for programming applications on the terminal device 101. The background server may provide various dependency libraries for the terminal device.
It should be noted that, the header file name detection method provided by the embodiment of the present disclosure is generally performed by the terminal device 101, and accordingly, the header file name detection apparatus is generally provided in the server 103.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Exemplary method
Fig. 2 is a flowchart illustrating a header name detection method according to an exemplary embodiment of the present disclosure. The present embodiment is applicable to an electronic device (such as the terminal device 101 shown in fig. 1), and as shown in fig. 2, the method includes the following steps:
In this embodiment, the electronic device may extract the target content including the header file name of the reference from the code submitted at this time. The code submitted at this time may be a code in a file (e.g., a. C file,. Cpp file, etc.) currently being used by the application developer acquired by the electronic device, or a code manually selected and submitted by the application developer. Typically, the content containing the header file name has a certain tag. For example, in code developed by the IOS component, lines beginning with "# import" contain the head filename of the reference, which are the target content. As an example, a certain action #import "aaa.h" in the code submitted at this time, aaa.h is the header filename, and the row is the target content.
In this embodiment, the electronic device may extract the target content in various manners, for example, by detecting a code through a shell script and extracting the target content.
In this embodiment, the electronic device may determine whether the header file indicated by the header file name in the target content is in the currently used header file library. The header file library used currently can be a user-defined library or a library of an application development system.
In step 203, if in the header file library currently in use, it is determined whether the target content meets the first error detection condition.
In this embodiment, if the header indicated by the header name in the target content is in the currently used header library, the electronic device may determine whether the target content meets the first error detection condition. Wherein the first error detection condition is a condition that characterizes a reference format error of the header file name when the header file is in the currently used header file library. As an example, in the IOS componentized development environment, when a header file aaa.h is in the currently used header file library, the format referencing the header file is #import "aaa.h". If the target content does not follow the format, a first error detection condition is met.
In some alternative implementations, the first error detection condition may be: the target content comprises at least one of a set of preset symbols. As an example, the set of symbols may include, but is not limited to, at least one of the following symbols: < >/>. In the IOS componentized development environment, the symbols in the above-described symbol set need to be used when the referenced header file is not in the header file library currently in use. For example, when a header aaa.h is not in the currently used header library, the format referencing the header is #import < a/aaa.h >, where a is the header library in which aaa.h is located. If the target content includes any of the symbol sets, it may be determined that the format of the target content reference header file is incorrect. By setting the symbol set, if the target content comprises the symbols in at least one symbol set, the method and the device determine that the format of the reference header file is incorrect, so that whether the format of the reference header file of the target content is correct or not can be accurately determined, and the development efficiency of the application program is improved.
In this embodiment, if the target content meets the first error detection condition, the electronic device may output the first error information. Wherein the form of the first error information may include, but is not limited to, at least one of: text, images, symbols, etc. For example, the first error message may be "this header is in the library, requiring a 'header.h' reference, please modify".
In some alternative implementations, after step 202, the electronic device may also perform the steps of:
first, if it is determined that the header file indicated by the header file name in the target content is not in the currently used header file library, it is determined whether the header file name meets the second error detection condition. Wherein the second error detection condition is a condition that characterizes a reference format error of the header file name when the header file is not in the currently used header file library. As an example, in the IOS componentized development environment, if the currently used header file library is B, the header file aaa.h is referenced in library A, i.e., not in the currently used header file library, in the format #import < A/aaa.h >. If the target content does not follow the format, a second error detection condition is met.
Then, if it is determined that the second error detection condition is satisfied, second error information is output. Wherein the form of the second error information may include, but is not limited to, at least one of: text, images, symbols, etc. For example, the second error message may be "this header is in the other library, requiring < library name/header.h > mode reference, please modify".
By setting the second error detection condition, the method can judge whether the format of the reference header file is correct or not when the header file referenced by the target content is not in the currently used library, thereby further improving the accuracy of detecting the format of the reference header file.
In some alternative implementations, if the second error detection condition is not met, and the header repository name included in the target content is not in the preset configuration file, outputting third error information. The preset configuration file is used for configuring the header file library. By way of example, in an IOS componentized development environment, the preset configuration file may be a podspec file that describes a version of a pod library, including detailed information about where the source should be obtained, what files to use, build settings to apply, and other general metadata (such as its name, version, and description). Typically, if a header library is to be used, it should be added to the podspec first, and if the header library name is not in the preset configuration file, the header library cannot be used. As an example, the target content includes < a/aaa.h >, i.e., the header file aaa.h is in the library a, but the library a is not in the podspec, the third error information is output. Wherein the form of the third error information may include, but is not limited to, at least one of: text, images, symbols, etc. For example, the third error message may be "the library is not relied upon, please rely on correctly". According to the method, whether the header file name is in the preset configuration file is judged by not conforming to the second error detection condition, whether the header file library is correctly relied on can be determined, and therefore accuracy of detecting the format of the reference header file is further improved.
In some alternative implementations, the second error detection condition may be: the target content does not contain all of the preset symbol sets. Wherein the symbol set may be the same as the symbol set described in the alternative implementations above. As an example, the set of symbols may include the following symbols: < >/>. When the target content does not include all the symbols, i.e. the format of the reference header file is incorrect, the second error detection condition is met. By setting the symbol set, if the target content does not contain all of the preset symbol sets, the method and the device determine that the format of the reference header file is incorrect, so that whether the format of the reference header file of the target content is correct can be accurately determined, and the development efficiency of the application program is improved.
Referring now to FIG. 3, one exemplary flow chart of a header name detection method is shown.
In step 301, the electronic device circularly reads the target content in the code submitted this time, and executes steps 302-308 for each read target content.
In step 302, the electronic device determines whether the header file name in the target content is in the current library, and if so, performs step 303, and if not, performs step 305.
In step 303, the electronic device determines whether the target content includes at least one of < >,/and if so, performs step 304, if not, indicates that the format is correct, and ends.
In step 304, the electronic device may output a first error message.
In step 305, the electronic device determines whether the target content includes all of < >,/and if so, performs step 307, and if not, performs step 306.
In step 306, the electronic device may output a second error message.
In step 307, the electronic device determines whether the repository name in the target content is in the podspec, and if so, indicates that the format is correct, ending. If not, 308 is performed.
In step 308, the electronic device may output a third error message.
According to the method provided by the embodiment of the disclosure, the target content containing the quoted header file name is extracted from the code submitted at this time, whether the quoted header file is in the currently used header file library is judged, if the quoted header file is in the currently used header file library and the header file name accords with the first error detection condition, the first error information is output, so that the format of the quoted header file in the code submitted at this time is detected before the binary file is packed and generated, and an application program developer can timely modify the format of the quoted header file according to the output error information, so that the success of packing the binary file is ensured, and the efficiency of application program development is improved.
With further reference to FIG. 4, a flow diagram of yet another embodiment of a header filename detection method is shown. As shown in fig. 4, on the basis of the embodiment shown in fig. 2, step 201 may include the following steps:
and step 2011, extracting a statement set consisting of statements containing the head file names of references from the submitted codes, and outputting the statement set to the target file.
In this embodiment, the electronic device may extract a statement set composed of statements including the head filename of the reference from the code submitted at this time, and output the statement set to the target file. The target file may be various types of files, such as txt files, tablet files, and the like, among others. The target file may be created before executing the step, or may be created after extracting the statement set.
In step 2012, the statement set in the target file is subjected to duplication removal processing, so as to obtain a duplication-removed statement set.
In this embodiment, the electronic device may perform deduplication processing on the statement set in the target file, to obtain a deduplicated statement set. For example, the header A/aaa.h is referenced multiple times, i.e. there are multiple sentences #import "A/aaa.h" in the code submitted this time, one of the sentences can be reserved as a duplicate-removed sentence. Typically, the electronic device may first sort the sentences in the sentence set, and retain one of the same plurality of sentences according to the order.
And step 2013, determining each statement in the duplicate-removed statement set as target content.
In this embodiment, the electronic device may determine each sentence in the deduplicated sentence set as the target content. For each deduplicated statement, the following steps 202-204 are performed.
In some alternative implementations, the electronic device may delete the target file in response to determining that the target content in the target file has all been extracted. After each target content in the target file is executed in the steps 202-204, the target file is deleted, so that the aim of saving storage space can be achieved, and preparation can be made for next detection of the format of the reference header file.
The method provided by the corresponding embodiment of fig. 3 highlights the steps of outputting the statement including the head file name of the reference to the target file and determining the target content in the target file, so that when each target content is detected, the target content is not required to be retrieved from the code submitted at this time, but a plurality of target contents are stored in the target file, and the target content is directly extracted from the target file for detection, thereby improving the efficiency of detecting the head file reference format.
Exemplary apparatus
Fig. 5 is a schematic structural diagram of a header file name detecting apparatus according to an exemplary embodiment of the present disclosure. The present embodiment may be applied to an electronic device, as shown in fig. 5, where the header name detection apparatus includes: an extracting module 501, configured to extract, from the code submitted at this time, target content including a header file name of the reference; a first determining module 502, configured to determine whether a header indicated by a header name in the target content is in a currently used header library; a second determining module 503, configured to determine whether the target content meets the first error detection condition if in the header file library that is currently used; the first output module 504 is configured to output the first error information if the first error detection condition is met.
In this embodiment, the extraction module 501 may extract the target content including the header filename of the reference from the code submitted at this time. The code submitted at this time may be a code in a file (e.g., a. C file,. Cpp file, etc.) currently being used by the application developer acquired by the electronic device, or a code manually selected and submitted by the application developer. Typically, the content containing the header file name has a certain tag. For example, in code developed by the IOS component, lines beginning with "# import" contain the head filename of the reference, which are the target content. As an example, a certain action #import "aaa.h" in the code submitted at this time, aaa.h is the header filename, and the row is the target content. In this embodiment, the electronic device may extract the target content in various manners, for example, by detecting a code through a shell script and extracting the target content.
In this embodiment, the first determining module 502 may determine whether the header indicated by the header name in the target content is in the currently used header library. The header file library used currently can be a user-defined library or a library of an application development system.
In this embodiment, if the header indicated by the header name in the target content is in the currently used header library, the second determining module 503 may determine whether the target content meets the first error detection condition. Wherein the first error detection condition is a condition that characterizes a reference format error of the header file name when the header file is in the currently used header file library. As an example, in the IOS componentized development environment, when a header file aaa.h is in the currently used header file library, the format referencing the header file is #import "aaa.h". If the target content does not follow the format, a first error detection condition is met.
In this embodiment, the first output module 504 may output the first error information if the target content meets the first error detection condition. Wherein the form of the first error information may include, but is not limited to, at least one of: text, images, symbols, etc. For example, the first error message may be "this header is in the library, requiring a 'header.h' reference, please modify".
Referring to fig. 6, fig. 6 is a schematic structural view of a header file name detecting apparatus provided in another exemplary embodiment of the present disclosure.
In some alternative implementations, the first error detection condition may be: the target content comprises at least one of a set of preset symbols.
In some alternative implementations, the apparatus may further include: a third determining module 505, configured to determine, if the header file name does not exist in the header file library currently in use, whether the header file name meets a second error detection condition; and a second output module 506, configured to output a second error message if the second error detection condition is met.
In some alternative implementations, the apparatus may further include: and a third output module 507, configured to output third error information if the second error detection condition is not met and the header file library name included in the target content is not in the preset configuration file.
In some alternative implementations, the second error detection condition may be: the target content does not contain all of the preset symbol sets.
In some alternative implementations, the extraction module 501 may include: an extracting unit 5011, configured to extract a statement set composed of statements including a head file name of a reference from a code submitted at this time, and output the statement set to a target file; the deduplication unit 5012 is configured to perform deduplication processing on the statement set in the target file, so as to obtain a deduplicated statement set; a determining unit 5013 for determining each sentence in the duplicate-removed sentence set as a target content.
In some alternative implementations, the apparatus further includes: and the deleting module 508 is used for deleting the target file in response to determining that the target content in the target file is extracted.
According to the header file name detection device provided by the embodiment of the disclosure, the target content containing the quoted header file name is extracted from the code submitted at this time, whether the quoted header file is in the header file library used at present is judged, if the quoted header file is in the header file library used at present and the header file name accords with the first error detection condition, the first error information is output, so that the format of the quoted header file in the code submitted at this time is detected before the binary file is generated by packaging, and an application program developer can timely modify the format of the quoted header file according to the output error information, so that the packaging success of the binary file is ensured, and the efficiency of application program development is improved.
Exemplary electronic device
Next, an electronic device according to an embodiment of the present disclosure is described with reference to fig. 7. The electronic device may be a terminal device 101 as shown in fig. 1.
Fig. 7 illustrates a block diagram of an electronic device according to an embodiment of the disclosure.
As shown in fig. 7, an electronic device 700 includes one or more processors 701 and memory 702.
The processor 701 may be a Central Processing Unit (CPU) or other form of processing unit having data processing and/or instruction execution capabilities, and may control other components in the electronic device 700 to perform desired functions.
Memory 702 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. Volatile memory can include, for example, random Access Memory (RAM) and/or cache memory (cache) and the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, and the like. One or more computer program instructions may be stored on a computer readable storage medium and the processor 701 may execute the program instructions to implement the header filename detection methods and/or other desired functions of the various embodiments of the present disclosure above. Various contents such as code files may also be stored in the computer readable storage medium.
In one example, the electronic device 700 may further include: input device 703 and output device 704, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
For example, when the electronic device is the terminal device 101, the input device 703 may be a mouse, a keyboard, or the like for inputting text to be detected.
The output device 704 may output various information including error information to the outside. The output device 704 may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, etc.
Of course, only some of the components of the electronic device 700 that are relevant to the present disclosure are shown in fig. 7 for simplicity, components such as buses, input/output interfaces, etc. are omitted. In addition, the electronic device 700 may include any other suitable components depending on the particular application.
Exemplary computer program product and computer readable storage Medium
In addition to the methods and apparatus described above, embodiments of the present disclosure may also be a computer program product comprising computer program instructions which, when executed by a processor, cause the processor to perform the steps in a header filename detection method according to various embodiments of the present disclosure described in the above "exemplary methods" section of the present description.
The computer program product may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present disclosure may also be a computer-readable storage medium, having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform the steps in a header filename detection method according to various embodiments of the present disclosure described in the above "exemplary methods" section of the present description.
A computer readable storage medium may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The basic principles of the present disclosure have been described above in connection with specific embodiments, however, it should be noted that the advantages, benefits, effects, etc. mentioned in the present disclosure are merely examples and not limiting, and these advantages, benefits, effects, etc. are not to be considered as necessarily possessed by the various embodiments of the present disclosure. Furthermore, the specific details disclosed herein are for purposes of illustration and understanding only, and are not intended to be limiting, since the disclosure is not necessarily limited to practice with the specific details described.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different manner from other embodiments, so that the same or similar parts between the embodiments are mutually referred to. For system embodiments, the description is relatively simple as it essentially corresponds to method embodiments, and reference should be made to the description of method embodiments for relevant points.
The block diagrams of the devices, apparatuses, devices, systems referred to in this disclosure are merely illustrative examples and are not intended to require or imply that the connections, arrangements, configurations must be made in the manner shown in the block diagrams. As will be appreciated by one of skill in the art, the devices, apparatuses, devices, systems may be connected, arranged, configured in any manner. Words such as "including," "comprising," "having," and the like are words of openness and mean "including but not limited to," and are used interchangeably therewith. The terms "or" and "as used herein refer to and are used interchangeably with the term" and/or "unless the context clearly indicates otherwise. The term "such as" as used herein refers to, and is used interchangeably with, the phrase "such as, but not limited to.
The methods and apparatus of the present disclosure may be implemented in a number of ways. For example, the methods and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, firmware. The above-described sequence of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the sequence specifically described above unless specifically stated otherwise. Furthermore, in some embodiments, the present disclosure may also be implemented as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present disclosure. Thus, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
It is also noted that in the apparatus, devices and methods of the present disclosure, components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered equivalent to the present disclosure.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the disclosure. Thus, the present disclosure is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of the disclosure to the form disclosed herein. Although a number of example aspects and embodiments have been discussed above, a person of ordinary skill in the art will recognize certain variations, modifications, alterations, additions, and subcombinations thereof.
Claims (14)
1. A header filename detection method comprising:
extracting target content containing a quoted header file name from the code submitted at the time;
determining whether a header file indicated by a header file name in the target content is in a currently used header file library;
if the target content meets the first error detection condition in the currently used header file library, determining whether the target content meets the first error detection condition;
outputting first error information if the first error detection condition is met;
the extracting the target content containing the quoted header file name from the code submitted at the time comprises the following steps:
extracting a statement set formed by statements containing a quoted header file name from the code submitted at the time, and outputting the statement set to a target file;
performing duplication elimination treatment on the statement set in the target file to obtain a duplication-eliminated statement set;
and determining each statement in the duplicate-removed statement set as target content.
2. The method of claim 1, wherein the first error detection condition is: the target content comprises at least one of a preset set of symbols.
3. The method of claim 1, wherein after the determining whether the header indicated by the header name in the target content is in a currently used header library, the method further comprises:
if not, determining whether the header file name meets a second error detection condition;
and outputting second error information if the second error detection condition is met.
4. A method according to claim 3, wherein after said determining whether the header file name meets a second error detection condition, the method further comprises:
and if the second error detection condition is not met and the header file library name included in the target content is not in the preset configuration file, outputting third error information.
5. The method of claim 3 or 4, wherein the second error detection condition is: the target content does not contain all of the preset symbol sets.
6. The method of claim 1, wherein the method further comprises:
and deleting the target file in response to determining that the target content in the target file is extracted.
7. A header filename detection apparatus comprising:
the extraction module is used for extracting target content containing the head file name of the reference from the code submitted at the time;
a first determining module, configured to determine whether a header indicated by a header name in the target content is in a currently used header library;
a second determining module, configured to determine, if the target content meets a first error detection condition in a header file library that is currently used;
the first output module is used for outputting first error information if the first error detection condition is met;
the extraction module comprises:
the extraction unit is used for extracting a statement set formed by statements containing a head file name of a reference from the code submitted at the time and outputting the statement set to a target file;
the duplicate removal unit is used for carrying out duplicate removal processing on the statement set in the target file to obtain a duplicate removed statement set;
and the determining unit is used for determining each statement in the duplicate removal statement set as target content.
8. The apparatus of claim 7, wherein the first error detection condition is: the target content comprises at least one of a preset set of symbols.
9. The apparatus of claim 7, wherein the apparatus further comprises:
a third determining module, configured to determine, if the header file name does not meet a second error detection condition in a header file library that is currently used;
and the second output module is used for outputting second error information if the second error detection condition is met.
10. The apparatus of claim 9, wherein the apparatus further comprises:
and the third output module is used for outputting third error information if the second error detection condition is not met and the header file library name included in the target content is not in the preset configuration file.
11. The apparatus of claim 9 or 10, wherein the second error detection condition is: the target content does not contain all of the preset symbol sets.
12. The apparatus of claim 7, wherein the apparatus further comprises:
and the deleting module is used for deleting the target file in response to determining that the target content in the target file is extracted.
13. A computer readable storage medium storing a computer program for performing the method of any one of the preceding claims 1-6.
14. An electronic device, the electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor is configured to read the executable instructions from the memory and execute the instructions to implement the method of any of the preceding claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010381594.0A CN111581094B (en) | 2020-05-08 | 2020-05-08 | Header file name detection method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010381594.0A CN111581094B (en) | 2020-05-08 | 2020-05-08 | Header file name detection method and device, storage medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111581094A CN111581094A (en) | 2020-08-25 |
CN111581094B true CN111581094B (en) | 2023-06-23 |
Family
ID=72113407
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010381594.0A Active CN111581094B (en) | 2020-05-08 | 2020-05-08 | Header file name detection method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111581094B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109344056A (en) * | 2018-09-07 | 2019-02-15 | 武汉达梦数据库有限公司 | A test method and test device |
CN110928797A (en) * | 2019-11-29 | 2020-03-27 | 五八有限公司 | Code coupling detection method and device, terminal equipment and storage medium |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0706683B1 (en) * | 1993-07-01 | 2000-09-13 | BRITISH TELECOMMUNICATIONS public limited company | Apparatus and method for developping software |
US5761510A (en) * | 1995-11-07 | 1998-06-02 | Microsoft Corporation | Method for error identification in a program interface |
JP6091471B2 (en) * | 2014-08-08 | 2017-03-08 | 三菱電機株式会社 | Source code analysis apparatus, source code analysis method, and source code analysis program |
US9928156B2 (en) * | 2015-10-23 | 2018-03-27 | Microsoft Technology Licensing, Llc. | Missing include suggestions for external files |
CN107643893B (en) * | 2016-07-22 | 2020-12-29 | 腾讯科技(深圳)有限公司 | Program detection method and device |
CN106294156B (en) * | 2016-08-11 | 2018-12-07 | 北京邮电大学 | A kind of static code fault detection analysis method and device |
-
2020
- 2020-05-08 CN CN202010381594.0A patent/CN111581094B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109344056A (en) * | 2018-09-07 | 2019-02-15 | 武汉达梦数据库有限公司 | A test method and test device |
CN110928797A (en) * | 2019-11-29 | 2020-03-27 | 五八有限公司 | Code coupling detection method and device, terminal equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111581094A (en) | 2020-08-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111736840A (en) | Compiling method and running method of applet, storage medium and electronic equipment | |
CN113760729B (en) | A code detection method and device | |
CN111475196B (en) | Compiling alarm tracing method and device, electronic equipment and computer readable medium | |
CN110688096B (en) | Method and device for constructing application program containing plug-in, medium and electronic equipment | |
CN111897778B (en) | Computer file merging method, device and system | |
CN116755745A (en) | Plug-in updating method, device and equipment of code editor and storage medium | |
CN113094085B (en) | Component integration method, device, computer readable storage medium and electronic equipment | |
CN111581094B (en) | Header file name detection method and device, storage medium and electronic equipment | |
US9990339B1 (en) | Systems and methods for detecting character encodings of text streams | |
CN111783482A (en) | Text translation method and device, computer equipment and storage medium | |
CN113076084A (en) | Resource file processing method, device, equipment and storage medium | |
CN115080114B (en) | Application program transplanting processing method, device and medium | |
CN114090135B (en) | Method and device with error correction function and supporting cross-platform calling component | |
CN110543641A (en) | chinese and foreign language information comparison method and device | |
CN115934151A (en) | Method and device for building multi-terminal small program | |
CN111985235B (en) | Text processing method, text processing device, computer readable storage medium and electronic equipment | |
CN111695327B (en) | Method and device for repairing messy codes, electronic equipment and readable storage medium | |
US9305117B2 (en) | String generation tool | |
JP2018084939A (en) | Correction support program, correction support method, correction support device, and compiler | |
CN109840273B (en) | Method and device for generating file | |
CN114490400A (en) | Method and device for processing test cases | |
CN109684437B (en) | Content alignment method, device, storage medium and equipment for file comparison | |
CN113268617A (en) | Method and device for detecting metadata of papers | |
CN113408250B (en) | Project file processing method and device | |
CN110990593A (en) | Citation fall detection method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |