Nothing Special   »   [go: up one dir, main page]

CN112433730B - Code detection rule generation method and device and electronic equipment - Google Patents

Code detection rule generation method and device and electronic equipment Download PDF

Info

Publication number
CN112433730B
CN112433730B CN202011325605.XA CN202011325605A CN112433730B CN 112433730 B CN112433730 B CN 112433730B CN 202011325605 A CN202011325605 A CN 202011325605A CN 112433730 B CN112433730 B CN 112433730B
Authority
CN
China
Prior art keywords
rule
name
generating
code detection
full
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
CN202011325605.XA
Other languages
Chinese (zh)
Other versions
CN112433730A (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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202011325605.XA priority Critical patent/CN112433730B/en
Publication of CN112433730A publication Critical patent/CN112433730A/en
Application granted granted Critical
Publication of CN112433730B publication Critical patent/CN112433730B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3628Software debugging of optimised code

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

After detecting the rule setting operation, the method, the device and the electronic equipment for generating the code detection rule display a rule identification list for selection by a user, and the user can determine a target rule generating function by executing a triggering operation on the rule identification list and display an input interface for inputting rule generating parameters by the user, and can generate the target code detection rule after the user inputs the rule generating parameters. That is, it is not necessary to write a rule generating function when setting code detection rules as in the related art. Meanwhile, as the target generating function can be determined only by selecting the rule marks in the rule mark list, the difficulty of detecting the rule by the user-defined code is reduced, and the process of detecting the rule by the user-defined code is simplified.

Description

Code detection rule generation method and device and electronic equipment
Technical Field
The disclosure relates to the technical field of internet, and in particular relates to a method and a device for generating a code detection rule and electronic equipment.
Background
Along with the development of scientific technology, various application frequency is promoted, so that the life style of people becomes more convenient.
In the software project development process, because the software project is a compiled execution language, language rules are required to be high, and development teams often spend a great deal of time and effort to discover and modify code defects. The static code analysis tool can help developers to quickly and effectively locate code defects and correct the problems in time, so that the software reliability is greatly improved. That is, during editing of application code, the quality of the code is typically guaranteed by static code detection.
Disclosure of Invention
This disclosure is provided in part to introduce concepts in a simplified form that are further described below in the detailed description. This disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
The embodiment of the disclosure provides a method, a device and electronic equipment for generating a code detection rule, which can enable a user to not need to know a complete grammar tree when customizing the code detection rule, and reduce the difficulty of the code detection rule customized by the user.
In a first aspect, an embodiment of the present disclosure provides a method for generating a code detection rule, including: in response to detecting the rule setting operation, displaying a rule identification list; determining a target rule generating function based on triggering operation aiming at rule identifiers in the rule identifier list, and displaying an input interface; and generating an object code detection rule based on the object rule generation function and the rule generation parameter input by the input interface.
In a second aspect, an embodiment of the present disclosure provides a code detection rule generating apparatus, including: the display unit is used for responding to the detection of the rule setting operation and displaying a rule identification list; a determining unit, configured to determine a target rule generating function based on a triggering operation for a rule identifier in the rule identifier list, and display an input interface; and the generating unit is used for generating an object code detection rule based on the object rule generating function and the rule generating parameters input by the input interface.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including: one or more processors; and a storage device for storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the method for generating a code detection rule as described in the first aspect.
In a fourth aspect, an embodiment of the present disclosure provides a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method for generating a code detection rule as described in the first aspect.
According to the code detection rule generation method, the code detection rule generation device and the electronic equipment, after the rule setting operation is detected, a rule identification list is displayed for selection by a user, the user can determine a target rule generation function by executing the triggering operation on the rule identification list, an input interface can be displayed for the user to input rule generation parameters, and after the user inputs the rule generation parameters, the target code detection rule can be generated. That is, it is not necessary to write a rule generating function when setting code detection rules as in the related art. Meanwhile, as the target generating function can be determined only by selecting the rule marks in the rule mark list, the difficulty of detecting the rule by the user-defined code is reduced, and the process of detecting the rule by the user-defined code is simplified.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a flow chart of one embodiment of a method of generating code detection rules according to the present disclosure;
FIG. 2 is an interface schematic diagram of one embodiment of a method of generating code detection rules according to the present disclosure;
FIG. 3 is an interface schematic diagram of yet another embodiment of a method of generating code detection rules according to the present disclosure;
FIG. 4 is an interface schematic diagram of yet another embodiment of a method of generating code detection rules according to the present disclosure;
FIG. 5 is a schematic diagram of a structure of one embodiment of a generating device of code detection rules according to the present disclosure;
FIG. 6 is an exemplary system architecture to which the generation method of code detection rules of one embodiment of the present disclosure may be applied;
fig. 7 is a schematic view of a basic structure of an electronic device provided according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Referring to fig. 1, a flow of one embodiment of a method of generating code detection rules according to the present disclosure is shown. The code detection rule generation method can be applied to terminal equipment. The method for generating the code detection rule as shown in fig. 1 comprises the following steps:
in step 101, in response to detecting the rule setting operation, a rule identification list is presented.
In some embodiments, the rule identifications in the rule identification list correspond to a rule generation function.
In some embodiments, the code versions used by different development teams, different applications, may all be different, while each development team may have some specific requirements in writing the code. Such as some teams may prohibit calling a method of a certain class when writing code; some teams may prohibit creation of objects of a specified class while writing code; some teams may prohibit inheritance of a class, etc. when writing code. And herein, the code detection rule can be regarded as: specific requirements in code writing. That is, disabling a method that invokes a class may be considered a code detection rule.
In some embodiments, in order for each code development team to create code detection rules that are self-proprietary, static code detection tools typically support user-defined code detection rules, such as the lin rule may be customized at AndroidStudio. In the related art, if a development team needs to disable a method of a certain class, a set of functions for disabling the class can be written in the static code detection tool, and the method of the certain class, which needs to be specifically disabled, can be filled in at the disabled parameter position in the functions. If the class A function needs to be forbidden to be called, the name of the class A function can be filled in the forbidden parameter position, so that the static code detection tool detects the class A function when detecting codes, and prompt information is automatically generated. That is, in the related art, when a user needs to customize a code detection rule, at least a rule generation function needs to be written, and a class name needs to be filled.
In some embodiments, to simplify the way in which a user is setting code detection rules, a rule generation function (code detection rule generation function) may be associated with rule identifications, i.e., each rule identification may characterize a class of rule generation functions. As shown in fig. 2, a rule flag a may correspond to a rule generating function that prohibits calling a certain class of functions, a rule flag B may correspond to a rule generating function that prohibits creating a certain class of functions, and a rule flag C may correspond to a rule function that prohibits inheriting a certain class of functions. Therefore, if the user needs a certain rule generating function, the rule identifier corresponding to the rule generating function can be directly triggered.
In the specific embodiment, the rule generating functions are numerous, and if all rule generating functions are set with corresponding rule identifiers, it may take a lot of time for the user to find the required rule identifier. Therefore, a rule generating function with higher frequency of use by some users can be selected, and a rule identifier corresponding to the rule generating function with higher frequency of use by the users can be created.
Of course, the rule identifiers specifically set to create the correspondence for those rule generating functions may be set according to actual situations, and are not limited herein. For example, it may include: a rule generation function that prohibits a method of calling a certain class, a rule generation function that prohibits creation of an object of a specified class, a rule generation function that prohibits inheritance of a certain class, a rule generation function that prohibits the use of a certain class in an appearance code, a rule generation function that does not allow definition of a certain attribute under a specified element in an xml (Extensible Markup Language ) file, a rule generation function that implements a class of an interface that must be placed under a specified package, and the like.
In some embodiments, the rule set operation may be understood as: and setting an interface on the custom rule, and utilizing a click operation, a double click operation and the like of a right button of the mouse. Of course, what type of operation the specific rule setting operation is not limited herein, and only needs to be set reasonably according to actual situations.
Step 102, determining a target rule generating function based on the triggering operation for the rule identifications in the rule identification list, and displaying an input interface.
In some embodiments, a triggering operation for a rule identifier in a list of rule identifiers may be understood as a single click operation, a double click operation, etc. for the rule identifier.
In some embodiments, after the trigger operation is performed on the rule identifier in the rule identifier list, the target rule generating function may be determined, and the code detection rule generation requires the rule generating function and the rule generating parameter, so that an input interface may be presented at this time for the user to input the rule generating parameter.
And step 103, generating an object code detection rule based on the object rule generation function and the rule generation parameters input by the input interface.
In some embodiments, the target code detection rule may be generated after the rule generation function and the rule generation parameters are determined, i.e., it may be understood that the generation of one code detection rule is completed.
It can be seen that, in the embodiment of the present application, after detecting the rule setting operation, a rule identifier list is displayed for the user to select, and the rule identifier corresponds to the rule generating function, that is, the user may determine the target rule generating function by performing the triggering operation on the rule identifier list, and may display an input interface for the user to input the rule generating parameter, and after the user inputs the rule generating parameter, the target code detection rule may be generated. That is, it is not necessary to write a rule generating function when setting code detection rules as in the related art. Meanwhile, as the rule generating function is edited in advance, the user only needs to select the rule generating function, the difficulty of detecting the rule by the user-defined code is reduced, namely, the process of detecting the rule by the user-defined code is simplified.
In some embodiments, after the custom code detection rule generation is completed, the code may be detected using the generated completed object code detection rule. If the custom code detection rule is to prohibit calling a certain class, if the class is called in the code, prompt information can be generated to prompt the user that the function calling the prohibited class exists in the code, and adjustment needs to be made, so that the quality of the code is improved.
In some embodiments, step 103 (generating the target code detection rule based on the target rule generation function and the rule generation parameters entered by the input interface) may specifically include:
Responding to the detection that the input rule generation parameters are class names, and displaying at least one full-limit name comprising the class names; an object code detection rule is generated based on the selection operation for the exposed full-qualified name and the object rule generation function.
In some embodiments, some systems may have some kind of function at multiple locations, e.g., a function of a storage class exists at the system level and also at the application level. While the user may only need a storage class function of only a certain application layer when disabling the function of the storage class. Therefore, at this time, the fully-defined name (class name+path name) of the class function needs to be input.
In the related art, when a user disables a function of a certain class, not only a class name but also a path name needs to be input. Thus, a user may be required to have a high familiarity with the syntax tree, while a user unfamiliar with the syntax number may not be able to customize the code detection rules.
In this embodiment, in order to further simplify the process of detecting the user-defined code, when the user inputs a complete class name, a fully-defined name including the class name may be displayed. That is, the user only needs to select the displayed full-defined name, and does not need to input the complete full-defined name, so that the method for detecting the rule by the user-defined code is simplified.
For example, referring to fig. 3, in fig. 3, when the class name input by the user at the input interface is 'xx', the full-term names displayed at the display interface may include: 'xxyyy', 'xxyy', 'xxyyyz', etc., i.e., 'xx' may characterize class names, while 'yyy', 'yy', 'yyyz' may characterize path names. By the method, a user does not need to know which of the full-limit names corresponding to each class exists, but only needs to select the full-limit names, and the method for detecting the rules by the user-defined codes is greatly simplified.
In some embodiments, since a large number of classes are included in the system, in order to enable a user to quickly display a full-limit name after inputting a class name, a pre-created full-limit name correspondence table may be obtained, where a correspondence between class names and authority names is included in the full-limit name correspondence table, and at least one full-limit name may be determined and displayed according to the full-limit name correspondence table and the input class names.
In some embodiments, the full-defined names including the same class names may be categorized and corresponding identifiers generated, that is, the full-defined name correspondence table may also be understood as the correspondence between the identifiers and the class names. For example, the class A function corresponds to the identifier A, and the storage address indicated by the identifier A may have stored therein a full-qualified name that includes the class A function. At this time, when the user inputs the function name of the class a function, at least one full-defined name may be presented on the presentation interface.
It can be seen that, through the setting mode, after the class name is input by the user, the user does not need to search for the full-limit names including the class name, but obtains the full-limit names corresponding to the class name according to the full-limit name corresponding table, that is, the speed of displaying the full-limit names is improved. And the user can quickly select the required full-limit name, so that the efficiency of creating the custom code detection rule by the user can be improved.
In some embodiments, the number of fully qualified names corresponding to different class names may be different, and thus different presentation interfaces may be set for the class names. Here, a presentation interface may be understood as a GUI interface (GRAPHICAL USER INTERFACE ) in which full-defined names are used as configuration items. That is, the full-defined name is included in the GUI interface. That is, in the GUI interface, the presentation order of the full-name names, the presentation size of the full-name names, and the like may be set. For example, full-name displays that a user may use may be bolded, full-name smaller displays that a user may not use frequently, and so on.
It can be seen that through the setting mode, the user can be further prompted to select the required rate of full-limit names, and the efficiency of creating the custom code detection rule by the user can be further improved.
In some embodiments, since multiple methods may be included in a class, a user may only need to have restrictions on a certain method in a certain class (i.e., only need to have restrictions on a certain method in a certain class to set code check rules). In the related art, a full scale of the method needs to be input; that is, when a user needs to disable a certain method in a certain class, not only is he required to write a disable function, but also input may be required: class name + pathname + method name, that is, the user needs to know that a certain class specifically includes those methods, so that the difficulty of generating the custom code detection rule is further improved.
In some embodiments, after a selection operation for the full-qualified name is detected, a method name corresponding to the selected full-qualified name may be presented, and an object code detection rule may be generated according to the selection operation of the method name and the object rule generation function.
In some embodiments, i.e., after the user selects the full qualified name, the method name associated with the rights qualified name may be presented directly.
In some embodiments, a method name correspondence table may also be set, where the method name correspondence table includes a correspondence between full-limit names and method names, so that the speed of displaying the method names may also be improved, and the efficiency of generating the code detection rule may also be improved.
In some embodiments, please refer to fig. 3 and fig. 4, after the user performs the selection operation on the full-qualified name 'xxyyy' in fig. 3, a screen as shown in fig. 4 may be displayed. That is, the method name a, the method name B, the method name C, the method name D, and the method name E correspond to the full-limit name 'xxyyy', and when the user performs the selection operation on the method name a, it can be understood that the rule generation parameter input by the user is 'xxyyy + method name a', and if the target rule generation function is a forbidden class function, that is, the target code detection rule can be understood as: the use of method a in the 'xx' class is prohibited (the method indicated by the method name a is method a).
It can be seen that when a user needs to set a code detection rule for a specific method, the user does not need to input a specific method name corresponding to the method, but only needs to select the method name, that is, the method of customizing the code detection rule by the user can be further simplified.
In some embodiments, when the class name input by the user is detected as the error class name, the class name with the matching degree with the input content larger than the preset threshold value can be displayed according to the input content of the user.
In some embodiments, because class names are typically composed of english letters, users may sometimes enter errors; the error class name may not have a full-limit name corresponding to the error class name, so that the user cannot set the code detection rule. Therefore, the user can search for the possible correct class name input according to the input content of the user, and the user can select the displayed class name, so that the correct class name is determined.
In some embodiments, the specific preset threshold may be set according to the actual situation, and specific values of the specific preset threshold are not limited, and may be set reasonably according to the actual situation. For example, 60%.
For easy understanding, a certain class name is exemplified by 6 letters, if the user only inputs 5 letters, but also 1 letter is not correctly input, at this time, the class name input by the user is an incorrect class name, at this time, the class name including more than 4 letters input by the user can be searched, and the query result can be displayed. At this time, the user can select the correct class name according to the query result, thereby avoiding the situation that the user cannot search the corresponding full-limit name due to input errors.
That is, the efficiency of the user in the process of determining the full-limit name can be improved through the method, and the efficiency of the user-defined code detection rule is improved.
In some embodiments, the rule generation parameters include at least any of the following: class name, method name.
In some embodiments, some users may be relatively familiar with the syntax tree, and further, may directly input method names under a certain class name, that is, users unfamiliar with the syntax tree may only input class names, and users familiar with the syntax tree may directly input method names under class names, so that users may reasonably select a code detection rule definition mode suitable for themselves according to their own needs.
With further reference to fig. 5, as an implementation of the method shown in the foregoing figures, the present disclosure provides an embodiment of a code detection rule generating apparatus, which corresponds to the embodiment of the code detection rule generating method shown in fig. 1, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 5, the code detection rule generating apparatus of the present embodiment includes: a display unit 501 configured to display a rule identification list in response to detection of a rule setting operation; a determining unit 502, configured to determine a target rule generating function based on a triggering operation for a rule identifier in the rule identifier list, and display an input interface; a generating unit 503, configured to generate an object code detection rule based on the object rule generating function and the rule generating parameter input by the input interface.
In some embodiments, the rule identifications in the rule identification list correspond to a rule generation function.
In some embodiments, the generating unit 503 is specifically further configured to: responding to the detection that the input rule generation parameters are class names, and displaying at least one full-limit name comprising the class names; and generating the target code detection rule based on the selection operation of the full-defined name for the display and the target rule generation function.
In some embodiments, the generating unit 503 is specifically further configured to: obtaining a full-limit name corresponding table, wherein the full-limit name corresponding table comprises the corresponding relation between class names and full-limit names; and determining and displaying the at least one full-limit name according to the full-limit name corresponding table and the input class name.
In some embodiments, the generating unit 503 is specifically further configured to: responsive to detecting a selection operation for the full-defined name, displaying a method name corresponding to the selected full-defined name; and generating the target code detection rule according to the selection operation aiming at the method name and the target rule generation function.
In some embodiments, the generating unit 503 is specifically further configured to: and responding to the detection that the input class name is an error class name, and displaying the class name with the matching degree with the input content larger than a preset threshold according to the input content of the user.
In some embodiments, the apparatus further includes a detection unit 504 specifically configured to: and detecting codes based on the generated target code detection rules.
Referring to fig. 6, fig. 6 illustrates an exemplary system architecture in which the code detection rule generation method of one embodiment of the present disclosure may be applied.
As shown in fig. 6, the system architecture may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 may be a medium used to provide communications links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The terminal devices 601, 602, 603 may interact with the server 605 via the network 604 to receive or send messages or the like. Various client applications, such as a web browser application, a search class application, a news information class application, may be installed on the terminal devices 601, 602, 603. The client application in the terminal device 601, 602, 603 may receive the instruction of the user and perform the corresponding function according to the instruction of the user, for example, adding the corresponding information in the information according to the instruction of the user.
The terminal devices 601, 602, 603 may be hardware or software. When the terminal devices 601, 602, 603 are hardware, they may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablet computers, electronic book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic video expert compression standard audio plane 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic video expert compression standard audio plane 4) players, laptop and desktop computers, and the like. When the terminal devices 601, 602, 603 are software, they can be installed in the above-listed electronic devices. Which may be implemented as multiple software or software modules (e.g., software or software modules for providing distributed services) or as a single software or software module. The present invention is not particularly limited herein.
The server 605 may be a server that provides various services, for example, receives information acquisition requests sent by the terminal devices 601, 602, 603, and acquires presentation information corresponding to the information acquisition requests in various ways according to the information acquisition requests. And related data showing the information is transmitted to the terminal devices 601, 602, 603.
It should be noted that, the information processing method provided by the embodiment of the present disclosure may be executed by the terminal device, and accordingly, the generating means of the code detection rule may be set in the terminal devices 601, 602, 603. Further, the information processing method provided by the embodiment of the present disclosure may also be executed by the server 605, and accordingly, the information processing apparatus may be provided in the server 605.
It should be understood that the number of terminal devices, networks and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to fig. 7, a schematic diagram of an electronic device (e.g., a terminal device or server in fig. 6) suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 7 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 7, the electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 701, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage means 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM702, and the RAM703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
In general, the following devices may be connected to the I/O interface 705: input devices 705 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 707 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 708 including, for example, magnetic tape, hard disk, etc.; and a communication device 709. The communication means 709 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 7 shows an electronic device having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 709, or installed from storage 708, or installed from ROM 702. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 701.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but 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 of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: in response to detecting the rule setting operation, displaying a rule identification list; determining a target rule generating function based on triggering operation of rule identification aiming at the rule identification list, and displaying an input interface; and generating an object code detection rule based on the object rule generation function and the rule generation parameter input by the input interface.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ 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 computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Where the name of the element does not constitute a limitation on the element itself in some cases, for example, the presentation element 501 may also be described as "an element presenting a list of rule identifications".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, a method of generating a code detection rule includes: in response to detecting the rule setting operation, displaying a rule identification list; determining a target rule generating function based on triggering operation aiming at rule identifiers in the rule identifier list, and displaying an input interface; and generating an object code detection rule based on the object rule generation function and the rule generation parameter input by the input interface.
According to one or more embodiments of the present disclosure, the rule identifications in the rule identification list correspond to a rule generating function.
According to one or more embodiments of the present disclosure, the generating the target code detection rule based on the target rule generating function and the rule generating parameter input by the input interface includes: responding to the detection that the input rule generation parameters are class names, and displaying at least one full-limit name comprising the class names; and generating the target code detection rule based on the selection operation of the full-defined name for the display and the target rule generation function.
According to one or more embodiments of the present disclosure, the generating a parameter as a class name in response to detecting an input rule, displaying at least one full-defined name including the class name includes: obtaining a full-limit name corresponding table, wherein the full-limit name corresponding table comprises the corresponding relation between class names and full-limit names; and determining and displaying the at least one full-limit name according to the full-limit name corresponding table and the input class name.
According to one or more embodiments of the present disclosure, the generating the target code detection rule based on the selecting operation for the exposed full-qualified name and the target rule generating function includes: responsive to detecting a selection operation for the full-defined name, displaying a method name corresponding to the selected full-defined name; and generating the target code detection rule according to the selection operation aiming at the method name and the target rule generation function.
According to one or more embodiments of the present disclosure, the above method further comprises: and responding to the detection that the input class name is an error class name, and displaying the class name with the matching degree with the input content larger than a preset threshold according to the input content of the user.
According to one or more embodiments of the present disclosure, the above method further comprises: and detecting codes based on the generated target code detection rules.
According to one or more embodiments of the present disclosure, a code detection rule generating apparatus includes: the display unit is used for responding to the detection of the rule setting operation and displaying a rule identification list; a determining unit, configured to determine a target rule generating function based on a triggering operation for a rule identifier in the rule identifier list, and display an input interface; and the generating unit is used for generating an object code detection rule based on the object rule generating function and the rule generating parameters input by the input interface.
According to one or more embodiments of the present disclosure, the rule identifications in the rule identification list correspond to a rule generating function.
According to one or more embodiments of the present disclosure, the above-mentioned generating unit is specifically further configured to: responding to the detection that the input rule generation parameters are class names, and displaying at least one full-limit name comprising the class names; and generating the target code detection rule based on the selection operation of the full-defined name for the display and the target rule generation function.
According to one or more embodiments of the present disclosure, the above-mentioned generating unit is specifically further configured to: obtaining a full-limit name corresponding table, wherein the full-limit name corresponding table comprises the corresponding relation between class names and full-limit names; and determining and displaying the at least one full-limit name according to the full-limit name corresponding table and the input class name.
According to one or more embodiments of the present disclosure, the above-mentioned generating unit is specifically further configured to: responsive to detecting a selection operation for the full-defined name, displaying a method name corresponding to the selected full-defined name; and generating the target code detection rule according to the selection operation aiming at the method name and the target rule generation function.
According to one or more embodiments of the present disclosure, the above-mentioned generating unit is specifically further configured to: and responding to the detection that the input class name is an error class name, and displaying the class name with the matching degree with the input content larger than a preset threshold according to the input content of the user.
According to one or more embodiments of the present disclosure, the above apparatus further includes a detection unit specifically configured to: and detecting codes based on the generated target code detection rules.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (9)

1. A method for generating code detection rules, comprising:
in response to detecting the rule setting operation, displaying a rule identification list;
Determining a target rule generating function based on triggering operation for rule identifications in the rule identification list, and displaying an input interface;
generating an object code detection rule based on the object rule generation function and rule generation parameters input by the input interface;
and detecting codes based on the generated target code detection rules.
2. The method of claim 1, wherein the rule identifications in the list of rule identifications correspond to a rule generation function.
3. The method of claim 1, wherein generating the target code detection rule based on the target rule generation function and the rule generation parameters entered by the input interface comprises:
responding to the detection that the input rule generation parameters are class names, and displaying at least one full-limit name comprising the class names;
And generating the target code detection rule based on the selection operation aiming at the exposed full-limit name and the target rule generation function.
4. A method according to claim 3, wherein said generating parameters as class names in response to detecting entered rules, exposing at least one fully qualified name comprising the class names, comprises:
obtaining a full-limit name corresponding table, wherein the full-limit name corresponding table comprises the corresponding relation between class names and full-limit names;
and determining and displaying the at least one full-limit name according to the full-limit name corresponding table and the input class name.
5. A method according to claim 3, wherein the generating the target code detection rule based on the selection operation for the exposed full-qualified name and the target rule generation function comprises:
responsive to detecting a selection operation for the full-defined name, displaying a method name corresponding to the selected full-defined name;
And generating the target code detection rule according to the selection operation aiming at the method name and the target rule generation function.
6. A method according to claim 3, characterized in that the method further comprises:
And responding to the detection that the input class name is an error class name, and displaying the class name with the matching degree with the input content larger than a preset threshold according to the input content of the user.
7. A code detection rule generation apparatus, comprising:
The display unit is used for responding to the detection of the rule setting operation and displaying a rule identification list;
A determining unit, configured to determine a target rule generating function based on a triggering operation for a rule identifier in the rule identifier list, and display an input interface;
the generating unit is used for generating an object code detection rule based on the object rule generating function and rule generating parameters input by the input interface;
And the detection unit is used for detecting codes based on the generated target code detection rule.
8. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-6.
9. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-6.
CN202011325605.XA 2020-11-23 2020-11-23 Code detection rule generation method and device and electronic equipment Active CN112433730B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011325605.XA CN112433730B (en) 2020-11-23 2020-11-23 Code detection rule generation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011325605.XA CN112433730B (en) 2020-11-23 2020-11-23 Code detection rule generation method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112433730A CN112433730A (en) 2021-03-02
CN112433730B true CN112433730B (en) 2024-07-26

Family

ID=74693863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011325605.XA Active CN112433730B (en) 2020-11-23 2020-11-23 Code detection rule generation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112433730B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113191128B (en) * 2021-05-24 2024-03-19 中国工商银行股份有限公司 Report checking tool generation method and device and electronic equipment
CN113672512A (en) * 2021-08-20 2021-11-19 泰康保险集团股份有限公司 Code inspection rule generating method, code inspection method, device and medium
CN115495276A (en) * 2022-11-18 2022-12-20 北京奥星贝斯科技有限公司 Abnormity detection method, device, equipment and readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109445842A (en) * 2018-09-26 2019-03-08 中国平安人寿保险股份有限公司 Rule generating method, device, computer equipment and storage medium
CN111177176A (en) * 2019-11-18 2020-05-19 腾讯科技(深圳)有限公司 Data detection method, device and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110766289A (en) * 2019-09-26 2020-02-07 北京淇瑀信息科技有限公司 Dynamic wind control rule adjusting method and device and electronic equipment
CN110990294B (en) * 2019-12-19 2023-07-14 支付宝知识产权控股公司 Method, device, equipment and storage medium for determining software defect detection rule

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109445842A (en) * 2018-09-26 2019-03-08 中国平安人寿保险股份有限公司 Rule generating method, device, computer equipment and storage medium
CN111177176A (en) * 2019-11-18 2020-05-19 腾讯科技(深圳)有限公司 Data detection method, device and storage medium

Also Published As

Publication number Publication date
CN112433730A (en) 2021-03-02

Similar Documents

Publication Publication Date Title
CN112433730B (en) Code detection rule generation method and device and electronic equipment
CN112528595B (en) Document processing method and device and electronic equipment
CN111679990B (en) Test data generation method and device, readable medium and electronic equipment
CN111555940B (en) Client test method and device, electronic equipment and computer readable storage medium
CN109857506B (en) Method and device for realizing guide information, electronic equipment and storage medium
US20130036196A1 (en) Method and system for publishing template-based content
CN113835992B (en) Memory leakage processing method and device, electronic equipment and computer storage medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN112183045B (en) Online document processing method and device and electronic equipment
CN110795910A (en) Text information processing method and device, server and storage medium
CN111177634A (en) Multi-language supporting file content loading method, device, equipment and medium
CN113835571A (en) Terminal device, information display method and storage medium
CN111708824A (en) Data processing method, device, equipment and storage medium
CN114428925A (en) Page rendering method and device, electronic equipment and computer readable medium
CN110618811B (en) Information presentation method and device
CN110704050B (en) Module initializing method and device, electronic equipment and computer readable storage medium
CN114626332A (en) Content display method and device and electronic equipment
CN110780898B (en) Page data upgrading method and device and electronic equipment
CN110442403B (en) Method, device, electronic equipment and medium for calling functional component
CN110086880B (en) Method and apparatus for creating instances of network requests
CN111797009A (en) Method and device for detecting code compatibility and electronic equipment
CN111240657A (en) Method and device for generating SDK and electronic equipment
CN113835796B (en) Method and device for processing information
CN112256326B (en) Information processing method, device, equipment and storage medium
CN112286609B (en) Method and device for managing shortcut setting items of intelligent terminal

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