CN116185853A - Code verification method and device - Google Patents

Code verification method and device Download PDF

Info

Publication number
CN116185853A
CN116185853A CN202310152968.5A CN202310152968A CN116185853A CN 116185853 A CN116185853 A CN 116185853A CN 202310152968 A CN202310152968 A CN 202310152968A CN 116185853 A CN116185853 A CN 116185853A
Authority
CN
China
Prior art keywords
code
tag
verification
code segment
configuration file
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
CN202310152968.5A
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.)
Bank of China Financial Technology Co Ltd
Original Assignee
Bank of China Financial Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Financial Technology Co Ltd filed Critical Bank of China Financial Technology Co Ltd
Priority to CN202310152968.5A priority Critical patent/CN116185853A/en
Publication of CN116185853A publication Critical patent/CN116185853A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3608Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a code verification method and a code verification device, wherein the method comprises the following steps: acquiring a change code in a front-end code editing interface, and determining a tag code segment to which the change code belongs based on the position of the change code; determining a verification configuration file of the tag code segment based on the tag class of the tag code segment; and verifying the tag code fragments based on the verification configuration file, and determining the verification result of the tag code fragments. According to the code verification method and device, the tag code fragments are verified through the verification configuration files corresponding to the tag categories of the tag code fragments, so that an automatic verification process of the tag code fragments is realized. Based on the interface design logic in the verification configuration file, the automatic verification process of the interface structure and the interface attribute corresponding to the front-end change code is realized, the code verification accuracy is improved, the workload is reduced, and the working efficiency of developers is improved.

Description

Code verification method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a code verification method and apparatus.
Background
Existing checking checks of front-end code have focused mainly on checking of code format or code syntax. The existing code verification process is mainly based on a front-end code verification tool or a code verification function of the front-end development tool, and is used for checking the code format or code grammar of the code in the development process. For example, code checking is performed based on the Eslin tool.
In the existing front-end code verification, only low-level inspection of a code format or a code grammar can be performed, a developer needs to run codes later, and the code is adjusted according to the interface display condition, so that the development efficiency of the developer is low.
Disclosure of Invention
The invention provides a code verification method and a code verification device, which are used for solving the technical problem that in the process of front-end code verification in the prior art, only low-level inspection of a code format or a code grammar can be performed, so that development efficiency of developers is low.
The invention provides a code verification method, which comprises the following steps:
acquiring a change code in a front-end code editing interface, and determining a tag code segment to which the change code belongs based on the position of the change code, wherein the tag code segment is a code segment formed by all codes corresponding to one tag;
determining a verification configuration file of the tag code segment based on the tag class of the tag code segment, wherein the verification configuration file is determined based on interface design logic corresponding to the tag class;
and verifying the tag code segment based on the verification configuration file, and determining a verification result of the tag code segment.
According to the code verification method provided by the invention, the tag code segment is verified based on the verification configuration file, and the method comprises the following steps:
determining an interface structure of the tag code segment and an interface attribute of the tag code segment;
checking the interface structure based on the interface structure parameters recorded in the checking configuration file;
and verifying the interface attribute based on the interface attribute parameter recorded in the verification configuration file.
According to the code verification method provided by the invention, based on the position of the change code, the tag code segment to which the change code belongs is determined, and the method comprises the following steps:
based on the position of the changed code, determining a closed tag identifier before and after the position, wherein the closed tag identifier is used for determining the starting position of the code in the tag code segment;
and determining the tag code segment to which the change code belongs based on the closed tag identification.
According to the code verification method provided by the invention, the determining the verification configuration file of the tag code segment based on the tag class of the tag code segment further comprises:
acquiring a parent-level tag code segment of the tag code segment under the condition that a verification configuration file corresponding to the tag code segment cannot be determined based on the tag code segment;
taking the parent-level tag code segment as an updated tag code segment;
and determining a verification configuration file of the label code segment according to the label category of the updated label code segment.
According to the code verification method provided by the invention, when the verification result is that the verification is not passed, the method further comprises the following steps:
generating verification prompt information based on the verification result;
and sending the verification prompt information to the front-end code editing interface.
The code verification method provided by the invention further comprises the following steps:
receiving verification logic change information of the verification configuration file;
and changing interface design logic in the verification configuration file based on the verification logic change information.
The invention also provides a code verification device, which comprises:
the tag code determining module is used for acquiring the change code in the front-end code editing interface and determining a tag code segment to which the change code belongs based on the position of the change code, wherein the tag code segment is a code segment formed by all codes corresponding to one tag;
the verification configuration acquisition module is used for determining a verification configuration file of the tag code fragment based on the tag class of the tag code fragment, wherein the verification configuration file is determined based on interface design logic corresponding to the tag class;
and the verification module is used for verifying the tag code fragments based on the verification configuration file and determining the verification result of the tag code fragments.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the code verification method according to any one of the above when executing the computer program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a code verification method as described in any of the above.
The invention also provides a computer program product comprising a computer program which when executed by a processor implements a code verification method as described in any one of the above.
According to the code verification method and device, the label code segment to which the change code belongs is determined through the position of the change code, and the interface design logic of the label code segment is verified based on the verification configuration file corresponding to the label type of the label code segment, so that the automatic verification process of the label code segment to which the change code belongs is realized. Based on the interface design logic in the verification configuration file, the automatic verification process of the interface structure and the interface attribute corresponding to the front-end change code is realized, the code verification accuracy is improved, the subsequent verification workload of the developer is reduced, and the working efficiency of the developer is improved.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are some embodiments of the invention and that other drawings can be obtained from them without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a code verification method provided by the invention;
FIG. 2 is a flow chart diagram of a code verification method provided by the invention;
FIG. 3 is a schematic diagram of a device structure applying the code verification method provided by the invention;
FIG. 4 is a schematic diagram of a code verification device according to the present invention;
fig. 5 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 is a schematic flow chart of a code verification method provided by the invention. Referring to fig. 1, the code verification method provided by the present invention may include:
step 110, acquiring a change code in a front-end code editing interface, and determining a tag code segment to which the change code belongs based on the position of the change code, wherein the tag code segment is a code segment formed by all codes corresponding to one tag;
step 120, determining a verification configuration file of the tag code segment based on the tag class of the tag code segment, wherein the verification configuration file is determined based on interface design logic corresponding to the tag class;
and step 130, checking the tag code segment based on the checking configuration file, and determining a checking result of the tag code segment.
The execution subject of the code verification method provided by the invention can be an electronic device, a component in the electronic device, an integrated circuit, or a chip. The electronic device may be a mobile electronic device or a non-mobile electronic device. By way of example, the mobile electronic device may be a cell phone, tablet, notebook, palmtop, ultra-mobile personal computer (ultra-mobile personal computer, UMPC), netbook or personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device may be a server, network attached storage (Network Attached Storage, NAS) or personal computer (personal computer, PC), etc., the invention is not particularly limited.
The technical scheme of the invention is described in detail below by taking a computer to execute the code verification method provided by the invention as an example.
In step 110, when the front-end code editing interface is subjected to code editing, a change code in the front-end code editing interface is acquired, and a tag code segment described by the change code is determined based on the position of the change code. The tag code segment is a code segment formed by all codes corresponding to one tag.
The front-end code editing interface is an interface for editing a code in front-end development, and may be an interface for editing a code by a code editing tool such as Vscode or notepad++.
And when the front-end code editing interface is subjected to code editing, acquiring a change code in the front-end code editing interface. Wherein the change code includes an newly added code or a modified code.
In the process of developing codes, a developer generally relates to the new development of codes corresponding to tasks, and the developed codes are modified in the process of developing or after the development is completed. The newly added code refers to the newly written code in the development process. Modifying code refers to modifying code that has been written in advance.
It can be understood that in the process of writing a new label by a developer, when the code of one label is written to half, the code cannot be obtained for verification due to incomplete logic. Therefore, after the code writing of the tag is completed, the tag code fragments under the tag are acquired and used for the subsequent verification process.
And determining the tag code fragments of the change codes based on the positions of the change codes. The position of the changed code is that when a developer adds or modifies the code, the current added or modified code is positioned in the whole front-end code editing interface, and can be acquired based on the cursor of the edited code.
It will be appreciated that the front-end code is typically composed of individual complete tag fragments. For example, typeset labels include: title label, paragraph label, line feed label, horizontal line label; text formatting tags, media tags, link tags, form tags, and the like. The tag code segment is a code segment composed of all codes corresponding to one tag. Therefore, the tag code fragment to which the change code belongs can be determined based on the position of the change code in the front-end code editing interface.
In step 120, after the change code is obtained, a verification configuration file of the tag code segment is determined based on the tag class of the tag code segment to which the change code belongs. Wherein the tag class of the tag code segment corresponds to the verification configuration file.
The verification profile is determined based on interface design logic corresponding to the tag class. The interface design logic is the requirement for interface design in the front-end development design process. For example: the interface design logic determined for the front end drop down list tab select may be:
{
select:{
filter:true,
filterItem:3,
clearable:true
},
form:{
horizontalItem:3
}
}
two pieces of interface design logic are added in the design logic, and the element (component) for which select represents is a drop-down frame component, and the specific configuration is in brackets. filter: true, filter item:3 indicates that select component must have a filter attribute if the drop down options are greater than 3; clear: true indicates that a clear operation button is necessary. form indicates that for the form component, the horizontal sub-elements cannot exceed 3 in the form element, and the form component needs to be displayed in a line mode after the horizontal sub-elements exceed 3.
And writing code rules corresponding to the interface design logic, generating a corresponding verification configuration file, and verifying codes in the tag code fragments based on the interface design logic in the verification configuration file in the subsequent process of verifying the tag code fragments. The interface design logic can be set according to the requirements of the current project, the writing habit of the developer or the requirements of the aesthetic property of the interface.
Alternatively, the determination of the verification configuration file may be implemented based on a manner in which the verification library is built in advance. And associating each label category with a corresponding check configuration file based on all label categories in advance, so as to construct a check library. And after the label category of the label code is obtained, screening the corresponding verification configuration file from the verification library based on the label category.
In step 130, after determining the verification configuration file corresponding to the tag class, the logic in the verification configuration file is parsed to obtain the interface design logic corresponding to the tag class, so as to perform code verification on the tag code segment, and determine the code verification result of the tag code segment.
After the verification configuration file is determined, based on the interface design logic in the verification configuration file, the interface design logic is compared with the corresponding interface design logic in the tag code segment, so that the tag code segment is verified.
It can be appreciated that the interface design logic in the verification configuration file is interface design logic for the tag class corresponding to the tag code segment. The interface design logic written by the current developer or modified in the tag code segment is compared with the corresponding interface design logic in the tag code segment, so that the verification process of the code in the tag code segment can be realized. Compared with code format and grammar checking in the code writing process, the method can verify the structure, the attribute and the like of the code fragments according to the requirements, and improves the code writing efficiency and the user experience of developers.
Alternatively, when the change code is a code for modifying a code written in advance, only the change code may be obtained, and the verification logic corresponding to the change code may be obtained from the verification configuration file, so as to independently verify the change code.
According to the code verification method provided by the embodiment of the invention, the label code segment to which the change code belongs is determined by changing the position of the code, and the interface design logic of the label code segment is verified based on the verification configuration file corresponding to the label type of the label code segment, so that the automatic verification process of the label code segment to which the change code belongs is realized. Based on the interface design logic in the verification configuration file, the automatic verification process of the interface structure and the interface attribute corresponding to the front-end change code is realized, the code verification accuracy is improved, the subsequent verification workload of the developer is reduced, and the working efficiency of the developer is improved.
In one embodiment, verifying the tag code segment based on the verification profile includes: determining an interface structure of the tag code segment and an interface attribute of the tag code segment; checking the interface structure based on the interface structure parameters recorded in the checking configuration file; and verifying the interface attribute based on the interface attribute parameter recorded in the verification configuration file.
In the process of verifying the tag code fragments, the tag code fragments are analyzed. Based on the code content of the tag code segment, an interface structure of the tag code segment and an interface attribute of the tag code segment are determined. The interface structure refers to the design structure requirement of the interface in the front-end interface. The interface attribute is a setting attribute of each element in the front-end interface.
The interface structure parameters and interface attribute parameters of the defined tag code fragments are recorded in the verification configuration file. For example, the interface structure parameters corresponding to the verification configuration file and the interface attribute parameters corresponding to the verification configuration file may be defined as follows: for the drop-down list tab select in the front end, the select component must have a filter attribute if the drop-down options are greater than 3.
According to the code verification method provided by the embodiment of the invention, the label code fragments are verified by verifying the interface structure parameters and the interface attribute parameters of the label code fragments defined in the configuration file, so that the verification process of the label code based on the verification configuration file is realized.
In one embodiment, determining the tag code fragment to which the change code belongs based on the location of the change code includes: based on the position of the changed code, determining a closed tag identifier before and after the position, wherein the closed tag identifier is used for determining the starting position of the code in the tag code segment; and determining the tag code segment to which the change code belongs based on the closed tag identification.
Alternatively, the code change is performed at the front-end code editing interface pair. Since the change code is changed when the developer edits, the position of the change code can be acquired based on the cursor of the edit code.
For the front-end code, one tag code segment can be based on the front and back closed tag identifications, and the code segment corresponding to the tag is contained. The closure tag identification is an identification used to determine the starting position of the code in the tag code fragment. The closing tag identification can be a curly brace, and the corresponding tag code is contained in the curly brace which is arranged at the front and the back of the tag code segment.
After the position of the change code is determined, two corresponding closed label identifications before and after the change code are determined based on the position of the change code, so that the extraction of the label code fragments is realized.
It will be appreciated that during the process of editing the code by the developer, only one closure tag identity may be identified in the event that the tag is contained by two closure tag identities, as the code of the tag is not edited. After the developer completes editing the label, identifies two closed label identifications, and determines the code segment corresponding to the label, the label code segment is extracted.
According to the code verification method provided by the embodiment of the invention, the closed label identification before and after the code position is changed is determined through determining the code position, so that the extraction of the label code fragments of the changed code is realized, and a foundation is provided for the verification process of the subsequent code.
In one embodiment, the determining the verification profile of the tag code segment based on the tag class of the tag code segment further comprises: acquiring a parent-level tag code segment of the tag code segment under the condition that a verification configuration file corresponding to the tag code segment cannot be determined based on the tag code segment; taking the parent-level tag code segment as an updated tag code segment; and determining a verification configuration file of the label code segment according to the label category of the updated label code segment.
For the change code in the front-end code editing interface, there may be a large tag code that contains multiple small tag codes. The defined verification configuration file is for the case of a large tag code, that is, based on the acquired tag code segment, the verification configuration file corresponding to the tag code segment cannot be determined.
Under the condition that a verification configuration file corresponding to the tag code segment cannot be determined, acquiring a parent tag code segment of the tag code segment, and taking the acquired parent tag code segment as an updated tag code segment for a subsequent code verification process.
According to the code verification method provided by the embodiment of the invention, under the condition that the verification configuration file corresponding to the tag code segment cannot be determined, the parent tag code segment of the tag code segment is obtained and used as the updated tag code segment for the subsequent code verification process, so that the flexibility of code verification is improved.
In one embodiment, in the case that the verification result is that the verification fails, the method further includes: generating verification prompt information based on the verification result; and sending the verification prompt information to the front-end code editing interface.
The verification result of the tag code fragment comprises a specific cause of failed verification, a specific code of failed verification and logic corresponding to failed verification besides failed verification. The remote prompt information of the tag code segment can be generated based on the specific code which is not checked for the specific reason that the check is not passed and the logic corresponding to the check is not passed, and the check prompt information is sent to the front-end code editing interface.
It can be understood that in the process of developing or modifying the code, the front-end developer can grasp the accuracy of code development or code writing in real time based on the verification prompt information of real-time prompt, thereby improving the user experience of the developer.
According to the code verification method provided by the embodiment of the invention, the verification prompt information is generated by determining that the verification result is that the verification is not passed, and the verification prompt information is sent to the front-end code editing interface, so that the accuracy of code development or code writing can be mastered in real time based on the verification prompt information prompted in real time in the process of developing or modifying the code by a front-end developer, and the user experience of the developer is improved.
In one embodiment, check logic change information of the check configuration file is received; and changing interface design logic in the verification configuration file based on the verification logic change information.
After determining the verification configuration file corresponding to the tag class of the tag code segment, there may be a case where the interface design logic in the verification configuration file needs to be changed. And receiving verification logic change information of a developer aiming at the verification configuration file, and updating interface design logic in the verification configuration file based on the verification logic change information.
Optionally, the interface design logic in the check configuration file can be updated after the check logic change information of the check logic is received based on the visual interface mode, so that the update process of the check configuration file is realized.
According to the code verification method provided by the embodiment of the invention, after the verification configuration file corresponding to the label category of the label code segment is determined, the verification logic change information aiming at the verification configuration file is received, and the interface design logic in the verification configuration file is updated based on the verification logic change information, so that the updating process of the verification configuration file is realized.
The following describes the technical scheme provided by the present invention by taking a flow chart diagram of a code verification method provided by the present invention as an example in fig. 2:
step 210, configuring verification configuration files corresponding to the tag categories based on the visual configuration interface.
Based on the visual configuration interface, configuring a check configuration file corresponding to each tag category, wherein each configured tag category corresponds to one check configuration file, and the generated check configuration file has the following format:
{
select:{
filter:true,
filterItem:3,
clearable:true
},
form:{
horizontalItem:3
}
}
two pieces of interface design logic are added in the verification configuration file, and the element (component) for which select represents is a drop-down frame component, and the specific configuration is in brackets. filter: true, filter item:3 indicates that select component must have a filter attribute if the drop down options are greater than 3; clear: true indicates that a clear operation button is necessary. form indicates that for the form component, the horizontal sub-elements cannot exceed 3 in the form element, and the form component needs to be displayed in a line mode after the horizontal sub-elements exceed 3.
Step 220, downloading the verification configuration file to the local based on the code checking plug-in the front end, analyzing the verification configuration file, and obtaining configuration content corresponding to the verification configuration file.
Step 230, when the code change is monitored, the number of code lines where the current cursor is located is obtained, a complete closed label identification is found through the html label of the current line, the complete label and the subelements thereof are considered to be changed code fragments, and all the found information is recorded.
Lookup example of complete code fragment:
first row < select >;
the second line < option value=A > A </option >;
third line < option value=B > B </option >;
fourth line < option value=C > C </option >;
fifth line select;
modified code:
first row < select >;
the second line < option value=A > A </option >;
third line < option value=B > B </option >;
fourth line < option value=C > C </option >;
fifth line < option value=d > D </option >;
sixth line select;
when detecting that the < option value=D > D option is inserted in the fifth line position of the code, the current corresponding complete tag code segment is all contents of the fifth line, and the current content is recorded as a change code, and the current content is an option tag and belongs to a select sub-tag, so that the whole select tag block needs to be found in the current line (5 th line) position and in the descending direction, and all codes of 1-6 lines can be recorded and checked.
Step 240, in step 230, a change code of the tag code segment is recorded, based on each segment of the tag code segment, checking is performed in turn, a corresponding rule is found according to a tag type (select/form, etc.) of each segment, whether the rule search code contains interface design logic corresponding to the check configuration file is determined according to the rule search code, and a conclusion whether the rule meets the requirement is obtained according to the check result. The code segment < option value=D > D </option > is not provided with a corresponding rule, and is qualified by default, and the selection segment is not in accordance with the design principle because the sub options (option) are beyond three but have no filter attribute, so that the correction reminding is carried out at the initial position of the first line of selection label.
Step 250, when the sequence of the fragments in the tag code fragments is checked to determine whether the check result meets the requirement, if the code fragments in the front are checked to determine that the check result does not meet the requirement, a warning is sent, the subsequent check is abandoned, and the check is performed again when the change is required.
The technical scheme provided by the invention is described below by taking a schematic device structure diagram of a code verification method provided by the invention as an example:
as shown in fig. 3, the apparatus may include:
the code obtaining module 310 is configured to monitor code changes in the front-end code editing interface, obtain, in real time, a tag code segment to which the change code belongs, and a location of the change code;
the code analysis module 320 analyzes the structure, the attribute and the like of the obtained tag code fragment, and obtains an information set of the tag code fragment;
the design principle analysis module 330 determines a verification configuration file of the tag code segment based on the tag class of the tag code segment, and verifies the information set of the tag code segment based on the verification configuration file;
the code checking module 340 determines the verification result of the changed code, and performs correction warning in accordance with the requirement.
Fig. 4 is a schematic structural diagram of a code verification device provided by the present invention, as shown in fig. 4, the device includes:
the tag code determining module 410 is configured to obtain a change code in the front end code editing interface, and determine a tag code segment to which the change code belongs based on a position of the change code, where the tag code segment is a code segment formed by all codes corresponding to one tag;
a verification configuration obtaining module 420, configured to determine a verification configuration file of the tag code segment based on a tag class of the tag code segment, where the verification configuration file is determined based on interface design logic corresponding to the tag class;
and the verification module 430 is configured to verify the tag code segment based on the verification configuration file, and determine a verification result of the tag code segment.
According to the code verification device provided by the embodiment of the invention, the label code segment to which the change code belongs is determined by changing the position of the code, and the interface design logic of the label code segment is verified based on the verification configuration file corresponding to the label type of the label code segment, so that the automatic verification process of the label code segment to which the change code belongs is realized. Based on the interface design logic in the verification configuration file, the automatic verification process of the interface structure and the interface attribute corresponding to the front-end change code is realized, the code verification accuracy is improved, the subsequent verification workload of the developer is reduced, and the working efficiency of the developer is improved.
In one embodiment, the verification module 430 is specifically configured to:
and verifying the tag code segment based on the verification configuration file, including:
determining an interface structure of the tag code segment and an interface attribute of the tag code segment;
checking the interface structure based on the interface structure parameters recorded in the checking configuration file;
and verifying the interface attribute based on the interface attribute parameter recorded in the verification configuration file.
In one embodiment, the tag code determination module 410 is specifically configured to:
determining, based on the location of the change code, a tag code fragment to which the change code belongs, including:
based on the position of the changed code, determining a closed tag identifier before and after the position, wherein the closed tag identifier is used for determining the starting position of the code in the tag code segment;
and determining the tag code segment to which the change code belongs based on the closed tag identification.
In one embodiment, the tag code determination module 410 is further specifically configured to:
the determining the verification configuration file of the tag code segment based on the tag class of the tag code segment further comprises:
acquiring a parent-level tag code segment of the tag code segment under the condition that a verification configuration file corresponding to the tag code segment cannot be determined based on the tag code segment;
taking the parent-level tag code segment as an updated tag code segment;
and determining a verification configuration file of the label code segment according to the label category of the updated label code segment.
In one embodiment, the verification module 430 is further specifically configured to:
in the case that the verification result is that the verification is not passed, the method further comprises:
generating verification prompt information based on the verification result;
and sending the verification prompt information to the front-end code editing interface.
In one embodiment, the verification configuration acquisition module 420 is specifically configured to:
receiving verification logic change information of the verification configuration file;
and changing interface design logic in the verification configuration file based on the verification logic change information.
Fig. 5 illustrates a physical schematic diagram of an electronic device, as shown in fig. 5, which may include: processor 510, communication interface (Communications Interface) 520, memory 530, and communication bus 540, wherein processor 510, communication interface 520, memory 530 complete communication with each other through communication bus 540. Processor 510 may invoke logic instructions in memory 530 to perform a code verification method comprising:
acquiring a change code in a front-end code editing interface, and determining a tag code segment to which the change code belongs based on the position of the change code, wherein the tag code segment is a code segment formed by all codes corresponding to one tag;
determining a verification configuration file of the tag code segment based on the tag class of the tag code segment, wherein the verification configuration file is determined based on interface design logic corresponding to the tag class;
and verifying the tag code segment based on the verification configuration file, and determining a verification result of the tag code segment.
Further, the logic instructions in the memory 530 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform a code verification method provided by the above methods, the method comprising:
acquiring a change code in a front-end code editing interface, and determining a tag code segment to which the change code belongs based on the position of the change code, wherein the tag code segment is a code segment formed by all codes corresponding to one tag;
determining a verification configuration file of the tag code segment based on the tag class of the tag code segment, wherein the verification configuration file is determined based on interface design logic corresponding to the tag class;
and verifying the tag code segment based on the verification configuration file, and determining a verification result of the tag code segment.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the above provided code verification methods, the method comprising:
acquiring a change code in a front-end code editing interface, and determining a tag code segment to which the change code belongs based on the position of the change code, wherein the tag code segment is a code segment formed by all codes corresponding to one tag;
determining a verification configuration file of the tag code segment based on the tag class of the tag code segment, wherein the verification configuration file is determined based on interface design logic corresponding to the tag class;
and verifying the tag code segment based on the verification configuration file, and determining a verification result of the tag code segment.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A code verification method, comprising:
acquiring a change code in a front-end code editing interface, and determining a tag code segment to which the change code belongs based on the position of the change code, wherein the tag code segment is a code segment formed by all codes corresponding to one tag;
determining a verification configuration file of the tag code segment based on the tag class of the tag code segment, wherein the verification configuration file is determined based on interface design logic corresponding to the tag class;
and verifying the tag code segment based on the verification configuration file, and determining a verification result of the tag code segment.
2. The code verification method according to claim 1, wherein the verifying the tag code fragments based on the verification profile comprises:
determining an interface structure of the tag code segment and an interface attribute of the tag code segment;
checking the interface structure based on the interface structure parameters recorded in the checking configuration file;
and verifying the interface attribute based on the interface attribute parameter recorded in the verification configuration file.
3. The code verification method according to claim 1, wherein the determining, based on the location of the change code, a tag code segment to which the change code belongs includes:
based on the position of the changed code, determining a closed tag identifier before and after the position, wherein the closed tag identifier is used for determining the starting position of the code in the tag code segment;
and determining the tag code segment to which the change code belongs based on the closed tag identification.
4. A code verification method according to any one of claims 1 to 3, wherein,
the determining the verification configuration file of the tag code segment based on the tag class of the tag code segment further comprises:
acquiring a parent-level tag code segment of the tag code segment under the condition that a verification configuration file corresponding to the tag code segment cannot be determined based on the tag code segment;
taking the parent-level tag code segment as an updated tag code segment;
and determining a verification configuration file of the label code segment according to the label category of the updated label code segment.
5. The code verification method according to claim 1, wherein in case the verification result is that the verification is not passed, the method further comprises:
generating verification prompt information based on the verification result;
and sending the verification prompt information to the front-end code editing interface.
6. The code verification method according to claim 1, further comprising:
receiving verification logic change information of the verification configuration file;
and changing interface design logic in the verification configuration file based on the verification logic change information.
7. A code verification apparatus, comprising:
the tag code determining module is used for acquiring the change code in the front-end code editing interface and determining a tag code segment to which the change code belongs based on the position of the change code, wherein the tag code segment is a code segment formed by all codes corresponding to one tag;
the verification configuration acquisition module is used for determining a verification configuration file of the tag code fragment based on the tag class of the tag code fragment, wherein the verification configuration file is determined based on interface design logic corresponding to the tag class;
and the verification module is used for verifying the tag code fragments based on the verification configuration file and determining the verification result of the tag code fragments.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the code verification method according to any one of claims 1 to 6 when executing the computer program.
9. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the code verification method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program which, when executed by a processor, implements the code verification method of any one of claims 1 to 6.
CN202310152968.5A 2023-02-22 2023-02-22 Code verification method and device Pending CN116185853A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310152968.5A CN116185853A (en) 2023-02-22 2023-02-22 Code verification method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310152968.5A CN116185853A (en) 2023-02-22 2023-02-22 Code verification method and device

Publications (1)

Publication Number Publication Date
CN116185853A true CN116185853A (en) 2023-05-30

Family

ID=86434224

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310152968.5A Pending CN116185853A (en) 2023-02-22 2023-02-22 Code verification method and device

Country Status (1)

Country Link
CN (1) CN116185853A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116483377A (en) * 2023-06-15 2023-07-25 太平金融科技服务(上海)有限公司深圳分公司 Code detection method and device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116483377A (en) * 2023-06-15 2023-07-25 太平金融科技服务(上海)有限公司深圳分公司 Code detection method and device, electronic equipment and storage medium
CN116483377B (en) * 2023-06-15 2024-03-01 太平金融科技服务(上海)有限公司深圳分公司 Code detection method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN106844217B (en) Method and device for embedding point of applied control and readable storage medium
CN106844413B (en) Method and device for extracting entity relationship
US8869111B2 (en) Method and system for generating test cases for a software application
WO2020219182A1 (en) Code completion for languages with hierarchical structures
US20100180256A1 (en) Method and system for generating functional test cases
EP4322009A1 (en) Test case generation method, apparatus and device
CN111552633A (en) Interface abnormal call testing method and device, computer equipment and storage medium
CN104391934A (en) Data calibration method and device
US10049032B2 (en) Methods for generating a negative test input data and devices thereof
CN113448862B (en) Software version testing method and device and computer equipment
WO2023278052A1 (en) Automated troubleshooter
CN112579466A (en) Test case generation method and device and computer readable storage medium
CN116185853A (en) Code verification method and device
CN109582670A (en) A kind of recommended method and relevant device of vehicle maintenance scheme
CN109284331A (en) Accreditation information acquisition method, terminal device and medium based on business datum resource
CN111859862B (en) Text data labeling method and device, storage medium and electronic device
CN104182416A (en) File downloading system and method
CN112988758A (en) Target object positioning method and device, electronic equipment and storage medium
CN110083493A (en) A kind of embedded system failure self-recovery method, terminal device and storage medium
CN113726610B (en) Routing protocol-based UI (user interface) automatic test method, device, equipment and medium
CN114297057A (en) Design and use method of automatic test case
Maiti Capturing, Eliciting, and Prioritizing (CEP) Non-Functional Requirements Metadata during the Early Stages of Agile Software Development
CN111045836A (en) Search method, search device, electronic equipment and computer-readable storage medium
CN112800185B (en) Method and device for generating and matching text of interface node in mobile terminal
CN110362822B (en) Text labeling method, device, computer equipment and storage medium for model training

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