Script defect scanning method, device, computer equipment and storage medium
Through the automated script defect scanning method, code identification is used to obtain preset checkpoints and generate task flows, which solves the problem of low efficiency of traditional manual inspection and achieves efficient and accurate code normative inspection.
Patent Information
- Application Number
- CN201910419265.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-05-20
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2039-05-20
AI Technical Summary
Traditional code compliance checks rely on manual work, resulting in low accuracy and inability to effectively improve the efficiency of code script compliance checks.
By detecting when the code script submission button in the code editing page is clicked, the code script is obtained, the preset checkpoints are obtained according to the code identification, the inspection task flow is generated, the code script is read and scanned according to the task order, and defect detection is automatically performed to generate defects. Scanning results improve the efficiency of checking code scripts.
No manual inspection is required, code script defects are scanned directly through the automated process, which significantly improves inspection efficiency and accuracy and ensures code standardization.
Smart Images

Figure CN110231937B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing technology, and in particular to a script defect scanning method, device, computer equipment and storage medium. Background Art
[0002] With the development of computer technology, information processing technology has emerged. In information processing technology, if information is to be processed by a computer, it is necessary to implement it through software code. The function of processing information by a computer is realized by running the written software code.
[0003] However, after the software code is written, when the code is submitted, it is necessary to check the compliance of the submitted code. During the checking process, many checkpoints need to be checked to ensure the compliance of the submitted code. Traditional code compliance checks are all done manually, which results in low accuracy. Summary of the invention
[0004] Based on this, it is necessary to provide a script defect scanning method, device, computer equipment and storage medium that can improve the accuracy of the standardization check of code scripts in response to the above technical problems.
[0005] A script defect scanning method, the method comprising:
[0006] When it is detected that the code script submit button in the code editing page is clicked, the submitted code script is obtained;
[0007] According to the code identifier in the code script, obtaining a preset checkpoint corresponding to the code identifier;
[0008] Generate an inspection task flow corresponding to the acquired preset inspection points;
[0009] Read the inspection tasks according to the task order in the inspection task flow;
[0010] The code script is scanned according to the read inspection task to obtain a defect scanning result corresponding to the read inspection task.
[0011] A script defect scanning device, the device comprising:
[0012] The script acquisition module is used to acquire the submitted code script when detecting that the code script submission button in the code editing page is clicked;
[0013] A checkpoint acquisition module, used to acquire a preset checkpoint corresponding to the code identifier according to the code identifier in the code script;
[0014] A task flow generation module, used to generate an inspection task flow corresponding to the acquired preset inspection point;
[0015] A task reading module, used for reading the inspection tasks according to the task sequence in the inspection task flow;
[0016] The code scanning module is used to scan the code script according to the read inspection task to obtain the defect scanning result corresponding to the read inspection task.
[0017] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0018] When it is detected that the code script submit button in the code editing page is clicked, the submitted code script is obtained;
[0019] According to the code identifier in the code script, obtaining a preset checkpoint corresponding to the code identifier;
[0020] Generate an inspection task flow corresponding to the acquired preset inspection points;
[0021] Read the inspection tasks according to the task order in the inspection task flow;
[0022] The code script is scanned according to the read inspection task to obtain a defect scanning result corresponding to the read inspection task.
[0023] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0024] When it is detected that the code script submit button in the code editing page is clicked, the submitted code script is obtained;
[0025] According to the code identifier in the code script, obtaining a preset checkpoint corresponding to the code identifier;
[0026] Generate an inspection task flow corresponding to the acquired preset inspection points;
[0027] Read the inspection tasks according to the task order in the inspection task flow;
[0028] The code script is scanned according to the read inspection task to obtain a defect scanning result corresponding to the read inspection task.
[0029] The above-mentioned script defect scanning method, device, computer equipment and storage medium, after obtaining the submitted code script, obtains the preset checkpoint corresponding to the code identifier according to the code identifier in the code script, generates the inspection task flow corresponding to the obtained preset checkpoint, and the inspection task flow includes the inspection tasks corresponding to each preset checkpoint. There is no need to manually check the submitted code script, and the inspection task is directly read from the inspection task flow according to the task sequence, and the code script is scanned according to the read inspection task to obtain the scanning results corresponding to each preset checkpoint, thereby improving the inspection efficiency of code script defects. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is an application scenario diagram of a script defect scanning method in an embodiment;
[0031] Figure 2 A schematic diagram of a flow chart of a script defect scanning method in one embodiment;
[0032] Figure 3 A schematic diagram of a flow chart of steps for extracting a code script in one embodiment;
[0033] Figure 4 A flowchart of steps for generating an inspection task flow in one embodiment;
[0034] Figure 5 A schematic flow chart of steps for obtaining defect scanning results in one embodiment;
[0035] Figure 6 A flowchart of the steps of sending a code defect notification in one embodiment;
[0036] Figure 7 A flowchart of steps for modifying a code script in one embodiment;
[0037] Figure 8 is a structural block diagram of a script defect scanning device in an embodiment;
[0038] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] The script defect scanning method provided by this application can be applied to Figure 1In the application environment shown in the figure, the terminal 102 communicates with the server 104 through the network. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers. The script management platform runs on the server 104.
[0041] In one embodiment, Figure 2 As shown, a script defect scanning method is provided, which is applied to Figure 1 The server in the example is used to illustrate the following steps:
[0042] S202, when it is detected that the code script submission button in the code editing page is clicked, the submitted code script is obtained.
[0043] Specifically, the terminal displays a code script editing page, in which codes are entered, and a code script submission button is set in the code script editing page. When the terminal detects a click operation on the code script submission button, it obtains the code in the code script editing page, generates a code script based on the obtained code, and submits the code script to the server. The server receives the code script submitted by the terminal and stores the submitted code script in a database corresponding to the code script management platform.
[0044] In one embodiment, the server receives a code submission request sent by a terminal, parses the code submission request, extracts the developer account and code script identifier in the code submission request through parsing, generates a code pull request based on the developer account and code script identifier, and sends the code pull request to the terminal logged in with the developer account. After receiving the code pull request, the terminal parses the code pull request, extracts the developer account and code script identifier in the code pull request through parsing, verifies the developer account, and after the verification is passed, queries the code script corresponding to the code script identifier, and sends the queried code script to the server. The server receives the code script returned by the terminal logged in with the developer account according to the code pull request.
[0045] S204: According to the code identifier in the code script, obtain a preset checkpoint corresponding to the code identifier.
[0046] The preset checkpoint is a preset check position in the code script that needs to be checked.
[0047] Specifically, the server sets a plurality of preset checkpoints for checking the code script. When the server obtains the code script, it determines the code identifier in the code script and queries the preset checkpoint corresponding to the code identifier. Different code identifiers correspond to different preset checkpoints. For example, the code identifier includes a function class name, and different function class names correspond to different preset checkpoints.
[0048] In one embodiment, the server periodically obtains submission records of submitted code scripts, filters submission records corresponding to a time later than the last time the code script was obtained based on the time of the submission records, extracts code identifiers from the filtered code submission records, and obtains newly added code scripts based on the extracted code identifiers.
[0049] S206, generating an inspection task flow corresponding to the acquired preset inspection point.
[0050] Specifically, after the server obtains the preset checkpoints, it queries the inspection instructions corresponding to each preset checkpoint, creates the inspection tasks corresponding to each preset checkpoint according to each inspection instruction, and arranges the created inspection tasks according to the inspection order of the preset checkpoints to obtain the inspection task flow. The inspection tasks in the inspection task flow are arranged according to the inspection order of the preset checkpoints as the task order. S208, read the inspection tasks according to the task order in the inspection task flow.
[0051] Specifically, after creating the inspection task flow, the server reads the inspection tasks from the inspection task flow according to the task order in the inspection task flow.
[0052] In one embodiment, when there are multiple inspection task flows, multiple processes are called to read the inspection tasks in each inspection task flow in parallel.
[0053] S210, scanning the code script according to the read inspection task to obtain a defect scanning result corresponding to the read inspection task.
[0054] Specifically, when the server reads the inspection task, it extracts the inspection instruction from the inspection task, extracts the defect inspection data according to the inspection instruction, scans the code script according to the defect inspection data, and obtains the defect scanning results of each preset inspection point. The server generates a script defect report according to the defect scanning results. The defect scanning result is information indicating whether there is a defect.
[0055] In this embodiment, after obtaining the submitted code script, the preset checkpoint corresponding to the code identifier is obtained according to the code identifier in the code script, and the inspection task flow corresponding to the obtained preset checkpoint is generated, and the inspection task flow includes the inspection tasks corresponding to each preset checkpoint. There is no need to manually check the submitted code script, and the inspection task is directly read from the inspection task flow according to the task sequence. The code script is scanned according to the read inspection task, and the scanning results corresponding to each preset checkpoint are obtained, thereby generating a script defect report, which improves the efficiency of checking code script defects.
[0056] like Figure 3 As shown, in one embodiment, S202 specifically includes a step of extracting a code script, which specifically includes the following contents:
[0057] S302, when it is detected that the code script submission button in the code editing page is clicked, the script submission time corresponding to each script part identifier is read; the script part identifier corresponds to the script submission time one by one.
[0058] Specifically, when it is detected that the code script submission button in the code editing page is clicked, the server stores all submitted code scripts and script submission time in the database. The submitted code script consists of multiple script parts, each script part can be submitted separately, and when each script part is submitted, the script part identifier of the submitted script part and the script submission time are stored in correspondence. The server obtains the script submission time corresponding to each script part identifier from the stored script part identifier and script submission time.
[0059] S304: Determine the script part identifier corresponding to the script submission time within the preset time period.
[0060] Specifically, the server will determine whether the script submission time corresponding to each script identifier belongs to the preset time period, filter the script part identifier corresponding to the script submission time within the preset time period, and the filtered script part identifier is the identifier of the script part submitted within the preset time period. The preset time period can be a recent time period or a specified time period.
[0061] S306: extracting a script portion corresponding to the determined script portion identifier from the code script library.
[0062] Specifically, the submitted code script is stored in the code script library in the server. After determining the script part identifier, the server searches the code script library for the script part corresponding to the determined script part identifier, extracts the searched script part, and uses the extracted script part as the acquired code script.
[0063] In this embodiment, by recording the script submission time of each script part, the script parts submitted within the preset time period are filtered according to the script submission time. There is no need to wait for the complete code script to be submitted before checking the code script. The script parts can be checked separately, which improves the efficiency of checking the code script.
[0064] like Figure 4 As shown, in one embodiment, S206 includes a step of generating an inspection task flow, which specifically includes the following contents:
[0065] S402, traversing the check nodes in the check node tree; the check node tree is constructed in order of size according to the check applicable scope level of the preset check points.
[0066] The check node tree is constructed according to the check scope level between preset check points, each node of the check node tree corresponds to an inspection task, and each inspection task corresponds to a preset check point. The check scope level is the level of the inspection scope of the preset check point, and the check scope level includes at least one of the full text inspection of the code script file, the inspection of the specified script part, and the inspection of a class of code in the specified script part.
[0067] S404, creating an inspection task corresponding to the inspection node in the traversed inspection node tree.
[0068] Specifically, the server reads the inspection information in the traversed inspection node for the inspection node in the inspection node tree, and creates an inspection task corresponding to the inspection node according to the read inspection information. The inspection information may include an inspection instruction.
[0069] S406, constructing an inspection task flow according to the created inspection tasks in a traversal order.
[0070] Specifically, when traversing the inspection nodes in the inspection node tree, the server records the traversal order, arranges the created inspection tasks according to the recorded traversal order, and forms an inspection task flow according to the arranged inspection tasks.
[0071] In this embodiment, by traversing the inspection node tree constructed according to the inspection applicability level between preset inspection points, creating inspection tasks according to the traversed inspection nodes, and forming an inspection task flow according to the traversal order and the created inspection tasks, the generation efficiency of the inspection task flow is improved.
[0072] like Figure 5 As shown, in one embodiment, S210 specifically includes the step of obtaining defect scanning results, which specifically includes the following contents:
[0073] S502: Parse the inspection type of the read inspection task.
[0074] Specifically, the server parses the read inspection task, and reads the inspection type from the read inspection task through parsing. The inspection type is the type of inspection for the submitted code script, and the inspection type may specifically include at least one of a parameter inspection type, a name specification inspection type, and a code specification inspection type. When the inspection type is a name specification inspection type, the name specification inspection file corresponding to the name inspection type in the inspection task is queried, the function name in the code script is identified, and a specification inspection is performed on the identified function name according to the name specification inspection file to obtain a name specification inspection result, which is the defect scanning result corresponding to the inspection task. When the inspection type is a code specification inspection type, the code specification inspection file corresponding to the code specification inspection type in the inspection task is queried, and a specification inspection is performed on the code in the code script according to the code specification inspection file to obtain a code specification inspection result, which is the defect scanning result corresponding to the inspection task.
[0075] S504: When the inspection type is a parameter inspection type, query the specification inspection file corresponding to the inspection task.
[0076] Specifically, when the server parses and obtains that the inspection type is a parameter inspection type, it extracts the inspection file identifier in the inspection task and searches for a standard inspection file corresponding to the extracted inspection file identifier. The standard inspection file includes information on the standardization of the parameters.
[0077] S506, generating a parameter call instruction according to the specification check file.
[0078] Specifically, the server checks the parameter type in the specification file, encapsulates the parameter type, and generates a parameter call instruction through encapsulation. The parameter call instruction is used to obtain the configuration parameters of the code script.
[0079] S508, acquiring configuration parameters of the code script according to the parameter calling instruction.
[0080] Specifically, the server extracts the parameter type in the parameter calling instruction, searches for configuration parameters matching the parameter type in the code script, and obtains the searched configuration parameters.
[0081] In one embodiment, the server obtains a parameter configuration file corresponding to the code script, queries the parameter configuration file for configuration parameters that match the parameter type in the parameter calling instruction, and obtains the queried configuration parameters.
[0082] S510, scanning and checking the acquired configuration parameters according to the specification inspection file, and obtaining the defect scanning result corresponding to the read inspection task.
[0083] Specifically, the server scans and checks the acquired configuration parameters according to the specification check file, extracts the specification configuration parameters in the specification check, compares the specification configuration parameters with the acquired configuration parameters, determines the defect scan results of the configuration parameters, and generates a script defect report according to the determined defect scan results.
[0084] In this embodiment, when the inspection type in the inspection task is a parameter type, the configuration parameters of the code script are scanned and inspected according to the specification inspection file corresponding to the inspection task to obtain the defect scanning results corresponding to the read inspection task. The code script can be scanned for defects according to the specified inspection type, thereby improving the accuracy of the defect scanning.
[0085] like Figure 6 As shown, after S210, the step of sending a code defect notification is specifically included, and the step specifically includes the following contents:
[0086] S602: Extract code positions corresponding to code defects in the defect scanning results.
[0087] Specifically, the server parses the defect scanning result, determines the code defect in the defect scanning result through the analysis, and extracts the code position corresponding to the determined code defect from the defect scanning result. The code position is the position of the code defect in the code script.
[0088] S604, querying the developer account corresponding to the extracted code location.
[0089] Specifically, the server stores developer accounts corresponding to the script part identifiers. After extracting the code position, the server determines the script part identifier corresponding to the extracted code position, and queries the developer account corresponding to the determined script part identifier.
[0090] S606: Generate a code defect notification corresponding to the developer account.
[0091] Specifically, the server encapsulates the code defect and the code location, and generates a code defect notification corresponding to the developer account through the encapsulation. The code defect notification may also include a script part identifier of the script part to which the code location belongs.
[0092] S608, sending a code defect notification to a terminal logged in with a developer account.
[0093] Specifically, after generating the code defect notification, the server obtains the terminal identifier corresponding to the terminal logged in with the developer account, and sends the code defect notification to the terminal logged in with the developer account according to the identifier.
[0094] In this embodiment, the developer account can be determined based on the code location corresponding to the code defect in the defect scanning results, and a code defect notification corresponding to the developer account can be generated. The code defect notification can be sent to a terminal logged in with the developer account to ensure that the developer is aware of the code defects that occurred during development.
[0095] like Figure 7 As shown, in one embodiment, after S608, a step of modifying the code script is also included, and the step specifically includes the following contents:
[0096] S702, receiving a code modification instruction returned by a terminal logged in with a developer account according to a code defect notification.
[0097] Specifically, after receiving the code defect notification, the terminal logged in with the developer account extracts the script part identifier in the code defect notification, enters modification information for the code defect in the script part identifier, generates a code modification instruction according to the modification information and the code modification position, and sends the code modification instruction to the server. The server receives the code modification instruction sent by the terminal logged in with the developer account.
[0098] S704, extracting modification information and code modification position in the code modification instruction.
[0099] Specifically, after receiving the code modification instruction, the server parses the code modification instruction and obtains the modification information and the code modification position through the parsing.
[0100] S706, determining a portion of the code script corresponding to the code modification position.
[0101] Specifically, the server determines the code script to which the code modification position belongs, determines a portion of the code script corresponding to the code modification position in the code script, and extracts the determined portion of the code script.
[0102] S708, modify part of the code script according to the modification information.
[0103] Specifically, the server extracts the modified code in the modification information, determines the code to be modified in the partial code script, replaces the code to be modified with the modified code, and resubmits the modified partial code script.
[0104] In this embodiment, after receiving a code modification instruction sent by a terminal logged in with a developer account, part of the code script can be modified according to the code modification position and modification information in the code modification instruction, thereby improving the convenience of modifying the code script and ensuring the correctness of the submitted code script.
[0105] In one embodiment, the script defect scanning method also includes: receiving a checkpoint adding instruction; extracting permission verification information in the checkpoint adding instruction; verifying the permission verification information through the checkpoint adding permission information in the permission configuration table; when the permission verification information is verified, extracting the script specification information in the checkpoint adding instruction; and creating a checkpoint according to the script specification information.
[0106] Specifically, the server receives a checkpoint adding instruction, parses the checkpoint adding instruction, and obtains permission verification information and script specification information through parsing. The server extracts a permission configuration table, verifies the permission verification information according to the checkpoint adding permission information stored in the permission configuration table, and after the permission verification information is verified, creates a checkpoint according to the script specification information, and adds the created checkpoint to the checkpoint library.
[0107] In this embodiment, after the permission verification information in the checkpoint adding instruction is verified, the checkpoint is created according to the script specification information in the checkpoint adding instruction, and the checkpoint can be added to ensure the accuracy of the checkpoint for the submitted code script.
[0108] It should be understood that although Figure 2-7 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-7 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0109] In one embodiment, Figure 8 As shown, a script defect scanning device 800 is provided, comprising: a script acquisition module 802, a checkpoint acquisition module 804, a task flow generation module 806, a task reading module 808 and a code scanning module 810, wherein:
[0110] The script acquisition module 802 is used to acquire the submitted code script when it is detected that the code script submission button in the code editing page is clicked.
[0111] The checkpoint acquisition module 804 is used to acquire a preset checkpoint corresponding to the code identifier according to the code identifier in the code script.
[0112] The task flow generation module 806 is used to generate an inspection task flow corresponding to the acquired preset inspection point.
[0113] The task reading module 808 is used to read the inspection tasks according to the task sequence in the inspection task flow.
[0114] The code scanning module 810 is used to scan the code script according to the read inspection task to obtain the defect scanning result corresponding to the read inspection task.
[0115] In one embodiment, the script acquisition module 802 is also used to read the script submission time corresponding to each script part identifier when it is detected that the code script submission button in the code editing page is clicked; the script part identifier corresponds to the script submission time one by one; determine the script part identifier corresponding to the script submission time within a preset time period; and extract the script part corresponding to the determined script part identifier from the code script library.
[0116] In one embodiment, the task flow generation module 806 is also used to traverse the inspection nodes in the inspection node tree; the inspection node tree is constructed in order of size according to the inspection applicable scope level of the preset inspection points; create inspection tasks corresponding to the inspection nodes in the traversed inspection node tree; and construct the inspection task flow according to the created inspection tasks in the traversal order.
[0117] In one embodiment, the code scanning module 810 is also used to parse the inspection type of the inspection task read; when the inspection type is a parameter inspection type, query the specification inspection file corresponding to the inspection task; generate a parameter call instruction according to the specification inspection file; obtain the configuration parameters of the code script according to the parameter call instruction; scan and check the obtained configuration parameters according to the specification inspection file, and obtain the code script submit button in the code editing page when it is detected that it is clicked.
[0118] In one embodiment, the script defect scanning device 800 further includes a notification sending module and a code modification module.
[0119] The notification sending module is also used to extract the code location corresponding to the code defect in the defect scanning result; query the developer account corresponding to the extracted code location; generate a code defect notification corresponding to the developer account; and send the code defect notification to the terminal logged in with the developer account.
[0120] The code modification module is also used to receive a terminal logged in with a developer account, and return a code modification instruction based on a code defect notification; extract modification information and a code modification location in the code modification instruction; determine a portion of the code script corresponding to the code modification location; and modify the portion of the code script according to the modification information.
[0121] In one embodiment, the script defect scanning device 800 further includes a checkpoint creation module.
[0122] The checkpoint creation module is also used to receive a checkpoint adding instruction; extract the permission verification information in the checkpoint adding instruction; verify the permission verification information through the checkpoint adding permission information in the permission configuration table; when the permission verification information is verified, extract the script specification information in the checkpoint adding instruction; create a checkpoint according to the script specification information.
[0123] In this embodiment, after obtaining the submitted code script, the preset checkpoint is obtained, and the inspection task flow corresponding to the obtained preset checkpoint is generated, and the inspection task flow includes the inspection tasks corresponding to each preset checkpoint. There is no need to manually check the submitted code script, and the inspection tasks are directly read from the inspection task flow according to the task sequence. The code script is scanned according to the read inspection tasks to obtain the defect scanning results corresponding to each preset checkpoint, thereby improving the inspection efficiency of code script defects.
[0124] For the specific definition of the script defect scanning device, please refer to the definition of the script defect scanning method above, which will not be repeated here. Each module in the above-mentioned script defect scanning device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0125] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store code scripts. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a script defect scanning method is implemented.
[0126] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0127] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the following steps when executing the computer program: when it is detected that a code script submission button in a code editing page is clicked, obtaining the submitted code script; according to a code identifier in the code script, obtaining a preset checkpoint corresponding to the code identifier; generating an inspection task flow corresponding to the obtained preset checkpoint; reading the inspection task according to the task order in the inspection task flow; scanning the code script according to the read inspection task to obtain a defect scanning result corresponding to the read inspection task.
[0128] In one embodiment, when it is detected that a code script submission button in a code editing page is clicked, obtaining the submitted code script includes: reading the script submission time corresponding to each script part identifier; the script part identifier corresponds to the script submission time one by one; determining the script part identifier corresponding to the script submission time within a preset time period; and extracting the script part corresponding to the determined script part identifier from the code script library.
[0129] In one embodiment, generating an inspection task flow corresponding to an acquired preset inspection point includes: traversing the inspection nodes in an inspection node tree; the inspection node tree is constructed in order of size according to the inspection applicable scope level of the preset inspection point; creating inspection tasks corresponding to the inspection nodes in the traversed inspection node tree; and constructing an inspection task flow according to the created inspection tasks in the traversal order.
[0130] In one embodiment, the code script is scanned according to the read inspection task to obtain the defect scanning result corresponding to the read inspection task, including: parsing the inspection type of the read inspection task; when the inspection type is a parameter inspection type, querying the specification inspection file corresponding to the inspection task; generating a parameter call instruction according to the specification inspection file; obtaining the configuration parameters of the code script according to the parameter call instruction; scanning and inspecting the obtained configuration parameters according to the specification inspection file to obtain the defect scanning result corresponding to the read inspection task.
[0131] In one embodiment, after scanning the code script according to the read inspection task and obtaining the defect scanning result corresponding to the read inspection task, the processor also implements the following steps when executing the computer program: extracting the code position corresponding to the code defect in the defect scanning result; querying the developer account corresponding to the extracted code position; generating a code defect notification corresponding to the developer account; and sending the code defect notification to the terminal logged in with the developer account.
[0132] In one embodiment, after sending a code defect notification to a terminal logged in with a developer account, the processor further implements the following steps when executing a computer program: receiving a code modification instruction returned by the terminal logged in with a developer account according to the code defect notification; extracting modification information and a code modification location in the code modification instruction; determining a portion of the code script corresponding to the code modification location; and modifying the portion of the code script according to the modification information.
[0133] In one embodiment, when the processor executes the computer program, the following steps are also implemented: receiving a checkpoint adding instruction; extracting permission verification information in the checkpoint adding instruction; verifying the permission verification information through the checkpoint adding permission information in the permission configuration table; when the permission verification information is verified, extracting the script specification information in the checkpoint adding instruction; and creating a checkpoint according to the script specification information.
[0134] In this embodiment, after obtaining the submitted code script, the preset checkpoint is obtained, and the inspection task flow corresponding to the obtained preset checkpoint is generated, and the inspection task flow includes the inspection tasks corresponding to each preset checkpoint. There is no need to manually check the submitted code script, and the inspection task is directly read from the inspection task flow according to the task sequence, and the code script is scanned according to the read inspection task to obtain the scanning results corresponding to each preset checkpoint, thereby improving the inspection efficiency of code script defects.
[0135] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: when it is detected that a code script submission button in a code editing page is clicked, the submitted code script is obtained; based on a code identifier in the code script, a preset checkpoint corresponding to the code identifier is obtained; an inspection task flow corresponding to the obtained preset checkpoint is generated; the inspection task is read according to the task order in the inspection task flow; the code script is scanned according to the read inspection task to obtain a defect scanning result corresponding to the read inspection task.
[0136] In one embodiment, when it is detected that a code script submission button in a code editing page is clicked, obtaining the submitted code script includes: when it is detected that a code script submission button in a code editing page is clicked, reading the script submission time corresponding to each script part identifier; the script part identifier corresponds to the script submission time one by one; determining the script part identifier corresponding to the script submission time within a preset time period; and extracting the script part corresponding to the determined script part identifier from the code script library.
[0137] In one embodiment, generating an inspection task flow corresponding to an acquired preset inspection point includes: traversing the inspection nodes in an inspection node tree; the inspection node tree is constructed in order of size according to the inspection applicable scope level of the preset inspection point; creating inspection tasks corresponding to the inspection nodes in the traversed inspection node tree; and constructing an inspection task flow according to the created inspection tasks in the traversal order.
[0138] In one embodiment, the code script is scanned according to the read inspection task to obtain the defect scanning result corresponding to the read inspection task, including: parsing the inspection type of the read inspection task; when the inspection type is a parameter inspection type, querying the specification inspection file corresponding to the inspection task; generating a parameter call instruction according to the specification inspection file; obtaining the configuration parameters of the code script according to the parameter call instruction; scanning and inspecting the obtained configuration parameters according to the specification inspection file to obtain the defect scanning result corresponding to the read inspection task.
[0139] In one embodiment, after the code script is scanned according to the read inspection task and the defect scanning result corresponding to the read inspection task is obtained, the computer program also implements the following steps when executed by the processor: extracting the code position corresponding to the code defect in the defect scanning result; querying the developer account corresponding to the extracted code position; generating a code defect notification corresponding to the developer account; and sending the code defect notification to the terminal logged in with the developer account.
[0140] In one embodiment, after the code defect notification is sent to the terminal logged in with the developer account, the computer program further implements the following steps when executed by the processor: receiving the code modification instructions returned by the terminal logged in with the developer account according to the code defect notification; extracting the modification information and the code modification position in the code modification instructions; determining the part of the code script corresponding to the code modification position; and modifying the part of the code script according to the modification information.
[0141] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: receiving a checkpoint adding instruction; extracting permission verification information in the checkpoint adding instruction; verifying the permission verification information through the checkpoint adding permission information in the permission configuration table; when the permission verification information is verified, extracting the script specification information in the checkpoint adding instruction; and creating a checkpoint according to the script specification information.
[0142] In this embodiment, after obtaining the submitted code script, the preset checkpoint is obtained, and the inspection task flow corresponding to the obtained preset checkpoint is generated, and the inspection task flow includes the inspection tasks corresponding to each preset checkpoint. There is no need to manually check the submitted code script, and the inspection task is directly read from the inspection task flow according to the task sequence, and the code script is scanned according to the read inspection task to obtain the scanning results corresponding to each preset checkpoint, thereby improving the inspection efficiency of code script defects.
[0143] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0144] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0145] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A script defect scanning method, the method comprising: Receive a checkpoint add instruction; Extracting the permission verification information in the checkpoint adding instruction; Add permission information through the checkpoint in the permission configuration table and verify the permission verification information; When the permission verification information is verified, the script specification information in the checkpoint adding instruction is extracted; Creating a checkpoint according to the script specification information; When it is detected that the code script submit button in the code editing page is clicked, the script submission time corresponding to each script part identifier is read; Determine the script portion identifier corresponding to the script submission time within the preset time period; Extracting a script portion corresponding to the determined script portion identifier from the code script library, and using the extracted script portion as the acquired code script; According to the code identifier in the code script, obtaining a preset checkpoint corresponding to the code identifier; Generate an inspection task flow corresponding to the acquired preset inspection points; arrange the inspection tasks in the inspection task flow in the order of inspection of the preset inspection points as the task order; Read the inspection tasks according to the order of tasks in the inspection task flow; The code script is scanned according to the read inspection task to obtain a defect scanning result corresponding to the read inspection task.
2. The method according to claim 1, characterized in that The generating of the inspection task flow corresponding to the acquired preset inspection point includes: Traversing the check nodes in the check node tree; the check node tree is constructed in order of the size of the check applicable scope level of the preset check points; Create a check task corresponding to the check node in the traversed check node tree; The inspection task flow is constructed according to the created inspection tasks in the traversal order.
3. The method according to claim 1, characterized in that Scanning the code script according to the read inspection task to obtain a defect scanning result corresponding to the read inspection task includes: Parse the inspection type of the inspection task read; When the inspection type is parameter inspection type, query the specification inspection file corresponding to the inspection task; Generating parameter call instructions according to the specification inspection file; Acquire configuration parameters of the code script according to the parameter calling instruction; The obtained configuration parameters are scanned and checked according to the specification inspection file to obtain the defect scanning result corresponding to the read inspection task.
4. The method according to claim 1, wherein After scanning the code script according to the read inspection task to obtain the defect scanning result corresponding to the read inspection task, the method further includes: Extracting code locations corresponding to code defects in the defect scanning results; Query the developer account corresponding to the extracted code location; Generating a code defect notification corresponding to the developer account; The code defect notification is sent to a terminal logged in with the developer account.
5. The method according to claim 4, characterized in that After sending the code defect notification to the terminal logged in with the developer account, the method further includes: Receiving, from a terminal logged in with the developer account, a code modification instruction returned according to the code defect notification; Extracting modification information and code modification position from the code modification instruction; Determine a portion of the code script corresponding to the code modification location; Modify the portion of the code script according to the modification information.
6. A script defect scanning device, characterized in that: The device comprises: A checkpoint creation module is configured to receive a checkpoint addition instruction; extract permission verification information from the checkpoint addition instruction; verify the permission verification information using the checkpoint addition permission information in the permission configuration table; extract script specification information from the checkpoint addition instruction when the permission verification information passes; and create a checkpoint based on the script specification information. The script acquisition module is configured to, when detecting that a code script submit button in a code editing page has been clicked, read the script submission time corresponding to each script part identifier; determine the script part identifier corresponding to the script submission time within a preset time period; extract the script part corresponding to the determined script part identifier from the code script library, and use the extracted script part as the acquired code script; A checkpoint acquisition module, configured to acquire a preset checkpoint corresponding to a code identifier in the code script; A task flow generation module is used to generate an inspection task flow corresponding to the acquired preset inspection points; the inspection tasks in the inspection task flow are arranged in the inspection order of the preset inspection points as the task order; A task reading module, configured to read inspection tasks in the order of tasks in the inspection task flow; The code scanning module is used to scan the code script according to the read inspection task to obtain the defect scanning result corresponding to the read inspection task.
7. The device according to claim 6, characterized in that The task flow generation module is also used to traverse the inspection nodes in the inspection node tree; the inspection node tree is constructed in order of size according to the inspection application scope level of the preset inspection points; create inspection tasks corresponding to the inspection nodes in the traversed inspection node tree; and construct an inspection task flow according to the created inspection tasks in the traversal order.
8. The device according to claim 6, characterized in that The code scanning module is also used to parse the inspection type of the read inspection task; when the inspection type is a parameter inspection type, query the specification inspection file corresponding to the inspection task; generate a parameter call instruction according to the specification inspection file; obtain the configuration parameters of the code script according to the parameter call instruction; scan and inspect the obtained configuration parameters according to the specification inspection file to obtain the defect scanning results corresponding to the read inspection task.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method and device of recognizing and checking modifying code blocks based on difference information file
CN103092761A
Program code review method and program code review device
CN104133768A
Method for automatically monitoring quality of software code
CN105159831A
Source code cloud detection system and method based on serialization intermediate representation
CN106445804A
Static code scanning result processing method and device
CN108304327A
