CN112000577B - Code checking method and device, electronic equipment and storage medium - Google Patents

Code checking method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112000577B
CN112000577B CN202010864996.6A CN202010864996A CN112000577B CN 112000577 B CN112000577 B CN 112000577B CN 202010864996 A CN202010864996 A CN 202010864996A CN 112000577 B CN112000577 B CN 112000577B
Authority
CN
China
Prior art keywords
list
code
target code
files
target
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
Application number
CN202010864996.6A
Other languages
Chinese (zh)
Other versions
CN112000577A (en
Inventor
马佳鑫
孙明昌
曲颖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Get Tianjin Culture Communication Co ltd
Original Assignee
Get Tianjin Culture Communication Co ltd
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 Get Tianjin Culture Communication Co ltd filed Critical Get Tianjin Culture Communication Co ltd
Priority to CN202010864996.6A priority Critical patent/CN112000577B/en
Publication of CN112000577A publication Critical patent/CN112000577A/en
Application granted granted Critical
Publication of CN112000577B publication Critical patent/CN112000577B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present disclosure relates to the field of computer technologies, and in particular, to a code checking method, a code checking device, an electronic device, and a storage medium. The code checking method provided by the specification comprises the following steps: acquiring a first list, wherein the first list comprises target code files, and the target code files are code files with specified suffix names and are target application programs; obtaining a second list, wherein the second list comprises target code fragments; globally scanning the target code files in the first list to determine whether the target code files contain target code fragments in the second list; if not, judging whether the first list has an abnormal code file or the second list has an abnormal code segment. The scheme can effectively and quickly sense the condition that certain code information is lost due to code change.

Description

Code checking method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a code checking method, a code checking device, an electronic device, and a storage medium.
Background
Code is a source file written by a programmer in a language supported by a development tool, and is a set of well-defined rules that represent information in discrete form by characters, symbols, or signal symbols. The embedded point is a common data acquisition method of network application products, and is mainly used for acquiring user behavior data, such as page access paths, what elements are clicked, and the like, and performing data analysis, so that a user can more reasonably arrange an operation plan.
Buried points exist in codes, and if the buried points are lost due to code modification, the outside is not perceived. Thus, there is a need in the art for a method that enables inspection of codes.
Disclosure of Invention
In view of this, the present embodiments provide a program code inspection method, apparatus, electronic device, and storage medium for inspecting codes to quickly and comprehensively inspect abnormal problems of the codes.
The embodiment of the specification adopts the following technical scheme:
the embodiment of the specification provides a code checking method, which comprises the following steps:
acquiring a first list, wherein the first list comprises target code files, and the target code files are code files with specified suffix names and are target application programs;
obtaining a second list, wherein the second list comprises target code fragments;
globally scanning the target code files in the first list to determine whether the target code files contain target code fragments in the second list;
if not, judging whether the first list has an abnormal code file or the second list has an abnormal code segment.
The present specification also provides a code inspection apparatus, the apparatus comprising: the first acquisition module is used for acquiring a first list, wherein the first list comprises target code files, and the target code files are code files with appointed suffix names;
the second acquisition module is used for acquiring a second list, and the second list comprises target code fragments;
the first scanning module is used for carrying out global scanning on the target code files in the first list so as to determine whether the target code files contain the target code fragments in the second list;
the first judging module is used for judging whether the first list has an abnormal code file or not or judging whether the second list has an abnormal code segment or not.
The present specification also provides an electronic apparatus including: at least one processor and a memory storing a program and configured to perform the above-described code checking method by the at least one processor.
The present specification also provides a computer-readable storage medium storing computer-executable instructions that when executed by a processor implement the code checking method described above.
The above-mentioned at least one technical scheme that this description embodiment adopted can reach following beneficial effect: the solution of the present specification determines whether the target code segment exists in the target code file in the first list by acquiring the first list containing the target code file and the second list containing the target code segment and then traversing all the target code segments step by step. Therefore, the abnormal condition of the target code segment or the target code file can be effectively and quickly perceived through the omnibearing automatic execution of the scanning code, and the condition of code loss caused by code modification is reduced. In addition, the scheme also improves the coverage rate and the test efficiency of the code regression test, and effectively saves human resources. Meanwhile, convenience of team cooperation can be improved, namely after abnormal codes are output, related personnel can check related abnormal code data and reasons, and therefore the problem is rapidly located.
Drawings
For a clearer description of embodiments of the present description or of solutions in the prior art, the drawings that are required to be used in the description of the embodiments or of the prior art will be briefly described, it being apparent that the drawings in the description below are only some of the embodiments described in the description, from which, without inventive faculty, other drawings can also be obtained for a person skilled in the art:
FIG. 1 is a main flow chart of a code checking method provided in an embodiment of the present disclosure;
FIG. 2 is a detailed flow chart of a buried point inspection method provided in an embodiment of the present disclosure;
fig. 3 is a block diagram of a code inspection apparatus provided in an embodiment of the present specification.
Detailed Description
In order to make the technical solutions in the present specification better understood by those skilled in the art, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
Referring to fig. 1, fig. 1 is a main flowchart of a code checking method provided in an embodiment of the present disclosure. As shown in fig. 1, the method of the present specification includes:
s110: a first list is obtained, the first list including object code files, the object code files being code files with specified suffix names and being targeted applications.
In this step, the file suffix name definition at each end is taken from the development language used in the code, for example: oc: '. m', java: '. java', etc.; each end refers to a system end for code running, such as an iOS end, an Android end and the like. When a code file specifying a suffix name is obtained, the file in the code may be found by recursion and written to the first list. Specifically, a current end code is firstly obtained, and the current end is a system end capable of running the code; then recursively searching the folders of each layer, and judging whether the next layer is a folder or a file; if the code file is a file and the file is a specified suffix, writing the code file into a first list; if the next layer is a folder, the next layer of the folder is accessed again until it is judged that the next layer is a file with a specified suffix name, the access is ended, and the code is written into the first list. In the above description, when the current end code is obtained, the latest technical code of the current end is generally pulled, and meanwhile, the built-in packet codes of H5 (html 5) and RN are updated in time. Furthermore, the files with the specified suffix names in the codes can be comprehensively and completely written into the first list in a recursive search mode.
Further, in this step, if there are multiple object code files with different specified suffix names, that is, when multiple object code files with different suffix names need to be acquired, the same object code files with the same specified suffix name in the object code files may be written into the same list, and the object code files with different specified suffix names in the object code files may be written into different lists, and the obtained multiple lists may be used as the first list. In other words, the files with the same specified suffix name are written into the same list, so that a plurality of lists are obtained, each list is a target code file with the same specified suffix name, and the plurality of lists are used as a first list.
S120: a second list is obtained, the second list including target code segments.
In the step, the data information of the target code segment can be acquired by accessing a data interface of the target code segment management platform; and writing the acquired data information of the target code fragments into a database as a target code fragment set, so that the target code fragment set corresponding to each end is prestored in the database. When the second list is required to be acquired, the target code segment corresponding to the current end code is screened from the database, and the screened target code segment is written into the list to obtain the second list.
In the above, the data information of the obtained object code segment may include a plurality of field information, such as the name, the marking mode, the priority, the version of the object code segment, and the like. After the first list is determined, according to the current end code corresponding to the target code file in the first list, the field information is screened from the target code fragment set, so that the corresponding target code fragment can be accurately obtained, and a second list is obtained.
S130: and performing global scanning on the target code files in the first list to determine whether the target code files contain the target code fragments in the second list.
S140: if not, judging whether the first list has an abnormal code file or the second list has an abnormal code segment.
In steps S130 to S140, based on the obtained first list and second list, each target code segment in the second list is obtained in turn, and for each target code segment, the following operations are performed: sequentially performing global scanning on the target code files in the first list, and if the corresponding target code segments are not scanned, determining that the target code segments are not contained in the target code files; if the corresponding target code segment is scanned, the scanning of the target code segment is ended.
For example, for a certain target code segment a in the second list, sequentially performing global scanning on the target code files in the first list, and ending the scanning if the target code segment a is scanned; then, for the next target code segment B in the second list, global scanning is sequentially performed on the target code files in the first list, and if the target code segment B is not scanned, it is indicated that the target code segment B is not present in the current end code. By traversing the target code segments in the first list, it can be determined which of the target code segments in the first list are not present in the current end code. In other words, if there is a target code segment in the second list that is not present in the target code file, it may be determined that the first list has an abnormal code file. It may also be determined that an abnormal code segment exists in the second list, that is, an object code segment in the second list that is not included in the object code file in the first list is taken as an abnormal code segment.
Before each target code segment in the second list is acquired in turn, the priority of the target code segment may be determined, where the priority is preset for the target code segment; and then determining the sequence of the target code fragments in the second list according to the priority, and sequentially acquiring each target code fragment in the second list according to the sequence.
Further, before global scanning is performed on the object code files in the first list, annotation data in the object code files in the first list may also be filtered. In this way, erroneous results of the scan due to annotated target code segments can be avoided.
Further, the method of the present specification further includes the step of performing a secondary check on the abnormal code. Specifically, the target code segment which is not contained in the target code file in the second list is used as an abnormal code segment, a third list is written, and the following operation is performed for each abnormal code in the third list: globally scanning files with specified suffix names of other ends except the current end to determine whether the abnormal code segment has an abnormal reason or not; if the abnormal reason exists, deleting the abnormal code segment from the third list; otherwise, the abnormal code segment is reserved in a third list, and the data information of the third list is inserted into a database.
Specifically, after the current end code is scanned, target code fragments which are not contained in the current end are screened out, then codes of other ends (if the current end is an iOS end, the other ends can be Android ends) are scanned based on the screened abnormal code fragments, and therefore the reasons of the abnormal codes are further checked. For example, if other configuration modes of a certain abnormal code segment exist at other ends, the abnormal code segment is indicated to exist in other configuration modes, and the abnormal code segment can be considered to be normal, i.e. the abnormal code segment can be deleted from the third list. If the exception code segment does not exist at the other end (i.e., the exception code segment does not exist in other configurations), it is indicated that the exception code segment does exist in question (i.e., the exception code segment is lost during code modification), i.e., the exception code segment may be maintained in the third list. And finally, inserting the third list after the secondary inspection into a database so as to facilitate other staff to inquire.
In the above description, the codes of the other ends are scanned, and it is not necessary to scan each target code segment in the second list, but rather scan the "abnormal codes" in the third list, so as to further check whether these "abnormal codes" are actually abnormal codes. That is, each end does not need to scan for the target code segment of the second list, so that code inspection efficiency can be greatly improved.
In order to more clearly illustrate the present solution, the following will describe the object code segment as a buried point in detail.
Referring to fig. 2, fig. 2 is a detailed flowchart of a buried point inspection method according to an embodiment of the present disclosure. In this embodiment, the following steps are performed:
s201: pulling a code of a scanning end; the scan end may be the end currently scanned, such as the iOS end and the Android end, and in this embodiment, the iOS end is not scanned. The latest technical code of the current end is generally pulled, and meanwhile, the built-in package codes of H5 (html 5) and RN are updated in time.
S203: a version number of the code is obtained.
S205: and circularly acquiring the file with the specified suffix name step by step. The step searches the folder of each layer by recursion, and judges whether the next layer is the folder or the file; if the next layer is a folder, revising the next layer of the folder until the next layer is judged to be the file with the specified suffix name, and ending the visit; if the file is the file, judging whether the file is the file with the specified suffix name.
S207: and writing the files with the same specified suffix name into the same list to obtain a first list.
S209: and accessing the embedded point management platform interface according to the version number of the code acquired in the step S203, and acquiring field information of all embedded points related to the version. These field information mainly include (ev, mode, prescripte, priority, version). Wherein ev: the buried point name is basic list information used for comparing buried points; mode: marking in a buried point mode, classifying the ends of the buried points through the information, and distinguishing the ends by using a character field os; describe: describing a triggering process of the buried point, and facilitating quick locking of a problem module when a problem is detected; priority: the priority of the buried points effectively performs priority investigation on the buried points with high priority; version: the version of the buried point belongs to and the effective basis of the abnormal problem version is positioned. And inserting the obtained buried data into a database so as to facilitate the inquiry and use of the subsequent steps.
S211: inquiring buried point information corresponding to the current scanning end according to the field information of the buried point. And (3) acquiring the relevant buried point information of each end by searching ev field information in the database and screening the os field. For example, the embedding point manner in which os mark includes "iOS" is as follows: automatic Android embedded with the iOS and embedded with the iOS at two ends; the embedding point modes of os marks including Android include: two-end manual burying, iOS automatic Android manual burying and Android manual burying; the buried spot means for os markers containing "H5" are: h5 is buried by hand. By flashing the os field, buried point data corresponding to the current end can be screened according to the current end.
S213: and screening out the corresponding buried point information insertion list to obtain a second list.
S215: and traversing the obtained first list and second list step by step in a circulating way. The method specifically comprises the following steps: s217: and acquiring buried point information of the second list in sequence. Wherein, the buried point information of the second list may be ordered according to priority; s219: and sequentially opening files with specified suffix names in the first list, filtering the notes, and performing global scanning. After traversing all the buried point information in the second list, step S219 is performed for each buried point information in the second list.
S221: and taking the unscanned buried points as abnormal buried points, and inserting the abnormal buried points into a list to obtain a third list. After step S215 is executed, that is, the first list and the second list are traversed in a stepwise and cyclic manner, if the corresponding buried point is scanned, the scanning is ended, and if the corresponding buried point is not scanned, the non-scanned buried point is used as an abnormal buried point and is inserted into the list, so as to obtain a third list.
S223: and carrying out global scanning on files with specified suffix names of other ends except the current end aiming at each abnormal buried point in the third list so as to judge whether the abnormal code has an abnormal reason or not. If the abnormal reason exists, deleting the abnormal buried point from the third list; otherwise, the abnormal buried point is kept in a third list. Specifically, after the current end code is scanned, the embedded points which are not contained in the current end are screened out, codes of other ends (if the current end is an iOS end, the other ends can be Android ends) are scanned based on the screened embedded points, and therefore the reasons of the abnormal embedded points are further checked. For example, if there is another arrangement of an abnormal buried point at the other end, it is indicated that there is another arrangement of the abnormal buried point, and the abnormal buried point may be considered to be normal, that is, the abnormal buried point may be deleted from the third list. If the abnormal buried point does not exist at other ends, the abnormal buried point is indicated to have a problem, and the abnormal buried point can be kept in the third list.
S225: and inserting the abnormal buried points finally reserved in the third list into a database. Thus, the inquiry of other people is facilitated.
S227: and displaying the abnormal buried point information at the front end. After step S225, the abnormal buried point information obtained by the inspection may be further displayed at the front end, so that other people can directly view the abnormal buried point information.
The above steps S201 to S227 are a method for checking the code embedded point. The example provides an effective checking method for the phenomenon of buried point loss caused by code change, and the abnormal condition of the buried point can be effectively and rapidly perceived through the omnibearing automatic execution of the scanning engineering code, so that the problem of buried point loss caused by code change is reduced. In this example, after the comparison buried point list (second list) and the code list (first list) of the specified suffix name file are obtained, the buried points are traversed step by step, whether the buried points exist or not is judged, if not, the buried points are saved to the database as abnormal buried points, and other staff can conveniently inquire. Therefore, not only is the coverage rate and the test efficiency of the buried point regression test improved, but also human resources can be effectively saved. Furthermore, the abnormal buried point information of the front-end display buried point automatic scanning can be built, namely, the detected abnormal buried point is displayed at the front end for relevant personnel to check. The buried point priorities are further distinguished, so that the buried points with high priorities can be inspected in a limited manner; meanwhile, the needed information can be screened through parameters such as different buried point names, different ends, different buried point modes and the like, and a buried point abnormal problem set of a historical version can be checked. Therefore, team cooperation is more convenient, and particularly after the buried point problem list is output, the front-end page can be accessed to view related data and reasons, so that the problem can be rapidly positioned.
The code inspection method according to the present invention is not limited to the inspection of buried points, and other similar target code segments or "key code segments" may be inspected by using the code inspection method according to the present invention.
Based on the same thought, the specification also provides a code checking device. Referring to fig. 3, fig. 3 is a block diagram showing the structure of a code inspection apparatus provided in the present specification. As shown in fig. 3, the apparatus includes:
the first obtaining module 301, where the first obtaining module 301 is configured to obtain a first list, where the first list includes an object code file, where the object code file is a code file with a specified suffix name;
the second obtaining module 302, the second obtaining module 302 is configured to obtain a second list, where the second list includes target code segments;
the first scanning module 303, the first scanning module 303 is configured to perform global scanning on the object code files in the first list, so as to determine whether the object code files contain the object code segments in the second list;
the first judging module 304, the first judging module 304 is configured to judge whether the first list has an abnormal code file or whether the second list has an abnormal code segment.
Further, the first judging module 304 is specifically configured to: and judging the target code fragments in the target code files which are not contained in the first list in the second list as abnormal code fragments.
Further, the apparatus further comprises:
a writing module 305, where the writing module 305 is configured to write, as an abnormal code segment, a target code segment in the second list, which is not included in the code file, into a third list;
a second scanning module 306, for each of the abnormal code segments in the third list, where the second scanning module 306 is configured to perform global scanning on files with specified suffix names of other ends except the current end, so as to determine whether an abnormal reason exists in the abnormal code segment; the current end is a system end capable of running the codes;
and a second judging module 307, where the second judging module 307 is configured to judge whether to delete the abnormal code segment from the third list according to the scanning result of the second scanning module 306.
Wherein the target code segment is a buried point.
For more detailed examples of the above code inspection apparatus, refer to the description of the code inspection method above, and are not repeated here.
Based on the same thought, the specification also provides electronic equipment, which comprises: at least one processor and a memory storing a program and configured to perform the above-described code checking method by the at least one processor.
Based on the same idea, the present specification also provides a computer-readable storage medium storing computer-executable instructions that when executed by a processor implement the code checking method described above.
The foregoing describes certain embodiments of the present disclosure, other embodiments being within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. Furthermore, the processes depicted in the accompanying drawings do not necessarily have to be in the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for apparatus, devices, non-transitory computer readable storage medium embodiments, the description is relatively simple, as it is substantially similar to method embodiments, with reference to portions of the description of method embodiments being relevant.
The apparatus, the device, the nonvolatile computer readable storage medium and the method provided in the embodiments of the present disclosure correspond to each other, and therefore, the apparatus, the device, and the nonvolatile computer storage medium also have similar advantageous technical effects as those of the corresponding method, and since the advantageous technical effects of the method have been described in detail above, the advantageous technical effects of the corresponding apparatus, device, and nonvolatile computer storage medium are not described herein again.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable Gate Array, FPGA)) is an integrated circuit whose logic function is determined by the programming of the device by a user. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented by using "logic compiler" software, which is similar to the software compiler used in program development and writing, and the original code before the compiling is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but not just one of the hdds, but a plurality of kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), lava, lola, myHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present specification.
It will be appreciated by those skilled in the art that the present description may be provided as a method, system, or computer program product. Accordingly, the present specification embodiments may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description embodiments may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
The description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary embodiments of the present disclosure and is not intended to limit the present disclosure. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.

Claims (15)

1. A code checking method, the method comprising:
acquiring a first list, wherein the first list comprises target code files, and the target code files are code files with specified suffix names and are target application programs;
the obtaining the first list specifically includes:
acquiring a current end code, wherein the current end is a system end capable of running the code;
searching an object code file in the current end code, and writing the object code file into a list to obtain the first list;
obtaining a second list, wherein the second list comprises target code fragments;
the obtaining the second list specifically includes:
screening target code fragments corresponding to the current end code from a database;
writing the screened target code fragments into a list to obtain a second list; the database is pre-stored with target code segment sets corresponding to all ends;
globally scanning the target code files in the first list to determine whether the target code files contain target code fragments in the second list;
if not, judging whether the first list has an abnormal code file or the second list has an abnormal code segment.
2. The method of claim 1, wherein object code fragments in the second list that are not included in the object code files in the first list are treated as exception code fragments.
3. The method according to claim 2, wherein writing the object code file into a list to obtain the first list, in particular comprises:
if a plurality of target code files with different specified suffix names exist, writing the files with the same specified suffix name in the target code files into the same list, writing the files with different specified suffix names in the target code files into different lists, and taking the obtained lists as the first list.
4. The method of claim 2, wherein the set of object code fragments in the database is obtained as follows:
accessing a data interface of a target code segment management platform, and acquiring data information of the target code segment;
and writing the acquired data information of the target code fragments into a database to serve as a target code fragment set.
5. The method of claim 4, wherein globally scanning the object code files in the first list to determine whether the object code files contain object code fragments in the second list comprises:
each target code segment in the second list is acquired in turn, and for each target code segment, the following operations are executed:
sequentially performing global scanning on the target code files in the first list, and if the corresponding target code segments are not scanned, determining that the target code segments are not contained in the target code files; if the corresponding target code segment is scanned, the scanning of the target code segment is ended.
6. The method of claim 5, wherein prior to sequentially performing a global scan of the object code files in the first list, the method further comprises:
and filtering the annotation data in the target code file.
7. The method of claim 5, wherein prior to sequentially retrieving each object code segment in the second list, the method further comprises:
determining a priority of the target code segment; wherein the priority is preset for the target code;
and determining the sequence of the target code fragments in the second list according to the priority, and sequentially acquiring each target code fragment in the second list according to the sequence.
8. The method according to any one of claims 3 to 7, further comprising:
writing target code fragments which are not contained in the target code file in the second list into a third list as abnormal code fragments;
for each exception code in the third list, performing the following:
globally scanning files with specified suffix names of other ends except the current end to determine whether the abnormal code segment has an abnormal reason or not;
if the abnormal reason exists, deleting the abnormal code segment from the third list; otherwise, the abnormal code segment is reserved in a third list, and the data information of the third list is inserted into a database.
9. The method of any one of claims 1 to 7, wherein the target code segment is a buried point.
10. A code inspection apparatus, the apparatus comprising:
the first acquisition module is used for acquiring a first list, wherein the first list comprises target code files, and the target code files are code files with appointed suffix names;
the obtaining the first list specifically includes:
acquiring a current end code, wherein the current end is a system end capable of running the code;
searching an object code file in the current end code, and writing the object code file into a list to obtain the first list;
the second acquisition module is used for acquiring a second list, and the second list comprises target code fragments;
the obtaining the second list specifically includes:
screening target code fragments corresponding to the current end code from a database;
writing the screened target code fragments into a list to obtain a second list; the database is pre-stored with target code segment sets corresponding to all ends;
the first scanning module is used for carrying out global scanning on the target code files in the first list so as to determine whether the target code files contain the target code fragments in the second list;
the first judging module is used for judging whether the first list has an abnormal code file or not or judging whether the second list has an abnormal code segment or not.
11. The apparatus of claim 10, wherein the first determining module is specifically configured to: and judging the target code fragments in the target code files which are not contained in the first list in the second list as abnormal code fragments.
12. The apparatus of claim 11, wherein the apparatus further comprises:
the writing module is used for writing target code fragments which are not contained in the code file in the second list into a third list as abnormal code fragments;
the second scanning module is used for carrying out global scanning on files with specified suffix names of other ends except the current end for each abnormal code segment in the third list so as to determine whether the abnormal code segment has an abnormal reason or not; the current end is a system end capable of running the codes;
and the second judging module is used for judging whether the abnormal code segment is deleted from the third list according to the scanning result of the second scanning module.
13. The apparatus according to any one of claims 10 to 12, wherein the target code segment is a buried point.
14. An electronic device, comprising: at least one processor and a memory storing a program and configured to perform the code checking method of any one of claims 1 to 9 by the at least one processor.
15. A computer readable storage medium storing computer executable instructions which when executed by a processor implement the code checking method of any one of claims 1 to 9.
CN202010864996.6A 2020-08-25 2020-08-25 Code checking method and device, electronic equipment and storage medium Active CN112000577B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010864996.6A CN112000577B (en) 2020-08-25 2020-08-25 Code checking method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010864996.6A CN112000577B (en) 2020-08-25 2020-08-25 Code checking method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112000577A CN112000577A (en) 2020-11-27
CN112000577B true CN112000577B (en) 2023-12-26

Family

ID=73471206

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010864996.6A Active CN112000577B (en) 2020-08-25 2020-08-25 Code checking method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112000577B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112631852B (en) * 2020-12-22 2023-04-28 海光信息技术股份有限公司 Macro checking method, macro checking device, electronic equipment and computer readable storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08328653A (en) * 1995-05-30 1996-12-13 Sanyo Electric Co Ltd Abnormal history display controller
CN101599039A (en) * 2008-06-03 2009-12-09 华为技术有限公司 Abnormality eliminating method and device under the embedded type C language environment
CN105975335A (en) * 2016-04-28 2016-09-28 乐视控股(北京)有限公司 Program exception recovery method and device
CN106250769A (en) * 2016-07-30 2016-12-21 北京明朝万达科技股份有限公司 The source code data detection method of a kind of multistage filtering and device
CN107609004A (en) * 2017-07-21 2018-01-19 深圳市小牛在线互联网信息咨询有限公司 Application program buries point methods and device, computer equipment and storage medium
CN109144852A (en) * 2018-07-25 2019-01-04 百度在线网络技术(北京)有限公司 Scan method, device, computer equipment and the storage medium of static code
CN109491923A (en) * 2018-12-14 2019-03-19 东软集团股份有限公司 Determination method, apparatus, medium and the electronic equipment of newly-increased abnormality code
CN109871319A (en) * 2019-01-18 2019-06-11 深圳壹账通智能科技有限公司 Item code scan method, device, computer equipment and storage medium
CN109947431A (en) * 2019-03-28 2019-06-28 北京字节跳动网络技术有限公司 A kind of code generating method, device, equipment and storage medium
CN110022304A (en) * 2019-03-07 2019-07-16 北京华安普特网络科技有限公司 A kind of website hung Trojan method for early warning

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10606728B2 (en) * 2016-09-06 2020-03-31 Sap Se Framework for detecting source code anomalies

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08328653A (en) * 1995-05-30 1996-12-13 Sanyo Electric Co Ltd Abnormal history display controller
CN101599039A (en) * 2008-06-03 2009-12-09 华为技术有限公司 Abnormality eliminating method and device under the embedded type C language environment
CN105975335A (en) * 2016-04-28 2016-09-28 乐视控股(北京)有限公司 Program exception recovery method and device
CN106250769A (en) * 2016-07-30 2016-12-21 北京明朝万达科技股份有限公司 The source code data detection method of a kind of multistage filtering and device
CN107609004A (en) * 2017-07-21 2018-01-19 深圳市小牛在线互联网信息咨询有限公司 Application program buries point methods and device, computer equipment and storage medium
CN109144852A (en) * 2018-07-25 2019-01-04 百度在线网络技术(北京)有限公司 Scan method, device, computer equipment and the storage medium of static code
CN109491923A (en) * 2018-12-14 2019-03-19 东软集团股份有限公司 Determination method, apparatus, medium and the electronic equipment of newly-increased abnormality code
CN109871319A (en) * 2019-01-18 2019-06-11 深圳壹账通智能科技有限公司 Item code scan method, device, computer equipment and storage medium
CN110022304A (en) * 2019-03-07 2019-07-16 北京华安普特网络科技有限公司 A kind of website hung Trojan method for early warning
CN109947431A (en) * 2019-03-28 2019-06-28 北京字节跳动网络技术有限公司 A kind of code generating method, device, equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Using Slicing to Identify Duplication in Source Code;Raghavan Komondoor等;International Static Analysis Symposium;第40–56页 *
恶意代码聚类分析研究;汪姝玮;中国优秀硕士学位论文全文数据库信息科技辑(第4期);第I138-296页 *
恶意代码防范技术的研究与实现;周峰;中国优秀硕士学位论文全文数据库信息科技辑(第11期);第I139-23页 *

Also Published As

Publication number Publication date
CN112000577A (en) 2020-11-27

Similar Documents

Publication Publication Date Title
US8484630B2 (en) Code motion based on live ranges in an optimizing compiler
CN107391101B (en) Information processing method and device
CN105468797B (en) A kind of information processing method and device
CN110262937A (en) A kind of recognition methods of Indexes Abnormality reason and device
CN108415941A (en) A kind of spiders method, apparatus and electronic equipment
CN108459913A (en) data parallel processing method, device and server
CN111241040A (en) Information acquisition method and device, electronic equipment and computer storage medium
CN115756449B (en) Page multiplexing method and device, storage medium and electronic equipment
CN116860259B (en) Method, device and equipment for model training and automatic optimization of compiler
CN112000577B (en) Code checking method and device, electronic equipment and storage medium
CN116502633A (en) Method and device for executing service, storage medium and electronic equipment
CN117828360A (en) Model training method, model training device, model code generating device, storage medium and storage medium
CN116048977B (en) Test method and device based on data reduction
CN116521705A (en) Data query method and device, storage medium and electronic equipment
CN116010419A (en) Method and device for creating unique index and optimizing logic deletion
CN109409037B (en) Method, device and equipment for generating data confusion rule
CN116861976A (en) Training method, device, equipment and storage medium of anomaly detection model
CN110442370B (en) Test case query method and device
CN109600418B (en) Method, device, equipment and system for tracking application access
CN113656290A (en) Mock point automatic identification method, device and equipment
CN116431465A (en) Interface matching method and device, storage medium and electronic equipment
CN114610410B (en) Parameter configuration method and device in simulation environment
CN116578993A (en) Risk feature data generation method, risk detection device and risk detection equipment
CN116028524A (en) Database operation method and device, storage medium and electronic equipment
CN117831642A (en) Gene data processing method, device, medium and electronic equipment

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