Code syntax checking method and system, computer device and storage medium

By acquiring configuration information, capturing remote code repositories, and generating syntax checking scripts, the problem of low efficiency in code syntax checking in the fintech industry has been solved, achieving efficient syntax checking and fault repair.

CN117827661BActive Publication Date: 2025-11-21CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410008668.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-03
Publication Date
2025-11-21
Estimated Expiration
2044-01-03

AI Technical Summary

Technical Problem

In the fintech industry, traditional code syntax checking methods are inefficient and time-consuming in production environments, and cannot effectively ensure the normal operation of production environments.

Method used

By acquiring configuration information, the remote code repository is captured to the local machine. Based on the task system and settings, the task information table is determined, a syntax check script is generated, and the script is executed through the task system to generate a report.

Benefits of technology

It improves the efficiency of code syntax checking, reduces time costs, and ensures timely fault repair.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117827661B_ABST
    Figure CN117827661B_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to a code syntax checking method, comprising: obtaining configuration information corresponding to a to-be-checked project, the configuration information comprising a local code library address, a remote code library latest branch, task settings and a merging checking rule; according to the local code library address, grabbing all scripts of the remote code library latest branch to the local code library; according to the task system and the task settings, determining a local task information table; according to the local task information table, determining a target script in the local code library, and obtaining a syntax checking script according to the target script and the merging checking rule; executing the syntax checking script through the task system to obtain an execution result, and generating a syntax checking report corresponding to the to-be-checked project according to the execution result. The present application also provides a code syntax checking system, a computer device and a storage medium. The present application improves the efficiency of code syntax checking and reduces the time cost.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers and the technical field of financial technology, and is applied to the scenario of checking whether the code syntax is correct in the data development process of the related industry of financial technology, and particularly relates to a code syntax checking method and system, a computer device, and a storage medium. BACKGROUND

[0002] At present, in the related industry of financial technology, the requirements for data in all aspects, especially quality, are relatively strict. The guarantee of data quality comes from data development, and in the process of data development, the smooth running of newly added scripts and tasks in the production environment is the most basic and important requirement.

[0003] For the newly added scripts and tasks in the production environment, once a problem occurs, it will affect the downstream scripts and tasks, and there is also a potential possibility of affecting non-dependent tasks. Therefore, it is of great significance to perform full syntax checking on the new version of the code library before the scripts and tasks are put online.

[0004] However, through the traditional way of syntax checking, running and verifying the full scripts and tasks in the test environment cannot reproduce the running situation in the production environment, and it is difficult to ensure the normal operation of the production environment; running all scripts and tasks in the production environment has low checking efficiency, high time cost, and less remaining fault repair time. SUMMARY

[0005] The purpose of the embodiments of the present application is to provide a code syntax checking method, system, computer device, and storage medium to solve the technical problems of low checking efficiency and high time cost when performing full syntax checking on the code library.

[0006] 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 scheme:

[0007] Obtain configuration information corresponding to the project to be checked, wherein the configuration information includes a local code library address, a remote code library latest branch, task settings, and merging checking rules;

[0008] According to the local code library address, all scripts of the remote code library latest branch are grabbed to the local code library;

[0009] According to the task system and the task settings, determine the local task information table;

[0010] According to the local task information table, determine the target script in the local code library, and obtain the syntax checking script according to the target script and the merging checking rule;

[0011] The syntax checking script is executed by the task system to obtain an execution result, and a syntax checking report corresponding to the to-be-checked item is generated according to the execution result.

[0012] Further, the task setting includes task module information and task limitation rules, and the step of determining the local task information table according to the task system and the task setting specifically includes:

[0013] According to the task module information, a task list of a corresponding module is extracted from the task system;

[0014] The task list is filtered according to the task limitation rules to obtain a target task list;

[0015] It is determined whether a local historical task information table exists;

[0016] If the local historical task information table exists, the local task information table is obtained according to the local historical task information table and the target task list;

[0017] If the local historical task information table does not exist, the local task information table is established according to the target task list and the local code base address.

[0018] Further, 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 specifically includes:

[0019] The target task list is compared with the local historical task information table to determine an added task list and a deleted task list;

[0020] The target task list is updated according to the added task list and the deleted task list to obtain an updated task list;

[0021] The local task information table is established according to the updated task list and the local code base address.

[0022] Further, after the step of determining the local task information table according to the task system and the task setting, the step further includes:

[0023] If the local historical task information table exists, the local historical task information table is updated according to the local task information table to obtain an updated local historical task information table;

[0024] If the local historical task information table does not exist, the local historical task information table is generated according to the local task information table.

[0025] Further, the step of determining a target script in the local code library according to the local task information table, and obtaining a syntax checking script according to the target script and the merge checking rule, specifically comprises:

[0026] According to the task information corresponding to the local task information table, retrieving a corresponding script in the local code library as the target script;

[0027] Processing the target script according to the merge checking rule to obtain the syntax checking script, wherein the syntax checking script can run an Explain function in SQL.

[0028] Further, the step of executing the syntax checking script through the task system to obtain an execution result, and generating a syntax checking report corresponding to the to-be-checked item according to the execution result, specifically comprises:

[0029] Submitting the syntax checking script as a to-be-executed task to the task system for execution;

[0030] Detecting the execution process at a time, counting error information generated in the execution process, and determining a completion progress;

[0031] When the execution process is completed, taking the error information as the execution result, and generating the syntax checking report according to the execution result.

[0032] Further, before the step of obtaining configuration information corresponding to the to-be-checked item, the configuration information including a local code library address, a remote code library latest branch, a task setting, and a merge checking rule, further comprises:

[0033] Receiving a configuration instruction carrying a preset parameter, and configuring according to the preset parameter to obtain the to-be-checked item.

[0034] To solve the above technical problems, the embodiment of the present application further provides a code syntax checking system, which adopts the following technical scheme:

[0035] A code syntax checking system, comprising:

[0036] An obtaining module, configured to obtain configuration information corresponding to a to-be-checked item, the configuration information including a local code library address, a remote code library latest branch, a task setting, and a merge checking rule;

[0037] A grabbing module, configured to grab all scripts of the remote code library latest branch to the local code library according to the local code library address;

[0038] A first determining module, configured to determine a local task information table according to a task system and the task setting;

[0039] a second determining module, configured to determine a target script in the local code library according to the local task information table, and obtain a syntax checking script according to the target script and the merge checking rule;

[0040] a generating module, configured to execute the syntax checking script through the task system to obtain an execution result, and generate a syntax checking report corresponding to the to-be-checked item according to the execution result.

[0041] To solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the technical scheme as follows:

[0042] A computer device, comprising a memory and a processor, the memory stores computer readable instructions, and the processor executes the computer readable instructions to realize the steps of the code syntax checking method as described above.

[0043] To solve the above technical problems, the embodiment of the present application further provides a computer readable storage medium, which adopts the technical scheme as follows:

[0044] A computer readable storage medium, the computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by the processor to realize the steps of the code syntax checking method as described above.

[0045] Compared with the prior art, the embodiment of the present application has the following beneficial effects:

[0046] The code syntax checking method disclosed in the present application obtains configuration information corresponding to a to-be-checked item, the configuration information comprising a local code library address, a remote code library latest branch, task settings and a merge checking rule; all scripts of the remote code library latest branch are grabbed to the local code library according to the local code library address; a local task information table is determined according to a task system and the task settings; a target script is determined in the local code library according to the local task information table, and a syntax checking script is obtained according to the target script and the merge checking rule; the syntax checking script is executed through the task system to obtain an execution result, and a syntax checking report corresponding to the to-be-checked item is generated according to the execution result. The present application can automatically grab and select corresponding scripts according to syntax checking requirements, and obtain corresponding syntax checking results through a task system, so that code syntax checking is realized without full running of all scripts and tasks in a production environment, thereby improving checking efficiency, reducing time cost, and saving sufficient fault repair time. BRIEF DESCRIPTION OF DRAWINGS

[0047] In order to more clearly illustrate the solutions in the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0048] Figure 1 is an exemplary system architecture diagram to which the present application can be applied;

[0049] Figure 2 is a flow chart of one embodiment of the code syntax checking method according to the present application;

[0050] Figure 3 is a structural schematic diagram of one embodiment of the code syntax checking system according to the present application;

[0051] Figure 4 is a structural schematic diagram of one embodiment of the computer device according to the present application. DETAILED DESCRIPTION

[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application; the description and the claims of the present application and the above-mentioned drawings in the specification illustrate the present application by way of example; the terms "comprise", "comprising", "include", "including", "have" and "having" and any variations thereof in the specification are intended to cover a non-exclusive inclusion; the terms "first", "second" and the like in the specification and the claims of the present application and the above-mentioned drawings are used to distinguish different objects, not to describe a particular order.

[0053] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive or alternative embodiments. It is expressly understood that the embodiments described herein are merely examples from a whole class of comparable embodiments which those skilled in the art will readily appreciate. It is further understood that the descriptions of various embodiments do not imply that the compositions are an exhaustive list of possible implementations.

[0054] In order to make the technical personnel in the art better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings.

[0055] As Figure 1As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0056] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.

[0057] Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III) players, MP4 (Moving Picture Experts Group Audio Layer IV) players, laptops, and desktop computers, etc.

[0058] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.

[0059] It should be noted that the code syntax checking method provided in this application embodiment is generally executed by a server, and correspondingly, the code syntax checking system is generally set up in the server.

[0060] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0061] Continue to refer to Figure 2 A flowchart of an embodiment of the code syntax checking method according to this application is shown. The code syntax checking method includes the following steps:

[0062] Step S201: Obtain the configuration information corresponding to the project to be checked. The configuration information includes the local code repository address, the latest branch of the remote code repository, task settings, and merge check rules.

[0063] It should be noted that code syntax checking methods run on electronic devices (e.g.,Figure 1 The server shown) can send or receive data through a wired connection or a wireless connection. The wireless connection can include, but is not limited to, 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultrawideband) connection, and other now known or future developed wireless connection.

[0064] In this embodiment, when the code syntax checking method is run, the configuration information corresponding to the to-be-checked project needs to be obtained first, wherein the configuration information includes the local code library address, the latest branch of the remote code library, the task setting, and the merging checking rule. Specifically, the code syntax checking method of the present embodiment is applied to the scene of checking whether the code syntax is correct in the data development process of the related industry of financial technology. For example, when the value of an option is estimated by a Monte Carlo simulation method, an option pricing model, i.e., a BSM model, needs to be used. When the BSM model is translated into Python code, the code syntax needs to be checked. Correspondingly, in other scenarios involving the conversion of financial algorithm code, the code syntax also needs to be checked. Before running the code syntax checking method of the present embodiment, the related developer can configure the syntax checking project according to the syntax checking requirement. The configured project is the to-be-checked project. After starting to run the code syntax checking method, the configuration information corresponding to the to-be-checked project can be obtained, so that the code syntax checking can be performed according to the configuration information in the subsequent process. The configuration information at least includes the local code library address, the latest branch of the remote code library, the task setting, and the merging checking rule.

[0065] In step S202, all scripts of the latest branch of the remote code library are grabbed to the local code library according to the local code library address.

[0066] In this embodiment, after obtaining the configuration information corresponding to the to-be-checked project, all scripts of the latest branch of the remote code library in the configuration information can be grabbed to the local code library according to the local code library address in the configuration information. Specifically, after obtaining the configuration information corresponding to the to-be-checked project, since the local code library address and the latest branch of the remote code library are included in the configuration information, all scripts in the latest branch of the remote code library can be automatically grabbed to the local code library according to the local code library address, so that the syntax checking can be performed according to the suitable scripts screened in the local code library in the subsequent process.

[0067] In step S203, the local task information table is determined according to the task system and the task setting.

[0068] In the embodiment, after all scripts of the latest branch of the remote code library are fetched to the local code library, the local task information table can be determined according to the task settings in the task system and the configuration information. Specifically, the task settings in the configuration information can include task module information and task limitation rules. According to the task module information, the task list of the corresponding module can be extracted from the task system, and the task list is filtered according to the task limitation rules such as running program and task state to obtain a target task list. Then, it is determined whether the local historical task information table exists. When the local historical task information table exists, the local task information table can be obtained by comprehensively considering the local historical task information table and the target task list, for example, the target task list is updated according to the local historical task information table, and an updated task list is obtained. Then, the local task information table is established according to the updated task list and the local code library address, so that the corresponding script can be determined from the local code library according to the local task information table in the subsequent process. When the local historical task information table does not exist, the local task information table can be directly established according to the target task list and the local code library address. Since the basic information of the task in the task list, such as the library name and the table name, and the address of the corresponding script in the local code library are recorded in the local task information table, the corresponding script can be determined from the local code library according to the local task information table in the subsequent process.

[0069] In step S204, the target script is determined in the local code library according to the local task information table, and the syntax checking script is obtained according to the target script and the merging checking rule.

[0070] In the embodiment, after the local task information table is obtained, the target script can be determined in the local code library according to the local task information table, and the syntax checking script is obtained according to the target script and the merging checking rule in the configuration information. Specifically, after all scripts of the latest branch of the remote code library are fetched to the local code library and the local task information table is obtained, a certain number of scripts corresponding to the task information of the local task information table can be searched in the local code library as target scripts. Then, the target scripts are processed according to the merging checking rule in the configuration information, so as to obtain the syntax checking script. The merging checking rule at least includes the number of scripts for merging checking. The process of processing the target scripts according to the merging checking rule is that the target scripts are merged according to the script data for merging checking to obtain a certain number of syntax checking scripts. The merging checking rule also requires that the merged syntax checking script can run the Explain function in SQL.

[0071] In step S205, the syntax checking script is executed through the task system to obtain an execution result, and a syntax checking report corresponding to the to-be-checked item is generated according to the execution result.

[0072] In the embodiment, after the syntax checking scripts are obtained according to the target script and the merging checking rule, the syntax checking scripts can be executed through the task system, and the execution result is obtained, and finally the syntax checking report corresponding to the to-be-checked project is generated according to the execution result. Specifically, after the syntax checking scripts are obtained, all the syntax checking scripts can be submitted to the task system for execution, and the execution process is detected at regular time to determine the completion progress and whether there is an error, and the error information generated in the process is counted. If any syntax checking script has an error, it means that the syntax of the script has a problem, and the syntax checking script without error is a correct script. Therefore, after the execution process is completed, the counted error information can be taken as the execution result, and finally the syntax checking report corresponding to the to-be-checked project is generated according to the execution result. The report can list the tasks and scripts with syntax errors in detail.

[0073] Optionally, in the above execution process, after any syntax checking script has an error, a secondary syntax checking script can be generated according to the task corresponding to the script, and the generated secondary syntax checking script is submitted to the task system for execution, so that the syntax error can be more accurately located.

[0074] The application can automatically grab and select the corresponding script according to the syntax checking requirement, and obtain the corresponding syntax checking result through the task system, so that the code syntax checking can be performed without running all scripts and tasks in the production environment, thereby improving the checking efficiency, reducing the time cost, and leaving sufficient fault repair time.

[0075] In some optional implementation manners of the embodiment, the task setting includes task module information and task limitation rule, and the step of determining the local task information table according to the task system and the task setting includes:

[0076] extracting a task list of the corresponding module from the task system according to the task module information;

[0077] screening the task list according to the task limitation rule to obtain a target task list;

[0078] determining whether there is a local historical task information table;

[0079] 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;

[0080] if the local historical task information table does not exist, establishing the local task information table according to the target task list and the local code base address.

[0081] In the embodiment, the task setting in the configuration information includes task module information and task limitation rules. After all scripts of the latest branch of the remote code library are grabbed to the local code library, the task list of the corresponding module can be extracted from the task system according to the task module information, the target task list can be obtained by screening the task list according to the task limitation rules, and then it is determined whether the local historical task information table exists. If the local historical task information table exists, the local task information table can be obtained 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 can be established according to the target task list and the local code library address. Specifically, the task list can be extracted from the corresponding module of the task system according to the task module information, and the target task list can be obtained by screening the task list according to the task limitation rules such as running programs and task states. Then, it is determined whether the local historical task information table exists, that is, whether the local historical task information table exists. If the local historical task information table exists, the historical task information table and the target task list are compared to determine the new task list and the deleted task list, the target task list is updated according to the new task list and the deleted task list, and the local task information table is established according to the updated task list and the local code library address. If the local historical task information table does not exist, the local task information table can be directly established according to the target task list and the local code library address.

[0082] The application reasonably constructs the local task information table through the configuration information corresponding to the to-be-checked item and the local historical task information table, so that the corresponding script can be selected according to the local task information table in the subsequent process, and the corresponding syntax checking result is obtained through the task system, thereby improving the efficiency of code syntax checking and reducing the time cost.

[0083] In some optional implementation manners of the 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:

[0084] The target task list is compared with the local historical task information table to determine the new task list and the deleted task list.

[0085] The target task list is updated according to the new task list and the deleted task list to obtain an updated task list.

[0086] The local task information table is established according to the updated task list and the local code library address.

[0087] In the embodiment, if the local historical task information table exists, the target task list can be compared with the local historical task information table to determine the new task list and the deletion task list, and then the target task list is updated according to the new task list and the deletion 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 historical task information table contains the task information of the historical code syntax check, the target task list is compared with the local historical task information table to determine whether there is a task in the target task list that is repeated in the local historical task information table, and the repeated part is taken as the deletion task list and the non-repeated part is taken as the new task list, and then the target task list is updated according to the new task list and the deletion task list to obtain an updated task list, and then the local task information table is established according to the updated task list and the local code library address.

[0088] The application can reasonably construct the local task information table through the local historical task information table and the target task list when the local historical task information table exists, so that the corresponding script can be selected according to the local task information table in the subsequent process, and the corresponding syntax check result is obtained through the task system, thereby improving the efficiency of code syntax check and reducing the time cost.

[0089] In some optional implementation modes of the embodiment, after the step of determining the local task information table according to the task system and the task setting, the method further includes:

[0090] If the local historical task information table exists, the local historical task information table is updated according to the local task information table to obtain an updated local historical task information table.

[0091] If the local historical task information table does not exist, the local historical task information table is generated according to the local task information table.

[0092] In the embodiment, after the local task information table is determined, if the local historical task information table exists, the local historical task information table can be updated according to the local task information table to obtain an updated local historical 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 it is determined whether the local historical task information table exists and the local task information table is established, according to the foregoing determination, if the local historical task information table exists, the local historical task information table can be updated according to the local task information table to obtain an updated local historical task information table for use in the next code syntax check; and if the local historical task information table does not exist, the local task information table can be directly taken as the local historical task information table for the next code syntax check.

[0093] The application can avoid repeated checking when subsequent code syntax checking is performed, thereby improving the efficiency of code syntax checking, reducing time costs, and saving sufficient fault repair time.

[0094] In some optional implementations of the embodiment, the step of determining a target script in the local code library according to the local task information table and obtaining a syntax checking script according to the target script and the merged checking rule includes:

[0095] retrieving a corresponding script in the local code library as the target script according to task information corresponding to the local task information table;

[0096] processing the target script according to the merged checking rule to obtain the syntax checking script, wherein the syntax checking script can run an Explain function in SQL.

[0097] In the embodiment, after the local task information table is determined, a corresponding script in the local code library can be retrieved as a target script according to task information corresponding to the local task information table, and a syntax checking script can be obtained by processing the target script according to the merged checking rule in the configuration information. The syntax checking script can run an Explain function in SQL. Specifically, after the local task information table is determined, all scripts contained in the local task information table can be determined by searching in the local code library according to the local task information table. The merged checking rule in the configuration information includes at least the number of scripts subjected to merged checking. Since the embodiment only needs to verify whether syntax running is passed and does not need to verify data results, the obtained script only needs to meet the requirement of being able to run the Explain function in SQL. According to the merged checking rule, all scripts contained in the local task information table can be appropriately processed to be merged into a number of scripts that can run the Explain function in SQL as syntax checking scripts, so that subsequent code syntax checking can be performed according to the syntax checking scripts.

[0098] Optionally, since each syntax checking script contains a plurality of target scripts merged by the foregoing merged checking rule, the information about tasks and scripts contained in each syntax checking script needs to be recorded to obtain clear syntax checking results subsequently.

[0099] The application can reasonably determine syntax checking scripts by using the local task information table, thereby achieving code syntax checking without running all scripts and tasks in a production environment, improving checking efficiency, and reducing time costs.

[0100] In some optional implementations of the embodiment, the step of executing the syntax checking script by the task system, obtaining an execution result, and generating the syntax checking report corresponding to the to-be-checked item according to the execution result comprises:

[0101] submitting the syntax checking script as a to-be-executed task to the task system for execution;

[0102] detecting the execution process in a timely manner, counting error information generated in the execution process, and determining a completion progress;

[0103] when the execution process is completed, taking the error information as the execution result, and generating the syntax checking report according to the execution result.

[0104] In the embodiment, after the syntax checking script of the Explain function in the executable SQL is obtained, the syntax checking script is submitted as a to-be-executed task to the task system for execution. In addition, the execution process is detected in a timely manner, error information generated in the execution process is counted, and a completion progress is determined. When the execution process is completed, the error information is taken as the execution result, and a syntax checking report corresponding to the to-be-checked item is generated according to the execution result. Specifically, since the syntax checking script only needs to verify whether the syntax runs successfully, the syntax checking script needs to meet the requirements of the Explain function in the executable SQL. After the syntax checking script is submitted as a to-be-executed task to the task system, the task system can execute the syntax checking script to verify whether the syntax runs successfully. If there is a failure, error information is generated. The execution process is detected in a timely manner, the error information is counted, and whether the execution is completed is determined. After the execution is completed, all the counted error information is taken as the execution result, and finally a syntax checking report corresponding to the to-be-checked item is generated according to the execution result.

[0105] After the syntax checking script is reasonably determined, the syntax checking result corresponding to the syntax checking script is obtained through the task system, so that code syntax checking is implemented without full execution of all scripts and tasks in the production environment, thereby improving the checking efficiency, reducing the time cost, and saving sufficient fault repair time.

[0106] In some optional implementations of the embodiment, before the step of obtaining configuration information corresponding to the to-be-checked item, the configuration information comprising a local code library address, a remote code library latest branch, task settings, and merging checking rules, the method further comprises:

[0107] receiving a configuration instruction carrying preset parameters, configuring according to the preset parameters, and obtaining the to-be-checked item.

[0108] In this embodiment, before obtaining the configuration information corresponding to the to-be-checked item, a configuration instruction carrying preset parameters needs to be received, and the to-be-checked item is configured according to the preset parameters, so as to obtain the to-be-checked item. Specifically, the configuration instruction can be input by a related developer, and the to-be-checked item can be configured according to the preset parameters carried by the configuration instruction. The preset parameters correspond to the configuration information corresponding to the to-be-checked item, and the configuration information at least includes a local code library address, a remote code library latest branch, task setting, and merging checking rules. The configuration information can also include, for example, whether the local historical task information table needs to be updated, whether the syntax checking main program needs to be run, and the like, as the running basis of the code syntax checking method.

[0109] The present application can reasonably configure the to-be-checked item, so that subsequent code syntax checking can be performed in a production environment without full running of all scripts and tasks, thereby improving the checking efficiency, reducing the time cost, and saving sufficient fault repair time.

[0110] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by computer readable instructions instructing related hardware, and the computer readable instructions can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments of each method. The storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0111] It should be understood that although each step in the flowchart of the accompanying drawings is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise stated herein, the execution of these steps is not strictly limited in sequence, and they can be executed in other orders. Moreover, at least part of the steps in the flowchart of the accompanying drawings can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or other steps, sub-steps or stages.

[0112] Further referring to Figure 3 , as an implementation of the method shown in Figure 2 , the present application provides an embodiment of a code syntax checking system, which corresponds to the method embodiment shown in Figure 2 . The system can be applied to various electronic devices.

[0113] AsFigure 3 As shown, the code syntax checking system 300 described in this embodiment 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:

[0114] The acquisition module 301 is configured to acquire configuration information corresponding to a project to be checked, wherein the configuration information comprises a local code library address, a remote code library latest branch, task settings, and a merging checking rule;

[0115] The grabbing module 302 is configured to grab all scripts of the remote code library latest branch to the local code library according to the local code library address;

[0116] The first determination module 303 is configured to determine a local task information table according to a task system and the task settings;

[0117] The second determination module 304 is configured to determine a target script in the local code library according to the local task information table, and obtain a syntax checking script according to the target script and the merging checking rule;

[0118] The generation module 305 is configured to execute the syntax checking script through the task system to obtain an execution result, and generate a syntax checking report corresponding to the project to be checked according to the execution result.

[0119] The code syntax checking system provided in this application can automatically grab and select corresponding scripts according to syntax checking requirements, and obtain corresponding syntax checking results through a task system, so as to realize code syntax checking without full running of all scripts and tasks in a production environment, thereby improving checking efficiency, reducing time cost, and saving sufficient fault repair time.

[0120] In some optional implementation manners of this embodiment, the first determination module 303 is further configured to:

[0121] extract a task list of a corresponding module from the task system according to the task module information;

[0122] screen the task list according to the task limitation rule to obtain a target task list;

[0123] determine whether there is a local historical task information table;

[0124] if there is the local historical task information table, obtain the local task information table according to the local historical task information table and the target task list;

[0125] If the local history task information table does not exist, the local task information table is established according to the target task list and the local code base address.

[0126] The code syntax checking system provided in the application can reasonably construct a local task information table through configuration information corresponding to a to-be-checked item and a local history task information table, so that a corresponding script can be selected according to the local task information table in the future, and a corresponding syntax checking result can be obtained through a task system, thereby improving the efficiency of code syntax checking and reducing time cost.

[0127] In some optional implementation manners of the embodiment, the first determining module 303 is further configured to:

[0128] The target task list is compared with the local history task information table to determine an added task list and a deleted task list;

[0129] The target task list is updated according to the added task list and the deleted task list to obtain an updated task list;

[0130] The local task information table is established according to the updated task list and the local code base address.

[0131] The code syntax checking system provided in the application can reasonably construct a local task information table through a local history task information table and a target task list when the local history task information table exists, so that a corresponding script can be selected according to the local task information table in the future, and a corresponding syntax checking result can be obtained through a task system, thereby improving the efficiency of code syntax checking and reducing time cost.

[0132] In some optional implementation manners of the embodiment, the code syntax checking system 300 is further configured to:

[0133] If the local history task information table exists, the local history task information table is updated according to the local task information table to obtain an updated local history task information table;

[0134] If the local history task information table does not exist, the local history task information table is generated according to the local task information table.

[0135] The code syntax checking system provided in the application can reasonably update a local history task information table, so that repeated checking can be avoided when code syntax checking is performed in the future, thereby improving the efficiency of code syntax checking, reducing time cost, and leaving sufficient fault repair time.

[0136] In some optional implementation manners of the embodiment, the second determining module 304 is further configured to:

[0137] According to the task information corresponding to the local task information table, a corresponding script in the local code library is retrieved as the target script;

[0138] According to the merging check rule, the target script is processed to obtain the syntax check script, and the syntax check script can run an Explain function in SQL.

[0139] The code syntax check system provided in the application determines the syntax check script reasonably through a local task information table, so that code syntax check can be performed without running all scripts and tasks in a production environment, the check efficiency is improved, and the time cost is reduced.

[0140] In some optional implementation manners of the embodiment, the generating module 305 is further configured to:

[0141] The syntax check script is submitted to the task system as a task to be executed for execution;

[0142] The execution process is detected at a regular time, error information generated in the execution process is counted, and a completion progress is determined;

[0143] When the execution process is completed, the error information is taken as the execution result, and the syntax check report is generated according to the execution result.

[0144] The code syntax check system provided in the application, after reasonably determining the syntax check script, obtains the corresponding syntax check result through a task system, so that code syntax check can be performed without running all scripts and tasks in a production environment, the check efficiency is improved, the time cost is reduced, and sufficient fault repair time is reserved.

[0145] In some optional implementation manners of the embodiment, the code syntax check system 300 is further configured to:

[0146] A configuration instruction carrying a preset parameter is received, and the preset parameter is configured to obtain the project to be checked.

[0147] The code syntax check system provided in the application reasonably configures the project to be checked, so that subsequent code syntax check can be performed without running all scripts and tasks in a production environment according to the corresponding configuration information of the project to be checked, the check efficiency is improved, the time cost is reduced, and sufficient fault repair time is reserved.

[0148] To solve the above technical problems, the application embodiment further provides a computer device. For details, please refer to Figure 4 , Figure 4A basic structure block diagram of a computer device for the embodiment is shown in FIG. 1.

[0149] The computer device 4 includes a memory 41, a processor 42, and a network interface 43, which are communicatively connected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure, but it should be understood that not all of the shown components are required to be implemented, and more or fewer components can be alternatively implemented. Among them, those skilled in the art can understand that the computer device herein is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0150] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The computer device can interact with a user through a keyboard, a mouse, a remote controller, a touchpad, a voice control device, or the like.

[0151] The memory 41 includes at least one type of readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, or the like. In some embodiments, the memory 41 can 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 can 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, or the like. Of course, the memory 41 can also include both the internal storage unit and the external storage device of the computer device 4. In the embodiment, the memory 41 is generally used to store an operating system and various application software installed in the computer device 4, such as computer readable instructions of the code syntax checking method, etc. In addition, the memory 41 can also be used to temporarily store various data that have been output or will be output.

[0152] The processor 42 may, in some embodiments, be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 42 is generally used to control the overall operation of the computer device 4. In the present embodiment, the processor 42 is configured to execute computer-readable instructions stored in the memory 41 or to process data, such as computer-readable instructions for executing the code syntax checking method.

[0153] The network interface 43 may include a wireless network interface or a wired network interface, and is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0154] The computer device provided in the present application can automatically capture and select corresponding scripts according to syntax checking requirements, and obtain corresponding syntax checking results through a task system, so that code syntax checking can be performed without running all scripts and tasks in a full amount in a production environment, thereby improving the checking efficiency, reducing the time cost, and leaving sufficient fault repair time.

[0155] The present application also provides another embodiment, i.e., a computer readable storage medium storing computer readable instructions, which can be executed by at least one processor to enable the at least one processor to perform the steps of the code syntax checking method as described above.

[0156] The computer readable storage medium provided in the present application can automatically capture and select corresponding scripts according to syntax checking requirements, and obtain corresponding syntax checking results through a task system, so that code syntax checking can be performed without running all scripts and tasks in a full amount in a production environment, thereby improving the checking efficiency, reducing the time cost, and leaving sufficient fault repair time.

[0157] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software and a general hardware platform, and of course, they can also be implemented by hardware, but in many cases, the former is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a plurality of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device) to perform the methods described in the various embodiments of the present application.

[0158] Obviously, the above-described embodiments are only some embodiments but not all the embodiments of the present application, the preferred embodiments of the present application are shown in the drawings, but do not limit the patent scope of the present application. The present application can be implemented in many different forms, and conversely, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent replacements to some technical features therein. Any equivalent structure made by using the content of the specification and drawings, directly or indirectly applied to other related technical fields, is also within the patent protection scope of the present application.

Claims

1. A code syntax checking method, characterized by, The method comprises the following steps: Obtaining configuration information corresponding to the to-be-checked project, the configuration information comprising a local code library address, a remote code library latest branch, task settings, and a merging checking rule; According to the local code library address, all scripts of the remote code library latest branch are grabbed to the local code library; According to the task system and the task settings, a local task information table is determined; According to the local task information table, a target script is determined in the local code library, and a syntax checking script is obtained according to the target script and the merging checking rule; The syntax checking script is executed through the task system to obtain an execution result, and a syntax checking report corresponding to the to-be-checked project is generated according to the execution result; The task settings comprise task module information and task limitation rules, and the step of determining the local task information table according to the task system and the task settings specifically comprises: According to the task module information, a task list of the corresponding module is extracted from the task system; According to the task limitation rules, the task list is screened to obtain a target task list; It is determined whether there is a local historical task information table; If the local historical task information table exists, the local task information table is obtained 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 established according to the target task list and the local code library address; 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 specifically comprises: The target task list is compared with the local historical task information table to determine an added task list and a deleted task list; The target task list is updated according to the added task list and the deleted task list to obtain an updated task list; The local task information table is established according to the updated task list and the local code library address; The step of determining the target script in the local code library according to the local task information table and obtaining the syntax checking script according to the target script and the merging checking rule specifically comprises: According to the task information corresponding to the local task information table, a corresponding script in the local code library is searched as the target script; The target script is processed according to the merging checking rule to obtain the syntax checking script, and the syntax checking script can run an Explain function in SQL.

2. The code syntax checking method of claim 1, wherein, After the step of determining the local task information table according to the task system and the task settings, the method further comprises: If the local historical task information table exists, the local historical task information table is updated according to the local task information table to obtain an updated local historical task information table; If the local historical task information table does not exist, the local historical task information table is generated according to the local task information table.

3. The code syntax checking method of claim 1, wherein, The step of executing the syntax checking script through the task system to obtain an execution result, and generating a syntax checking report corresponding to the to-be-checked item according to the execution result, specifically comprises: submitting the syntax checking script as a to-be-executed task to the task system for execution; detecting the execution process at a time, counting error information generated in the execution process, and determining a completion progress; when the execution process is completed, taking the error information as the execution result, and generating the syntax checking report according to the execution result.

4. The code syntax checking method according to any one of claims 1 to 3, characterized in that, Before the step of obtaining configuration information corresponding to the to-be-checked item, the configuration information including a local code library address, a remote code library latest branch, task settings, and merging checking rules, further comprises: receiving a configuration instruction carrying preset parameters, configuring according to the preset parameters to obtain the to-be-checked item.

5. A code syntax checking system, characterized by, The code syntax checking system implements the steps of the code syntax checking method according to any one of claims 1 to 4, and the code syntax checking system comprises: an acquisition module configured to acquire configuration information corresponding to a to-be-checked item, the configuration information including a local code library address, a remote code library latest branch, task settings, and merging checking rules; a grabbing module configured to grab all scripts of the remote code library latest branch to the local code library according to the local code library address; a first determination module configured to determine a local task information table according to a task system and the task settings; a second determination module configured to determine a target script in the local code library according to the local task information table, and obtain a syntax checking script according to the target script and the merging checking rules; a generation module configured to execute the syntax checking script through the task system to obtain an execution result, and generate a syntax checking report corresponding to the to-be-checked item according to the execution result.

6. A computer device, comprising: comprises a memory and a processor, the memory stores computer readable instructions, and the processor implements the steps of the code syntax checking method according to any one of claims 1 to 4 when executing the computer readable instructions.

7. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by the processor to implement the steps of the code syntax checking method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • RTL code management method, device and equipment and computer readable storage medium

    CN111427582A

  • Branch code merging method and device, equipment and storage medium

    CN115167822A