CN117827661A - Code grammar checking method, system, computer device and storage medium - Google Patents

Code grammar checking method, system, computer device and storage medium Download PDF

Info

Publication number
CN117827661A
CN117827661A CN202410008668.4A CN202410008668A CN117827661A CN 117827661 A CN117827661 A CN 117827661A CN 202410008668 A CN202410008668 A CN 202410008668A CN 117827661 A CN117827661 A CN 117827661A
Authority
CN
China
Prior art keywords
task
local
information table
checking
code
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.)
Pending
Application number
CN202410008668.4A
Other languages
Chinese (zh)
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.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China 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 Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202410008668.4A priority Critical patent/CN117827661A/en
Publication of CN117827661A publication Critical patent/CN117827661A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The embodiment of the application relates to a code grammar checking method, which comprises the following steps: acquiring configuration information corresponding to an item to be checked, wherein the configuration information comprises a local code library address, a latest branch of a remote code library, task setting and merging checking rules; capturing all scripts of the latest branch of the remote code library to a local code library according to the local code library address; determining a local task information table according to a task system and the task setting; determining a target script in the local code base according to the local task information table, and obtaining a grammar checking script according to the target script and the merging checking rule; executing the grammar checking script through the task system to obtain an execution result, and generating a grammar checking report corresponding to the item to be checked according to the execution result. The application also provides a code grammar checking system, computer equipment and a storage medium. The method and the device improve the efficiency of code grammar checking and reduce the time cost.

Description

Code grammar checking method, system, computer device and storage medium
Technical Field
The present invention relates to the field of computer technology and the field of financial technology, and is applied to a scenario that related industries of financial technology check whether code grammar is correct in a data development process, in particular, to a code grammar checking method, a system, a computer device and a storage medium.
Background
Currently, in the related industries of financial science and technology, requirements on various aspects of data, particularly quality, are strict. The data quality is guaranteed by data development, and in the process of data development, the successful operation of newly added online scripts and tasks in the production environment is the most basic and important requirement.
For newly added online scripts and tasks in a production environment, once problems occur, the downstream scripts and tasks are affected, and the potential for independent tasks is also provided. Therefore, it is very important to perform a full grammar check on a new version of the code library before the script and task are on-line.
However, by performing grammar checking in a traditional way, running a verification full-quantity script and task in a test environment, and not being able to re-etch the running condition in a production environment, it is difficult to ensure that the production environment is normal; all scripts and tasks are run in full quantity in the production environment, the inspection efficiency is low, the time cost is high, and the residual fault repair time is short.
Disclosure of Invention
An object of the embodiments of the present application is to provide a code grammar checking method, system, computer device and storage medium, so as to solve the technical problems of low checking efficiency and high time cost when performing a full grammar check on a code library.
In order to solve the above technical problems, the embodiments of the present application provide a code syntax checking method, which adopts the following technical schemes:
acquiring configuration information corresponding to an item to be checked, wherein the configuration information comprises a local code library address, a latest branch of a remote code library, task setting and merging checking rules;
capturing all scripts of the latest branch of the remote code library to a local code library according to the local code library address;
determining a local task information table according to a task system and the task setting;
determining a target script in the local code base according to the local task information table, and obtaining a grammar checking script according to the target script and the merging checking rule;
executing the grammar checking script through the task system to obtain an execution result, and generating a grammar checking report corresponding to the item to be checked according to the execution result.
Further, the task setting includes task module information and task defining rules, and the step of determining a local task information table according to the task system and the task setting specifically includes:
extracting a task list of a corresponding module from the task system according to the task module information;
screening the task list according to the task definition rule to obtain a target task list;
determining whether a local historical task information table exists;
if the local historical task information table exists, obtaining the local task information table according to the local historical task information table and the target task list;
if the local historical task information table does not exist, the local task information table is built according to the target task list and the local code base address.
Further, if the local history task information table exists, the step of obtaining the local task information table according to the local history task information table and the target task list specifically includes:
comparing the target task list with the local historical task information list to determine an added task list and a deleted task list;
Updating the target task list according to the newly added task list and the deleted task list to obtain an updated task list;
and establishing the local task information table according to the updated task list and the local code base address.
Further, after the step of determining the local task information table according to the task system and the task setting, the method further includes:
if the local historical task information table exists, updating the local historical task information table according to the local task information table to obtain an updated local historical task information table;
and if the local historical task information table does not exist, generating the local historical task information table according to the local task information table.
Further, the step of determining a target script in the local code library according to the local task information table, and obtaining a grammar checking script according to the target script and the merge checking rule specifically includes:
according to the task information corresponding to the local task information table, searching a corresponding script in the local code library to serve as the target script;
and processing the target script according to the merging checking rule to obtain the grammar checking script, wherein the grammar checking script can run an displain function in SQL.
Further, the step of executing the grammar checking script by the task system to obtain an execution result, and generating a grammar checking report corresponding to the item to be checked according to the execution result specifically includes:
submitting the grammar checking script to the task system as a task to be executed for execution;
detecting an execution process at regular time, counting error reporting information generated in the execution process, and determining a completion progress;
and when the execution process is finished, taking the error reporting information as the execution result, and generating the grammar checking report according to the execution result.
Further, before the step of obtaining the configuration information corresponding to the item to be checked, the configuration information includes a local code base address, a latest branch of a remote code base, task setting, and merging checking rules, the method further includes:
and receiving a configuration instruction carrying preset parameters, and configuring according to the preset parameters to obtain the item to be inspected.
In order to solve the above technical problems, the embodiments of the present application further provide a code grammar checking system, which adopts the following technical scheme:
a code syntax checking system, comprising:
The acquisition module is used for acquiring configuration information corresponding to the item to be checked, wherein the configuration information comprises a local code library address, a latest branch of a remote code library, task setting and a merging check rule;
the grabbing module is used for grabbing all scripts of the latest branch of the remote code library to the local code library according to the local code library address;
the first determining module is used for determining a local task information table according to the task system and the task setting;
the second determining module is used for determining a target script in the local code library according to the local task information table and obtaining a grammar checking script according to the target script and the merging checking rule;
and the generation module is used for executing the grammar checking script through the task system to obtain an execution result, and generating a grammar checking report corresponding to the item to be checked according to the execution result.
In order to solve the above technical problems, the embodiments of the present application further provide a computer device, which adopts the following technical schemes:
a computer device comprising a memory having stored therein computer readable instructions which when executed by a processor implement the steps of a code syntax checking method as described above.
In order to solve the above technical problems, embodiments of the present application further provide a computer readable storage medium, which adopts the following technical solutions:
a computer readable storage medium having stored thereon computer readable instructions which when executed by a processor implement the steps of a code syntax checking method as described above.
Compared with the prior art, the embodiment of the application has the following main beneficial effects:
according to the code grammar checking method, configuration information corresponding to an item to be checked is obtained, wherein the configuration information comprises a local code library address, a latest branch of a remote code library, task setting and a merging checking rule; capturing all scripts of the latest branch of the remote code library to a local code library according to the local code library address; determining a local task information table according to a task system and the task setting; determining a target script in the local code base according to the local task information table, and obtaining a grammar checking script according to the target script and the merging checking rule; executing the grammar checking script through the task system to obtain an execution result, and generating a grammar checking report corresponding to the item to be checked according to the execution result. According to the method and the device, the corresponding script can be automatically grabbed and selected according to the grammar checking requirement, and the corresponding grammar checking result is obtained through the task system, so that code grammar checking is carried out under the condition that all scripts and tasks do not need to be run in full in a production environment, the checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time is remained.
Drawings
For a clearer description of the solution in the present application, a brief description will be given below of the drawings that are needed in the description of the embodiments of the present application, it being obvious that the drawings in the following description are some embodiments of the present application, and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow chart of one embodiment of a code syntax checking method according to the present application;
FIG. 3 is a schematic diagram of one embodiment of a code syntax checking system according to the present application;
FIG. 4 is a schematic structural diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the applications herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description and claims of the present application and in the description of the figures above are intended to cover non-exclusive inclusions. The terms first, second and the like in the description and in the claims or in the above-described figures, are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In order to better understand the technical solutions of the present application, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings.
As shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as a web browser application, a shopping class application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 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 (Moving Picture Experts Group Audio Layer III, moving picture experts compression standard audio layer 3) players, MP4 (Moving Picture Experts Group Audio Layer IV, moving picture experts compression standard audio layer 4) players, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the code grammar checking method provided in the embodiments of the present application is generally executed by a server, and accordingly, the code grammar checking system is generally disposed in the server.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow chart of one embodiment of a code syntax checking method according to the present application is shown. The code grammar checking method comprises the following steps:
Step S201, configuration information corresponding to an item to be checked is obtained, wherein the configuration information comprises a local code library address, a latest branch of a remote code library, task setting and a merging check rule;
it should be noted that the electronic device (e.g., the server shown in fig. 1) on which the code syntax checking method operates may transmit or receive data through a wired connection or a wireless connection. The wireless connection may include, but is not limited to, 3G/4G/5G connections, wiFi connections, bluetooth connections, wiMAX connections, zigbee connections, UWB (ultra wideband) connections, and other now known or later developed wireless connection means.
In this embodiment, when the code grammar checking method is run, configuration information corresponding to an item to be checked needs to be acquired first, where the configuration information includes a local code library address, a latest branch of a remote code library, task setting, and a merge checking rule. Specifically, the code grammar checking method of the embodiment is applied to a scenario that whether the code grammar is correctly checked in the data development process for the related industry of finance technology, for example, when the value of the option is estimated through a monte carlo simulation method, the code grammar needs to be checked when the BSM model is translated into a Pyhthon code, and accordingly, in other scenarios involving conversion of the code by a financial algorithm, the code grammar also needs to be checked, before the code grammar checking method of the embodiment is operated, related developers can configure the grammar checking item according to the grammar checking requirement, the configured item is the item to be checked, and after the code grammar checking method is started to be operated, configuration information corresponding to the item to be checked can be obtained, so that the code grammar checking can be performed according to the configuration information later, wherein the configuration information at least comprises a local code library address, a latest branch of a remote code library, task setting and a merging checking rule.
Step S202, capturing all scripts of the latest branch of the remote code library to a local code library according to the local code library address;
in this embodiment, after the configuration information corresponding to the item to be checked is obtained, all scripts of the latest branch of the remote code base in the configuration information can be grabbed to the local code base according to the local code base address in the configuration information. Specifically, after the configuration information corresponding to the item to be checked is obtained, because the configuration information includes the local code base address and the latest branch of the remote code base, all scripts in the latest branch of the remote code base can be automatically grabbed to the local code base according to the local code base address, so that proper scripts can be screened from the local code base for grammar checking.
Step S203, a local task information table is determined according to a task system and the task setting;
in this embodiment, after all scripts of the latest branch of the remote code library are captured to the local code library, the local task information table may be determined according to the task system and the task settings in the configuration information. Specifically, the task setting in the configuration information may include task module information and task limiting rules, according to the task module information, a task list of a corresponding module may be extracted from the task system, then the task list may be screened according to the task limiting rules, such as an operation program, a task state, etc., to obtain a target task list, then whether a local historical task information list exists or not needs to be determined, when the local historical task information list exists, the local historical task information list and the target task list may be synthesized to obtain a local task information list, for example, the target task list may be updated according to the local historical task information list, and an updated task list may be obtained, and then the local task information list may be established according to the updated task list and the local code library address, so that a corresponding script may be determined from the local code library according to the local task information list subsequently; when the local historical task information table does not exist, the local task information table can be directly built according to the target task list and the local code library address; because the local task information table records the basic information such as the name of the library and the name of the table corresponding to the task in the task list and the address of the script corresponding to the basic information in the local code base, the corresponding script can be determined from the local code base according to the local task information table.
Step S204, determining a target script in the local code base according to the local task information table, and obtaining a grammar checking script according to the target script and the merging checking rule;
in this embodiment, after the local task information table is obtained, the target script may be determined in the local code library according to the local task information table, and the grammar checking script may be obtained according to the merging checking rule in the target script and the configuration information. Specifically, after capturing all scripts of the latest branch of the remote code library to the local code library and obtaining the local task information table, according to task information corresponding to the local task information table, a corresponding plurality of scripts can be searched in the local code library to be used as target scripts, then the target scripts are processed according to a merging check rule in configuration information, so that grammar check scripts are obtained, the merging check rule at least comprises the number of the scripts for merging check, the target scripts are processed through the merging check rule, namely, the target scripts are merged according to the merging check script data, so that a plurality of grammar check scripts are obtained, and the merging check rule also requires that the merged grammar check scripts can run an expain function in SQL.
Step S205, executing the grammar checking script by the task system, obtaining an execution result, and generating a grammar checking report corresponding to the item to be checked according to the execution result.
In this embodiment, after the grammar checking script is obtained according to the target script and the merge checking rule, the grammar checking script can be executed by the task system, the execution result is obtained, and finally, the grammar checking report corresponding to the item to be checked is generated according to the execution result. Specifically, after the grammar checking script is obtained, all grammar checking scripts can be submitted to a task system, the task system is used for executing, the executing process is detected at regular time, the completion progress and whether error reporting exists or not are determined, error reporting information generated in the process is counted, if error reporting occurs in any grammar checking script, the grammar of the script is represented to have a problem, the grammar of the script which does not occur error reporting is the script with correct grammar, therefore, after the executing process is completed, the counted error reporting information can be used as an executing result, and finally, a grammar checking report corresponding to an item to be checked is generated according to the executing result, and the report can detail list the task and the script with the grammar error.
Optionally, after any grammar checking script reports errors in the executing process, a secondary grammar checking script can be generated one by one according to the task corresponding to the script, and the generated secondary grammar checking script is submitted to the task system for executing, so that the grammar errors can be more accurately positioned.
According to the method and the device, the corresponding script can be automatically grabbed and selected according to the grammar checking requirement, and the corresponding grammar checking result is obtained through the task system, so that code grammar checking is carried out under the condition that all scripts and tasks do not need to be run in full in a production environment, the checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time is remained.
In some optional implementations of this embodiment, the task setting includes task module information and task defining rules, and the step of determining the local task information table according to the task system and the task setting includes:
extracting a task list of a corresponding module from the task system according to the task module information;
screening the task list according to the task definition rule to obtain a target task list;
determining whether a local historical task information table exists;
If the local historical task information table exists, obtaining the local task information table according to the local historical task information table and the target task list;
if the local historical task information table does not exist, the local task information table is built according to the target task list and the local code base address.
In this embodiment, the task setting in the configuration information includes task module information and task definition rules, after capturing all scripts of the latest branch of the remote code library to the local code library, a task list of a corresponding module can be extracted from the task system according to the task module information, then the task list is screened according to the task definition rules to obtain a target task list, then whether a local historical task information list exists is determined, if the local historical task information list exists, the local task information list can be obtained according to the local historical task information list and the target task list; if the local historical task information table does not exist, the local task information table can be established according to the target task list and the local code library address. Specifically, according to task module information, a task list can be extracted from corresponding modules of a task system, then the task list is screened according to task definition rules, such as an operation program, a task state and the like, then whether a local historical task information list exists or not is determined, namely whether the local historical task information list exists or not is determined, if the local historical task information list exists, the historical task information list can be compared with a target task list to determine a new task list and a deleted task list, then the target task list is updated according to the new task list and the deleted task list, and a local task information list is established according to the updated task list and a local code library address; if the historical task information table does not exist locally, the local task information table can be established directly according to the target task list and the local code library address.
According to the method and the device, the local task information table is reasonably constructed through the configuration information corresponding to the items to be checked and the local historical task information table, so that the corresponding script can be selected according to the local task information table later, and the corresponding grammar checking result is obtained through the task system, thereby improving the efficiency of code grammar checking and reducing the time cost.
In some optional implementations of this embodiment, if the local historical task information table exists, the step of obtaining the local task information table according to the local historical task information table and the target task list includes:
comparing the target task list with the local historical task information list to determine an added task list and a deleted task list;
updating the target task list according to the newly added task list and the deleted task list to obtain an updated task list;
and establishing the local task information table according to the updated task list and the local code base address.
In this embodiment, if a local history task information table exists, the target task list may be compared with the local history task information table to determine an added task list and a deleted task list, and then the target task list is updated according to the added task list and the deleted task list to obtain an updated task list, so that the local task information table is established according to the updated task list and the local code library address. Specifically, the local history task information table includes task information in which a history is checked by a code grammar, the target task list is compared with the local history task information table, whether a task which is repeated with the local history task information table exists in the target task list can be determined, a repeated part is used as a deletion task list, an unrepeated part is used as a newly added task list, then the target task list is updated according to the newly added task list and the deletion task list, an updated task list is obtained, and then the local task information table can be established according to the updated task list and a local code library address.
According to the method and the device, when the local historical task information table exists, the local task information table can be reasonably constructed through the local historical task information table and the target task list, so that corresponding scripts can be selected according to the local task information table later, and corresponding grammar checking results are obtained through the task system, so that the code grammar checking efficiency is improved, and the time cost is reduced.
In some optional implementations of this embodiment, after the step of determining the local task information table according to the task system and the task setting, the method further includes:
if the local historical task information table exists, updating the local historical task information table according to the local task information table to obtain an updated local historical task information table;
and if the local historical task information table does not exist, generating the local historical task information table according to the local task information table.
In this embodiment, after determining the local task information table, if the local history task information table exists, the local history task information table may be updated according to the local task information table, to obtain an updated local history task information table; if the local historical task information table does not exist, the local historical task information table can be generated according to the local task information table. Specifically, after determining whether a local historical task information table exists and establishing the local task information table, if the local historical task information table exists according to the determination, updating the local historical task information table according to the local task information table to obtain an updated local historical task information table for the next code grammar check; if the local history task information table does not exist, the local history task information table can be directly used as the local history task information table in the next code grammar check.
According to the method and the device, the local historical task information table is reasonably updated, so that repeated checking can be avoided when code grammar checking is carried out later, the efficiency of code grammar checking is improved, the time cost is reduced, and sufficient fault repairing time remains.
In some optional implementations of this embodiment, the step of determining, according to the local task information table, a target script in the local code library, and obtaining a grammar checking script according to the target script and the merge checking rule includes:
according to the task information corresponding to the local task information table, searching a corresponding script in the local code library to serve as the target script;
and processing the target script according to the merging checking rule to obtain the grammar checking script, wherein the grammar checking script can run an displain function in SQL.
In this embodiment, after the local task information table is determined, a corresponding script can be searched in the local code library according to task information corresponding to the local task information table, and used as a target script, and then the target script is processed according to the merging checking rule in the configuration information, so as to obtain a grammar checking script, and the grammar checking script can run the displain function in the SQL. Specifically, after the local task information table is determined, all scripts contained in the local task information table can be searched in a local code library according to the local task information table, and all scripts contained in the local task information table are determined, and the merge checking rule in the configuration information at least comprises the number of scripts for merge checking.
Alternatively, since each grammar checking script includes the aforementioned multiple target scripts merged by the merge checking rule, it is necessary to record the task and related information of the script included in each grammar checking script so as to obtain a clear grammar checking result later.
According to the method and the device, the grammar checking script is reasonably determined through the local task information table, so that code grammar checking is carried out under the condition that all scripts and tasks do not need to be run in full in a production environment, checking efficiency is improved, and time cost is reduced.
In some optional implementations of this embodiment, the step of executing the syntax checking script by the task system to obtain an execution result, and generating the syntax checking report corresponding to the item to be checked according to the execution result includes:
submitting the grammar checking script to the task system as a task to be executed for execution;
detecting an execution process at regular time, counting error reporting information generated in the execution process, and determining a completion progress;
and when the execution process is finished, taking the error reporting information as the execution result, and generating the grammar checking report according to the execution result.
In this embodiment, after the syntax checking script of the displain function in the executable SQL is obtained, the syntax checking script is submitted to the task system as a task to be executed for execution, in addition, the execution process is also required to be detected at regular time, error reporting information generated in the execution process is counted, the completion progress is determined, when the execution process is completed, the error reporting information is used as an execution result, and a syntax checking report corresponding to the item to be checked is generated according to the execution result. Specifically, since the grammar checking script only needs to verify whether the grammar operation passes or not, the grammar checking script only needs to meet the requirement of an displain function in the executable SQL, after the grammar checking script is submitted to the task system as a task to be executed, the task system can execute the grammar checking script to verify whether the grammar operation passes or not, if the grammar operation does not pass, error reporting information is generated, the execution process is detected at regular time, the error reporting information can be counted, whether the execution is completed or not is determined, after the execution is completed, all the counted error reporting information can be used as an execution result, and finally a grammar checking report corresponding to the item to be checked is generated according to the execution result.
After the grammar checking script is reasonably determined, the corresponding grammar checking result is obtained through the task system, so that code grammar checking is realized under the condition that all scripts and tasks do not need to be run in full in a production environment, the checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time is remained.
In some optional implementations of this embodiment, before the step of obtaining the configuration information corresponding to the item to be inspected, the configuration information includes a local code base address, a latest branch of a remote code base, task setting, and merging inspection rules, the method further includes:
and receiving a configuration instruction carrying preset parameters, and configuring according to the preset parameters to obtain the item to be inspected.
In this embodiment, before obtaining configuration information corresponding to an item to be inspected, a configuration instruction carrying a preset parameter needs to be received, and configuration is performed according to the preset parameter, so as to obtain the item to be inspected. Specifically, the configuration instruction may be input by a relevant developer, and the item to be checked may be configured according to a preset parameter carried by the configuration instruction, where the preset parameter corresponds to configuration information corresponding to the item to be checked, and the configuration information includes at least a local code library address, a latest branch of a remote code library, task setting, and a merge checking rule, and may further include information such as whether a local historical task information table needs to be updated, whether to run a grammar checking main program, and the like, as a running basis of the code grammar checking method.
According to the method and the device, the items to be checked are reasonably configured, so that code grammar checking can be carried out in the production environment under the condition that all scripts and tasks do not need to be run in full according to the corresponding configuration information, the checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time is remained.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by computer readable instructions stored in a computer readable storage medium that, when executed, may comprise the steps of the embodiments of the methods described above. The storage medium may be a nonvolatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a random access Memory (Random Access Memory, RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a code syntax checking system, which corresponds to the method embodiment shown in fig. 2, and which is particularly applicable to various electronic devices.
As shown in fig. 3, the code syntax checking system 300 according to the present embodiment includes: the device comprises an acquisition module 301, a grabbing module 302, a first determination module 303, a second determination module 304 and a generation module 305. Wherein:
the acquiring module 301 is configured to acquire configuration information corresponding to an item to be inspected, where the configuration information includes a local code library address, a latest branch of a remote code library, task setting, and a merge inspection rule;
a grabbing module 302, configured to grab all scripts of the latest branch of the remote code library into a local code library according to the local code library address;
a first determining module 303, configured to determine a local task information table according to a task system and the task setting;
a second determining module 304, configured to determine a target script in the local code library according to the local task information table, and obtain a grammar checking script according to the target script and the merge checking rule;
And the generating module 305 is configured to execute the grammar checking script through the task system, obtain an execution result, and generate a grammar checking report corresponding to the item to be checked according to the execution result.
According to the code grammar checking system, the corresponding script can be automatically grabbed and selected according to grammar checking requirements, and the corresponding grammar checking result is obtained through the task system, so that code grammar checking is carried out under the condition that all scripts and tasks do not need to be run in a full quantity in a production environment, the checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time is remained.
In some optional implementations of this embodiment, the first determining module 303 is further configured to:
extracting a task list of a corresponding module from the task system according to the task module information;
screening the task list according to the task definition rule to obtain a target task list;
determining whether a local historical task information table exists;
if the local historical task information table exists, obtaining the local task information table according to the local historical task information table and the target task list;
If the local historical task information table does not exist, the local task information table is built according to the target task list and the local code base address.
According to the code grammar checking system, the local task information table is reasonably constructed through the configuration information corresponding to the items to be checked and the local historical task information table, so that the corresponding script can be selected according to the local task information table later, and the corresponding grammar checking result is obtained through the task system, thereby improving the code grammar checking efficiency and reducing the time cost.
In some optional implementations of this embodiment, the first determining module 303 is further configured to:
comparing the target task list with the local historical task information list to determine an added task list and a deleted task list;
updating the target task list according to the newly added task list and the deleted task list to obtain an updated task list;
and establishing the local task information table according to the updated task list and the local code base address.
According to the code grammar checking system, when the local historical task information table exists, the local task information table can be reasonably constructed through the local historical task information table and the target task list, so that a corresponding script can be selected according to the local task information table later, and a corresponding grammar checking result is obtained through the task system, so that the code grammar checking efficiency is improved, and the time cost is reduced.
In some alternative implementations of the present embodiment, the code syntax checking system 300 is further configured to:
if the local historical task information table exists, updating the local historical task information table according to the local task information table to obtain an updated local historical task information table;
and if the local historical task information table does not exist, generating the local historical task information table according to the local task information table.
According to the code grammar checking system, the local historical task information table is reasonably updated, so that repeated checking can be avoided when code grammar checking is carried out later, the code grammar checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time remains.
In some optional implementations of this embodiment, the second determining module 304 is further configured to:
according to the task information corresponding to the local task information table, searching a corresponding script in the local code library to serve as the target script;
and processing the target script according to the merging checking rule to obtain the grammar checking script, wherein the grammar checking script can run an displain function in SQL.
According to the code grammar checking system, the grammar checking script is reasonably determined through the local task information table, so that code grammar checking is performed under the condition that all scripts and tasks do not need to be run in a full quantity in a production environment, checking efficiency is improved, and time cost is reduced.
In some optional implementations of the present embodiment, the generating module 305 is further configured to:
submitting the grammar checking script to the task system as a task to be executed for execution;
detecting an execution process at regular time, counting error reporting information generated in the execution process, and determining a completion progress;
and when the execution process is finished, taking the error reporting information as the execution result, and generating the grammar checking report according to the execution result.
According to the code grammar checking system, after the grammar checking script is reasonably determined, the corresponding grammar checking result is obtained through the task system, so that code grammar checking is carried out under the condition that all scripts and tasks do not need to be run in full in a production environment, the checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time is remained.
In some alternative implementations of the present embodiment, the code syntax checking system 300 is further configured to:
and receiving a configuration instruction carrying preset parameters, and configuring according to the preset parameters to obtain the item to be inspected.
According to the code grammar checking system, the items to be checked are reasonably configured, so that code grammar checking can be carried out in the production environment under the condition that all scripts and tasks do not need to be run in full according to the corresponding configuration information, the checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time is remained.
In order to solve the technical problems, the embodiment of the application also provides computer equipment. Referring specifically to fig. 4, fig. 4 is a basic structural block diagram of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It should be noted that only computer device 4 having components 41-43 is shown in the figures, but it should be understood that not all of the illustrated components are required to be implemented and that more or fewer components may be implemented instead. It will be appreciated by those skilled in the art that the computer device herein is a device capable of automatically performing numerical calculations and/or information processing in accordance with predetermined or stored instructions, the hardware of which includes, but is not limited to, microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASICs), programmable gate arrays (fields-Programmable Gate Array, FPGAs), digital processors (Digital Signal Processor, DSPs), embedded devices, etc.
The computer equipment can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing equipment. The computer equipment can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), programmable Read Only Memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the storage 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the computer device 4. Of course, the memory 41 may also comprise both an internal memory unit of the computer device 4 and an external memory device. In this embodiment, the memory 41 is typically used for storing an operating system and various application software installed on the computer device 4, such as computer readable instructions of a code syntax checking method. Further, the memory 41 may be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute computer readable instructions stored in the memory 41 or process data, such as computer readable instructions for executing the code syntax checking method.
The network interface 43 may comprise a wireless network interface or a wired network interface, which network interface 43 is typically used for establishing a communication connection between the computer device 4 and other electronic devices.
According to the computer equipment, the corresponding script can be automatically captured and selected according to the grammar checking requirement, and the corresponding grammar checking result is obtained through the task system, so that code grammar checking is carried out under the condition that all scripts and tasks do not need to be run in a full quantity in a production environment, the checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time is remained.
The present application also provides another embodiment, namely, a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of a code syntax checking method as described above.
The computer readable storage medium provided by the application can automatically capture and select the corresponding script according to the grammar checking requirement, and obtain the corresponding grammar checking result through the task system, so that code grammar checking is realized under the condition that all scripts and tasks do not need to be run in full in the production environment, the checking efficiency is improved, the time cost is reduced, and sufficient fault repairing time is remained.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method described in the embodiments of the present application.
It is apparent that the embodiments described above are only some embodiments of the present application, but not all embodiments, the preferred embodiments of the present application are given in the drawings, but not limiting the patent scope of the present application. This application may be embodied in many different forms, but rather, embodiments are provided in order to provide a more thorough understanding of the present disclosure. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that modifications may be made to the embodiments described in the foregoing, or equivalents may be substituted for elements thereof. All equivalent structures made by the specification and the drawings of the application are directly or indirectly applied to other related technical fields, and are also within the protection scope of the application.

Claims (10)

1. A code syntax checking method, comprising the steps of:
acquiring configuration information corresponding to an item to be checked, wherein the configuration information comprises a local code library address, a latest branch of a remote code library, task setting and merging checking rules;
capturing all scripts of the latest branch of the remote code library to a local code library according to the local code library address;
Determining a local task information table according to a task system and the task setting;
determining a target script in the local code base according to the local task information table, and obtaining a grammar checking script according to the target script and the merging checking rule;
executing the grammar checking script through the task system to obtain an execution result, and generating a grammar checking report corresponding to the item to be checked according to the execution result.
2. The code syntax checking method according to claim 1, wherein said task setting comprises task module information, task definition rules, and said step of determining a local task information table according to a task system and said task setting comprises:
extracting a task list of a corresponding module from the task system according to the task module information;
screening the task list according to the task definition rule to obtain a target task list;
determining whether a local historical task information table exists;
if the local historical task information table exists, obtaining the local task information table according to the local historical task information table and the target task list;
If the local historical task information table does not exist, the local task information table is built according to the target task list and the local code base address.
3. The method for checking code syntax according to claim 2, wherein if the local history task information table exists, the step of obtaining the local task information table according to the local history task information table and the target task list specifically includes:
comparing the target task list with the local historical task information list to determine an added task list and a deleted task list;
updating the target task list according to the newly added task list and the deleted task list to obtain an updated task list;
and establishing the local task information table according to the updated task list and the local code base address.
4. The code syntax checking method according to claim 2, further comprising, after said step of determining a local task information table according to a task system and said task setting:
if the local historical task information table exists, updating the local historical task information table according to the local task information table to obtain an updated local historical task information table;
And if the local historical task information table does not exist, generating the local historical task information table according to the local task information table.
5. The code syntax checking method according to claim 1, wherein said determining a target script in said local code base according to said local task information table, and obtaining a syntax checking script according to said target script and said merge checking rule, comprises:
according to the task information corresponding to the local task information table, searching a corresponding script in the local code library to serve as the target script;
and processing the target script according to the merging checking rule to obtain the grammar checking script, wherein the grammar checking script can run an displain function in SQL.
6. The method for checking code grammar according to claim 1, wherein the step of executing the grammar checking script by the task system to obtain an execution result, and generating a grammar checking report corresponding to the item to be checked according to the execution result specifically comprises:
submitting the grammar checking script to the task system as a task to be executed for execution;
Detecting an execution process at regular time, counting error reporting information generated in the execution process, and determining a completion progress;
and when the execution process is finished, taking the error reporting information as the execution result, and generating the grammar checking report according to the execution result.
7. The code syntax checking method according to any one of claims 1 to 6, further comprising, before said step of obtaining configuration information corresponding to an item to be checked, said configuration information including a local code base address, a remote code base latest branch, a task setting, and a merge checking rule:
and receiving a configuration instruction carrying preset parameters, and configuring according to the preset parameters to obtain the item to be inspected.
8. A code syntax checking system, comprising:
the acquisition module is used for acquiring configuration information corresponding to the item to be checked, wherein the configuration information comprises a local code library address, a latest branch of a remote code library, task setting and a merging check rule;
the grabbing module is used for grabbing all scripts of the latest branch of the remote code library to the local code library according to the local code library address;
The first determining module is used for determining a local task information table according to the task system and the task setting;
the second determining module is used for determining a target script in the local code library according to the local task information table and obtaining a grammar checking script according to the target script and the merging checking rule;
and the generation module is used for executing the grammar checking script through the task system to obtain an execution result, and generating a grammar checking report corresponding to the item to be checked according to the execution result.
9. A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which when executed by the processor implement the steps of the code syntax checking method of any of claims 1 to 7.
10. A computer readable storage medium having stored thereon computer readable instructions which when executed by a processor implement the steps of the code syntax checking method according to any one of claims 1 to 7.
CN202410008668.4A 2024-01-03 2024-01-03 Code grammar checking method, system, computer device and storage medium Pending CN117827661A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410008668.4A CN117827661A (en) 2024-01-03 2024-01-03 Code grammar checking method, system, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410008668.4A CN117827661A (en) 2024-01-03 2024-01-03 Code grammar checking method, system, computer device and storage medium

Publications (1)

Publication Number Publication Date
CN117827661A true CN117827661A (en) 2024-04-05

Family

ID=90509571

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410008668.4A Pending CN117827661A (en) 2024-01-03 2024-01-03 Code grammar checking method, system, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN117827661A (en)

Similar Documents

Publication Publication Date Title
CN108415832B (en) Interface automation test method, device, equipment and storage medium
CN111552633A (en) Interface abnormal call testing method and device, computer equipment and storage medium
CN112559354A (en) Front-end code specification detection method and device, computer equipment and storage medium
CN112181835B (en) Automatic test method, device, computer equipment and storage medium
CN112363814A (en) Task scheduling method and device, computer equipment and storage medium
CN113287096A (en) Test result classification for failed code verification
CN112835808A (en) Interface testing method and device, computer equipment and storage medium
CN112506757A (en) Automatic test method, system, computer device and medium thereof
CN117033249A (en) Test case generation method and device, computer equipment and storage medium
CN117234505A (en) Interactive page generation method, device, equipment and storage medium thereof
CN112561690A (en) Method, system, equipment and storage medium for testing credit card staging service interface
CN111475388A (en) Data push test method and device, computer equipment and storage medium
CN114637672A (en) Automatic data testing method and device, computer equipment and storage medium
CN115328764A (en) Test code optimization method based on automatic test and related equipment thereof
CN117827661A (en) Code grammar checking method, system, computer device and storage medium
CN113032256A (en) Automatic test method, device, computer system and readable storage medium
CN114328214B (en) Efficiency improving method and device for interface test case of reporting software and computer equipment
CN115129355B (en) Page repair method, system and computer equipment thereof
CN110175116B (en) Test date switching method, device and system
CN117271321A (en) Service automation test method, system, computer equipment and storage medium
CN115878460A (en) Regression testing method, device, computer equipment and storage medium
CN116955201A (en) Data development test method, device, equipment and medium
CN117076485A (en) Data comparison method, system, computer equipment and storage medium
CN117421311A (en) Data verification method, device, equipment and storage medium based on artificial intelligence
CN116909702A (en) Task generation method based on test data and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination