Code verification method and device, computer device and storage medium

By displaying the interface code on the screen and performing preset style validation, a validation report is generated, which solves the problem that traditional code validation methods cannot effectively reduce the error rate and achieves higher code compliance and readability.

CN113495835BActive Publication Date: 2025-10-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010264603.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-07
Publication Date
2025-10-21
Estimated Expiration
2040-05-07

AI Technical Summary

Technical Problem

Traditional code validation methods can only check for syntax errors and cannot effectively reduce the error rate of submitted code, resulting in a high error rate.

Method used

By displaying the interface code on the interface and responding to trigger operations to perform code style verification according to preset style verification rules, a verification report is generated, including uniform resource locators, parameters, paging and version verification, to improve the code's compliance with writing standards.

Benefits of technology

It reduced the error rate of code submissions, decreased manual verification work, improved the accuracy of verification, made the code more consistent with the preset style, and improved the readability of the interface code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113495835B_ABST
    Figure CN113495835B_ABST
Patent Text Reader

Abstract

The application relates to a code checking method and device, computer equipment and a storage medium. The method comprises the following steps: displaying an interface code on an interface; in response to a triggering operation on the interface code, performing code style checking on the interface code according to a preset style checking rule to obtain a checking result; and displaying a checking report, wherein the checking report is generated according to the checking result. The method can reduce the error rate of submitted codes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a code verification method, apparatus, computer equipment, and storage medium. Background Art

[0002] When developers write code in computer languages, errors are inevitable. Developers compile the code, and the compiler will report syntax errors. Traditional code verification methods can detect syntax errors but fail to detect other code errors, resulting in a high error rate in submitted code. Summary of the Invention

[0003] Based on this, it is necessary to provide a code verification method, device, computer equipment and storage medium that can reduce the code error rate in response to the above technical problems.

[0004] A code verification method, comprising:

[0005] Display the interface code on the interface;

[0006] In response to a triggering operation on the interface code, performing a code style check on the interface code according to a preset style check rule to obtain a check result;

[0007] A verification report is displayed, where the verification report is generated based on the verification result.

[0008] A code verification device, comprising:

[0009] A first display module is used to display the interface code on the interface;

[0010] A verification module, configured to, in response to a triggering operation on the interface code, perform a code style verification on the interface code according to a preset style verification rule to obtain a verification result;

[0011] The second display module is used to display a verification report, where the verification report is generated based on the verification result.

[0012] In one embodiment, the verification module is used to perform at least one of uniform resource locator verification, parameter verification, page verification, and version verification on the interface code according to a preset style verification rule to obtain a verification result.

[0013] In one embodiment, the verification module is used to determine the uniform resource locator in the interface code; perform word segmentation processing on the uniform resource locator to obtain a target word; and verify the part of speech of the target word to obtain a resource locator verification result.

[0014] In one embodiment, the second display module is used to display a verification report, which is generated based on the resource locator verification result, wherein the verification report includes the first resource locator verification result, and the first resource locator verification result is an error message related to the part of speech not being a noun.

[0015] In one embodiment, the second display module is configured to display a verification report. The verification module is configured to determine an operation instruction corresponding to the uniform resource locator when the resource locator verification result is a second resource locator verification result, wherein the second resource locator verification result is an error message related to a part of speech containing a verb; and when the operation instruction is not a preset operation instruction, generate a verification report based on the second resource locator verification result, wherein the verification report includes the second resource locator verification result.

[0016] In one embodiment, a verification module is configured to obtain reference parameter identifiers and reference parameter descriptions in a database; detect target parameter identifiers and corresponding target parameter descriptions in an interface code; determine a first similarity between the target parameter identifier and each reference parameter identifier, and determine a second similarity between the target parameter description and each corresponding reference parameter description, thereby obtaining a parameter similarity verification result. A second display module is configured to display a verification report generated based on the parameter similarity verification result, wherein the verification report includes a first parameter similarity verification result, and the first parameter similarity verification result includes error information related to the first similarity and the corresponding second similarity both reaching a similarity threshold.

[0017] In one embodiment, a verification module is configured to detect a target parameter identifier in an interface code and verify the target parameter identifier against words in a dictionary to obtain a parameter word verification result. A second display module is configured to display a verification report generated based on the parameter word verification result, wherein the verification report includes a first parameter word verification result, which is error information related to a spelling error in the target parameter identifier.

[0018] In one embodiment, a verification module is configured to identify interface read-related instructions in the interface code; obtain a reference paging parameter identifier; and verify the interface read-related instructions based on the reference paging parameter identifier to obtain a paging verification result. A second display module is configured to display a verification report, which is generated based on the paging verification result. The verification report includes a first paging verification result, which is error information related to the fact that the interface read-related instructions do not contain the reference paging parameter identifier.

[0019] In one embodiment, the verification module is configured to obtain a historical version number and a target version number corresponding to the interface code; perform version verification on the target version number based on the historical version number to obtain a version number verification result; and the second display module is configured to display a verification report generated based on the version number verification result, wherein the verification report includes a first version number verification result, which is an error message related to a version number conflict.

[0020] In one embodiment, the code verification device further includes a review module. The review module is configured to, when the verification report does not contain error information, send the interface code to a target terminal where an account with review authority is located; receive a review result returned by the target terminal, wherein the review result is obtained after reviewing the interface code; and, when the review result is passed, generate an interface code file corresponding to the interface code.

[0021] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0022] Display the interface code on the interface;

[0023] In response to a triggering operation on the interface code, performing a code style check on the interface code according to a preset style check rule to obtain a check result;

[0024] A verification report is displayed, where the verification report is generated based on the verification result.

[0025] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0026] Display the interface code on the interface;

[0027] In response to a triggering operation on the interface code, performing a code style check on the interface code according to a preset style check rule to obtain a check result;

[0028] A verification report is displayed, where the verification report is generated based on the verification result.

[0029] The above-mentioned code verification method, device, computer equipment and storage medium display the interface code on the interface, and perform code style verification on the interface code according to the preset style verification rules in response to the triggering operation of the interface code, obtain the verification result, and display the verification report, wherein the verification report is generated based on the verification result, and can perform code style verification on the interface code, so that the code is more in line with the writing specifications, reduce the error rate of the submitted code, reduce the work of manual verification, improve the accuracy of verification, and make the code more in line with the preset code style. The interface code that conforms to the preset code style is easier to be called, and the readability of the interface code is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 1 is a flow chart of a code verification method according to an embodiment;

[0031] Figure 2 This is a schematic diagram of a merge request interface in one embodiment;

[0032] Figure 3 A schematic diagram of a verification report interface in one embodiment;

[0033] Figure 4 A flowchart of a procedure for verifying interface code in one embodiment;

[0034] Figure 5 1 is a schematic diagram of a process for performing uniform resource locator verification in one embodiment;

[0035] Figure 6 A schematic diagram of a process for performing parameter verification on interface code according to preset style verification rules in one embodiment;

[0036] Figure 7 A schematic diagram of an interface for initiating a review in one embodiment;

[0037] Figure 8 is a timing diagram of a code verification method in one embodiment;

[0038] Figure 9 A structural block diagram of a code verification device in one embodiment;

[0039] Figure 10 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0041] In one embodiment, Figure 1 As shown, it is a flow chart of the code verification method in one embodiment. This embodiment is illustrated by applying the method to a terminal. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and can be implemented through the interaction between the terminal and the server. The code verification method of the present application can be implemented through a code verification program. Similarly, the code verification program can be applied to a terminal, and can also be applied to a server, and can also be applied to a system including a terminal and a server, and can be implemented through the interaction between the terminal and the server. Among them, the terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server can be implemented as an independent server or a server cluster consisting of multiple servers. The method comprises the following steps:

[0042] Step 102: Display the interface code on the interface.

[0043] Interface code refers to code related to software interfaces. Specifically, interface code can be API (Application Programming Interface) code, which enables applications or computer devices to access routines without requiring access to the source code or understanding the internal workings.

[0044] Specifically, the interface code can be displayed on the terminal interface. The terminal can hide the code in the interface and display the code on the interface by triggering related operations such as "browse code" on the interface.

[0045] In this embodiment, Figure 2 The figure shows a schematic diagram of the merge request interface in one embodiment. The interface includes a source branch and a target branch. The source branch includes the code of the source branch of the interface, and the target branch is the interface code to be verified. The interface code can be displayed on the interface using the "Browse Code" control on the interface. The "Compare Two Branches" control is a basic function of the Git repository and is used to compare the differences between two branches.

[0046] Step 104 : In response to the triggering operation on the interface code, the interface code is subjected to code style verification according to preset style verification rules to obtain a verification result.

[0047] The triggering operation is used to trigger the code style verification of the interface code. This can include, but is not limited to, code verification operations, code submission operations, merge requests, and so on. The preset style verification rules are used to verify whether the interface code conforms to the preset style. The preset style refers to the software architectural style, which provides a set of design principles and constraints. For example, the preset style can be RESTful, but is not limited to this. Software designed based on this style can be more concise, more layered, and easier to implement mechanisms such as caching.

[0048] Specifically, the code verification program responds to a trigger operation on the interface code on the interface. The trigger operation is used to instruct the terminal to perform code style verification on the interface code according to the preset style verification rules to obtain a verification result. The verification result may include a correct result and an error result. A correct result can be used to indicate that the entire text of the interface code is correct, or a certain part of the interface code is correct, or the number of errors is 0, etc., but is not limited to these. An error result is used to indicate that an error has occurred in the interface code. The error result may include at least one of an error name, a style verification rule that does not meet the requirements, an error path, and an illegal value.

[0049] In this embodiment, code style verification of the interface code according to the preset style verification rules can also be implemented on the server.

[0050] Step 106: Display a verification report, which is generated based on the verification results.

[0051] The verification report is used to indicate the verification result of the interface code.

[0052] Specifically, the code verification program generates a verification report based on the verification result and displays the verification report on the interface of the terminal.

[0053] In this embodiment, Figure 3The figure shows an interface diagram of a verification report in one embodiment. After responding to the trigger operation of the interface code, the verification report is displayed on the interface. The verification report includes a verification type, wherein the verification type includes Schema verification, Openapi Generate verification and semantic verification (i.e., code style verification). That is, the trigger operation can also be used to trigger a syntax check of the interface code. Syntax checks are, for example, the Schema verification and OpenapiGenerate verification in the figure. The "semantic check" in the figure is the code style check, and the number of suggestions is the suspected error points, of which there are 43 in the figure. The error information includes non-compliant rules, error paths and illegal values ​​corresponding to each verification type. In the figure, no errors occurred after the Schema verification and Openapi Generate verification, while the semantic check (i.e., code style verification) included error information. Among them, the error information is that the interface name is illegal, and the non-compliant semantic rule (i.e., code style verification rule) is that the interface name does not contain the following verbs. The error path and illegal value are also displayed in the interface.

[0054] The above-mentioned code verification method displays the interface code on the interface, and in response to the triggering operation of the interface code, performs code style verification on the interface code according to the preset style verification rules, obtains the verification result, and displays the verification report, wherein the verification report is generated based on the verification result, and can perform code style verification on the interface code, so that the code is more in line with the writing specifications, reduces the error rate of the submitted code, reduces the work of manual verification, improves the accuracy of verification, and can also make the code more in line with the preset code style. The interface code that conforms to the preset code style is easier to be called, which improves the readability of the interface code.

[0055] In one embodiment, the interface code is subjected to code style verification according to preset style verification rules to obtain verification results, including: performing at least one of uniform resource locator verification, parameter verification, paging verification, and version verification on the interface code according to preset style verification rules to obtain verification results.

[0056] Specifically, if Figure 4 FIG. 1 is a flowchart of a method for checking interface code in an embodiment, including syntax checking, version checking, uniform resource locator checking (URL checking), parameter checking and paging checking.

[0057] For example, the preset style can be REST (Representational State Transfer) style, also known as RESTful style, or SOAP (Simple Object Access Protocol), etc., but not limited to this. Restful style content may include at least one of the following: a noun must be included in the uniform resource locator, when the uniform resource locator contains a verb, the corresponding operation instruction is a preset operation instruction, the target parameter identifier is a reference parameter identifier in the database, the target parameter description is a reference parameter description in the database, the target parameter identifier is spelled correctly, there must be a paging parameter in the read interface related instructions, and the version number does not conflict, but not limited to this. Then, the preset style verification rules are verification rules set according to the preset style.

[0058] The RESTful style facilitates information exchange between different software or programs over networks such as the internet. Presentational state transfer (REST) ​​is a set of constraints and properties defined by the Hypertext Transfer Protocol (HTTP) and is a software building style for providing network services. It is used to facilitate resource exchange between computing systems on an internetwork.

[0059] A Uniform Resource Locator (URL) represents the location and access method of a resource available on the internet. For example, a web address is a type of URI. The code verification program identifies the URI in the interface code and verifies it according to the URI verification rules in the pre-set style verification rules, generating a URI verification result.

[0060] Parameters are variables in the interface code. Parameters can specifically refer to at least one of a parameter identifier, a parameter value, and a parameter description. The code validation program can perform parameter validation on the interface code according to the parameter validation rules in the code style validation rules. Parameter validation can specifically include, but is not limited to, verifying whether the parameter identifier complies with syntax, whether it is a parameter identifier in the database, and whether the parameter value complies with standards.

[0061] The paging check may specifically include checking the paging page number, paging size, etc., but is not limited thereto. The code check program may perform paging check on the interface code according to the paging check rules in the code style check rules. For example, the code check program may check whether the interface code contains paging parameters, whether the paging page number exceeds a page number threshold, whether the paging size exceeds a page size threshold, etc., but is not limited thereto.

[0062] Version verification involves the code verification program verifying the target version number of the interface code. The code verification program can perform version verification on the interface code according to the paging verification rules in the code style verification rules. For example, the code verification program can verify whether the target version number conforms to a preset sequence, whether the target version number conflicts with a historical version number, etc., but is not limited to these.

[0063] The verification result includes at least one of a uniform resource locator verification result, a parameter verification result, a page verification result, and a version verification result. The parameter verification result may include at least one of a parameter similarity verification result and a parameter word verification result.

[0064] For example, when the code verification program only performs parameter verification and version verification according to the preset style verification rules, the verification results obtained only include the parameter verification results and the version verification results, and the verification report is generated based on the parameter verification results and the version verification results.

[0065] The above code verification method performs at least one of uniform resource locator verification, parameter verification, paging verification, and version verification on the interface code according to the preset style verification rules to obtain a verification result. It can verify whether the interface code conforms to the preset style, thereby making the code more in line with the writing specifications, reducing the error rate of the submitted code, and making the code more in line with the preset code style. Interface code that conforms to the preset code style is easier to call and improves the readability of the interface code.

[0066] In one embodiment, Figure 5 The following is a flow chart of performing uniform resource locator verification in one embodiment. The uniform resource locator verification is performed on the interface code according to the preset style verification rules to obtain the verification results, including:

[0067] Step 502: Determine the uniform resource locator in the interface code.

[0068] The preset style verification rule needs to verify the part of speech of each target word in the uniform resource locator.

[0069] Specifically, the code verification program can determine the uniform resource locator in the interface code according to a preset character string. For example, if the uniform resource locator contains a character string such as " / " or "http: / / ", the uniform resource locator in the interface code can be determined according to the preset character string.

[0070] Step 504: segment the URL to obtain the target word.

[0071] The target word may be a word with a meaning, or a single letter or number.

[0072] Specifically, the code verification program can use NLTK (Natural Language Toolkit) or other methods to segment the uniform resource locator to obtain target words. For example, / v3 / catering / dishes, then v3 can be a target word, catering can be a target word, and dishes can be a target word.

[0073] Step 506: Verify the part of speech of the target word and obtain a resource locator verification result.

[0074] The part of speech of the target word can be, but is not limited to, a noun, an adjective, a verb, or an adverb. The resource locator verification result is used to indicate the part of speech of the target word. The resource locator verification result can be, but is not limited to, whether the Uniform Resource Locator contains a verb, an adjective, a noun, or does not contain a verb.

[0075] Specifically, the code verification program verifies the part of speech of the target word and obtains a resource locator verification result corresponding to the uniform resource locator.

[0076] In this embodiment, when the interface code includes at least two uniform resource locators (URLs), the code verification program performs word segmentation on each of the at least two URLs to obtain a target word corresponding to each URL. The part of speech of the target word is verified to obtain a URL verification result corresponding to each URL.

[0077] The above code verification method determines the uniform resource locator in the interface code, performs word segmentation on the uniform resource locator, obtains the target word, verifies the part of speech of the target word, and obtains the resource location verification result. It can verify whether the uniform resource locator conforms to the preset style, thereby making the code more in line with the writing specifications, reducing the code error rate, reducing the work of manual verification, and improving the accuracy of verification.

[0078] In one embodiment, the verification report is generated based on the verification results, including: the verification report is generated based on the resource locator verification results, wherein the verification report includes a first resource locator verification result, and the first resource locator verification result is error information related to the part of speech not being a noun.

[0079] The first locator verification result includes error information related to the target word of the uniform resource locator not being a noun. Error information related to "the target word's part of speech is not a noun" is semantically identical or similar to "the target word's part of speech is not a noun." For example, the verification report may display error messages such as "the part of speech of the uniform resource locator is not a noun" or "the uniform resource locator does not conform to the preset coding style," but is not limited thereto.

[0080] Specifically, the resource locator verification result can be an error verification result of the resource locator, or it can be a correct verification result of the resource locator. The correct result of performing uniform resource locator verification on the interface code according to the preset style verification rules should include that the uniform resource locator verification result contains nouns. That is, the code style stipulates that there must be nouns in the uniform resource locator. For example, / v3 / catering / dishes contains the noun "dishes", then the uniform resource locator conforms to the preset code style. The first resource locator verification result is the error verification result. The code verification program generates a verification report based on the resource location verification result, and the verification report contains the first resource locator verification result. The verification report can also include other verification results. For example, when the code verification program also performs paging verification on the interface code, the verification report can also include the paging verification result.

[0081] In this embodiment, when the resource locator verification result is the third locator verification result, that is, the third locator verification result includes correct information related to the target word's part of speech being a noun, the display report does not include the third locator verification result.

[0082] The above-mentioned code verification method generates a verification report based on the resource locator verification result, wherein the verification report includes the first resource locator verification result, and the first resource locator verification result is error information related to the part of speech not being a noun. Under normal circumstances, the verification result displayed in the code verification report is an error result, and the error information related to the part of speech not being a noun is the error result. The verification report including the error result can be displayed to make the verification result readable, thereby reducing the error rate of the code.

[0083] In one embodiment, a verification report is generated based on the verification result, including: when the resource locator verification result is the second resource locator verification result, determining the operation instruction corresponding to the uniform resource locator, wherein the second resource locator verification result is error information related to the verb included in the part of speech; when the operation instruction is not a preset operation instruction, generating a verification report based on the second resource locator verification result, and the verification report includes the second resource locator verification result.

[0084] Among them, the second resource locator verification result is that the target word contains a verb in the part of speech. The relevant error information is information with the same or similar semantics. For example, the error information related to the part of speech containing a verb can be "Uniform Resource Locator A contains a verb", "Uniform Resource Locator A contains the verb close", etc., but not limited to this. The operation instruction can be "httpmethod", which is used to describe the operation on the resource. In API code editing, it includes but is not limited to the following four operation instructions:

[0085] GET is used to obtain resources

[0086] POST is used to add new resources

[0087] PUT is used to update resources

[0088] DELETE is used to delete resources

[0089] Specifically, the correct result of performing a Uniform Resource Locator (URL) verification on the interface code according to the preset style verification rules should include that when the URL contains a verb, the corresponding operation instruction in the URL is the preset operation instruction. The preset operation instruction can be "POST" as mentioned above. For example, if the URL is / v3 / pay / transactions / id / 4200000188201810052881913584 / close, then the part of speech of the target word in the URL is verified, and it is found that "pay" and "close" are both verbs, while "transactions" and "id" are nouns. If the URL contains a verb, the corresponding operation instruction is determined. If the URL corresponds to the operation instruction POST, the verification result does not need to be displayed in the verification report. If the URL corresponds to the operation instruction other than POST, such as GET, the second URL verification result needs to be displayed in the verification report. The verification report may also include other verification results, such as the first URL verification result, but is not limited to this.

[0090] In the above-mentioned code verification method, when the resource locator verification result is an error message related to the verb included in the part of speech of the target word, the operation instruction corresponding to the uniform resource locator is verified again. When it is not a preset operation instruction, the displayed verification report includes the second resource locator verification result. Under normal circumstances, the verification result displayed in the verification report is an error result. The uniform resource locator includes a verb but the corresponding operation instruction is not a preset operation instruction, which is an error result. The verification report including the error result can be displayed to make the verification result readable, thereby reducing the error rate of the code.

[0091] In one embodiment, the interface code is subjected to uniform resource locator verification according to a preset style verification rule to obtain a verification result, including:

[0092] Step (a1), determining the uniform resource locator in the interface code.

[0093] Step (a2): segmenting the uniform resource locator to obtain the target word.

[0094] Step (a3) ​​verifies the part of speech of the target word and obtains the resource locator verification result.

[0095] Step (a4): when the resource locator verification result is a second resource locator verification result, determining the operation instruction corresponding to the uniform resource locator, wherein the second resource locator verification result is error information related to the part of speech containing a verb.

[0096] Step (a5): When the operation instruction is not a preset operation instruction, a verification report is generated based on the first resource locator verification result and the second resource locator verification result. The verification report includes the first resource locator verification result and the second resource locator verification result, wherein the first resource locator verification result is error information related to the part of speech not being a noun.

[0097] The above-mentioned code verification method determines the uniform resource locator in the interface code, performs word segmentation processing on the uniform resource locator, obtains the target word, verifies the part of speech of the target word, and obtains the resource locator verification result. It can verify whether the uniform resource locator conforms to the preset style. The verification report contains the first resource locator verification result and the second resource locator verification result. Under normal circumstances, the verification result displayed in the code verification report is an error result, and the first resource locator verification result and the second resource locator verification result are both error information. The verification report containing the error result can be displayed to make the verification result readable, thereby reducing the error rate of the code, making the code more compliant with the writing specifications, reducing the error rate of the code, reducing the work of manual verification, and improving the accuracy of verification.

[0098] In one embodiment, Figure 6 FIG. 1 is a flow chart of performing parameter verification on interface code according to preset style verification rules in one embodiment, including:

[0099] Step 602: Obtain each reference parameter identifier and reference parameter description in the database.

[0100] The reference parameter identifier can be referred to as the reference parameter name. Each reference parameter name is unique. The reference parameter identifier can be composed of at least one of numbers, characters, letters, and symbols. The reference parameter description can include the reference parameter value and an explanation of the reference parameter. Each reference parameter identifier has a corresponding reference parameter description. For example, if the reference parameter identifier is "Batch Number," the reference parameter description is "A unique ID assigned to each batch, example value: 12345000."

[0101] Specifically, the reference database includes at least one reference parameter identifier and a corresponding reference parameter description. The code verification program obtains each reference parameter identifier and the corresponding reference parameter description from the database.

[0102] Step 604: Detect the target parameter identifier and the corresponding target parameter description in the interface code.

[0103] The target parameter identifier can be referred to as the target parameter name. Each target parameter identifier is unique. The target parameter identifier can be composed of at least one of numbers, text, letters, and symbols. The target parameter description can include at least one of the target parameter value and the target parameter explanation, but is not limited thereto. Each target parameter identifier has a corresponding target parameter description.

[0104] Specifically, the code verification program may first detect the operation instruction related words, and then determine the target parameter identifier according to the operation instruction related words, thereby determining the corresponding target parameter description.

[0105] Step 606 : Determine a first similarity between the target parameter identifier and each reference parameter identifier, and determine a second similarity between the target parameter description and each corresponding reference parameter description, to obtain a parameter similarity verification result.

[0106] The parameter verification result includes the first similarity and the second similarity. The code verification program can use algorithms such as Jaccard Similarity algorithm, cosine similarity algorithm, Euclidean distance algorithm, etc., but not limited to, to calculate the first similarity and the second similarity.

[0107] Specifically, the code verification program determines a first similarity between a target parameter identifier and each reference parameter identifier in the database. For example, if the target parameter identifier is "batch number" and there are 10 reference parameter identifiers in the database, then 10 first similarities will be obtained. Similarly, the code verification program determines a second similarity between a target parameter description corresponding to the target parameter identifier and each reference parameter description in the database. For example, if the target parameter description is "a unique ID assigned to each batch, example value: 12345000" and there are 10 reference parameter descriptions in the database, then 10 second similarities will be obtained.

[0108] Step 608 : The verification report is generated based on the parameter similarity verification result, wherein the verification report includes the first parameter similarity verification result, and the first parameter similarity verification result includes error information related to the first similarity and the corresponding second similarity both reaching the similarity threshold.

[0109] The similarity threshold can be configured as needed. There can be only one similarity threshold, such as 80%. There can also be two similarity thresholds, namely a first similarity threshold corresponding to the first similarity and a second similarity threshold corresponding to the second similarity. The first similarity threshold and the second similarity threshold can be different. "Error information related to both the first similarity and the corresponding second similarity reaching the similarity threshold" can be, for example, "similar parameter identifiers and parameter descriptions exist in the database", "the parameter identifier and parameter description do not conform to the preset style", etc., but is not limited to this.

[0110] The parameter similarity verification result includes a first similarity of the target parameter identifier and a second similarity of the target parameter description corresponding to the target parameter identifier. The parameter similarity verification result can be a correct parameter similarity verification result or an incorrect parameter similarity verification result. The parameter similarity verification result can include a first parameter similarity verification result, a second parameter similarity verification result, a third parameter similarity verification result, and a fourth parameter similarity verification result. An incorrect result of performing parameter verification on the interface code according to a preset style verification rule is the first parameter similarity verification result, and the first parameter similarity verification result includes error information related to both the first similarity and the corresponding second similarity reaching a similarity threshold. If the second parameter similarity verification result, the third parameter similarity verification result, and the fourth parameter similarity verification result are all correct information, then the second parameter similarity verification result can be that the first similarity reaches the similarity threshold and the corresponding second similarity does not reach the similarity threshold. The third parameter similarity verification result can be that the first similarity does not reach the similarity threshold and the corresponding second similarity reaches the similarity threshold. The fourth parameter similarity verification result can be that both the first similarity and the corresponding second similarity do not reach the similarity threshold. The first, second, third and fourth are just names. In this application, the first similarity can be called the second similarity, and the second similarity can be called the first similarity, but the two have different meanings.

[0111] The second similarity corresponding to the first similarity is the second similarity between the target parameter description corresponding to the target parameter identifier and the reference parameter description. The interface code is parameter-checked according to the preset style check rule, that is, the similarity between the target parameter identifier and the target reference identifier is checked.

[0112] Specifically, the code verification program generates a verification report based on the parameter similarity verification results. For example, the first similarity between the target parameter identifier "Batch Number" and the reference parameter identifier "Batch Number" is 100%, and the second similarity between the target parameter description "Unique ID assigned to each batch, example value: 12345000" and the reference parameter description "Unique ID assigned to each batch, example value: 12345000" is also 100%. This results in the first parameter similarity verification result.

[0113] The above-mentioned code verification method determines the first similarity between the target parameter identifier and each reference parameter identifier, and determines the second similarity between the target parameter description and each corresponding reference parameter description, to obtain a parameter similarity verification result. Under normal circumstances, the verification result displayed in the verification report is an erroneous result; since the first similarity and the corresponding second similarity both reach the similarity threshold, it means that the target parameter identifier and the target parameter description may be the same identifier and the same description as a certain reference parameter identifier and a certain reference parameter description in the database, that is, there is actually a correct identifier and description in the database, and there may be a subtle error in the target parameter identifier, then an erroneous result will be displayed in the verification report, making the parameter similarity verification result readable, thereby also reducing the error rate of the parameter identifier and parameter description.

[0114] In one embodiment, parameter verification of the interface code is performed according to a preset style verification rule, including: detecting a target parameter identifier in the interface code; verifying the target parameter identifier against words in a dictionary library to obtain a parameter word verification result. A verification report is generated based on the verification result, including: the verification report is generated based on the parameter word verification result, wherein the verification report includes a first parameter word verification result, and the first parameter word verification result is error information related to a spelling error in the target parameter identifier.

[0115] Specifically, the dictionary library can be an English dictionary library or a Chinese dictionary library. The words in the dictionary library can be used to verify whether the spelling of the target parameter identifier is correct, that is, to verify whether the target parameter identifier is a word in the dictionary. The parameter word verification result may include a correct parameter word verification result, and may also include an incorrect parameter word verification result. The first parameter word verification result is error information related to the spelling error of the target parameter identifier, for example, it can be "Parameter identifier A is spelled incorrectly", "Parameter identifier in line n of the code is spelled incorrectly", "Parameter identifier A is not in the dictionary" and other information.

[0116] The above-mentioned code verification method detects the target parameter identifier in the interface code, verifies the target parameter identifier according to the words in the dictionary library, verifies whether there are any spelling errors in the target parameter identifier, obtains the parameter word verification result, generates a verification report according to the parameter word verification result, and displays the verification report. The displayed verification report includes the first parameter word verification result, and the first parameter word verification result is error information related to the spelling error of the target parameter identifier, that is, the verification report includes the spelling error information of the parameter, so that the parameter word verification result is readable, thereby reducing the error rate of the parameter identifier.

[0117] In one embodiment, parameter verification of the interface code is performed according to a preset style verification rule, including:

[0118] Step (b1), obtaining each reference parameter identifier and each reference parameter description in the database.

[0119] Step (b2): detecting the target parameter identifier and the corresponding target parameter description in the interface code.

[0120] Step (b3) determines a first similarity between the target parameter identifier and each reference parameter identifier, and determines a second similarity between the target parameter description and each corresponding reference parameter description, to obtain a parameter similarity verification result.

[0121] Step (b4), detecting the target parameter identifier in the interface code.

[0122] Step (b5) verifies the target parameter identifier according to the words in the dictionary library to obtain the parameter word verification result.

[0123] In step (b6), a verification report is generated based on the parameter similarity verification result and the parameter word verification result, wherein the verification report includes the first parameter similarity verification result and the first parameter word verification result, the first parameter similarity verification result includes error information related to the first similarity and the corresponding second similarity both reaching the similarity threshold, and the first parameter word verification result is error information related to the spelling error of the target parameter identifier.

[0124] The above-mentioned code verification method determines the first similarity between the target parameter identifier and each reference parameter identifier, and determines the second similarity between the target parameter description and each corresponding reference parameter description, and obtains the parameter similarity verification result. Under normal circumstances, the verification result displayed in the verification report is an error result; since the first similarity and the corresponding second similarity both reach the similarity threshold, it means that the target parameter identifier and the target parameter description may be the same identifier and the same description as a certain reference parameter identifier and a certain reference parameter description in the database, that is, there are actually correct identifiers and descriptions in the database, and there may be subtle errors in the target parameter identifier. When writing code, the target parameter identifier may also have spelling errors, then an error result, i.e., an error report, will be displayed in the verification report, making the parameter similarity verification result readable, thereby also reducing the error rate of parameter identifiers and parameter descriptions.

[0125] In one embodiment, performing paging verification on the interface code according to a preset style verification rule includes: determining interface read-related instructions in the interface code; obtaining a reference paging parameter identifier; and verifying the interface read-related instructions based on the reference paging parameter identifier to obtain a paging verification result. A verification report is generated based on the verification result, including: generating the verification report based on the paging verification result, wherein the verification report includes a first paging verification result, and the first paging verification result is error information related to the fact that the interface read-related instructions do not contain the reference paging parameter identifier.

[0126] Among them, read interface related instructions refer to instructions for reading resources. For example, get is a read interface operation instruction, and getabcdefg is a read interface related instruction. The paging parameter identifier can be a paging page number parameter identifier, a paging size parameter identifier, etc., but not limited to this. One of the specifications in the preset code style is that the read interface related instructions must include paging parameters. That is, check whether abcdefg contains paging parameters. The error information related to the fact that the reference paging parameter identifier is not included in the read interface related instructions can be, for example, "the get instruction does not contain the paging parameter identifier", "the get instruction does not contain the offset", etc., but not limited to this.

[0127] Specifically, the code verification program determines the read interface related instructions in the interface code, and obtains the reference paging parameter identifier. Among them, the reference paging parameter identifier is the correct paging parameter identifier. For example, the reference paging parameter identifier is "offset", "limit", "paging page number", "paging size", etc., but not limited to this. The paging verification result of the code verification program may include a first paging verification result and a second paging verification result. Among them, the first paging verification result is the error information related to the fact that the reference paging parameter identifier is not included in the read interface related instructions, and an error report is required, that is, the first paging verification result needs to be displayed in the verification report. The second paging verification result is the correct information related to the parameter paging parameter identifier included in the read interface related instructions, and no error report is required.

[0128] The above-mentioned code verification method determines the read interface related instructions in the interface code, obtains the reference paging parameter identifier, verifies the read interface related instructions according to the reference paging parameter identifier, and obtains the paging verification result. The verification report includes error information related to the fact that the read interface related instructions do not contain the reference paging parameter identifier. It can more intuitively display the error information corresponding to the read interface related instructions, thereby reducing the error rate of the read interface related instructions, making the interface code easier to call, and improving the efficiency of the call.

[0129] In one embodiment, version verification of the interface code is performed according to a preset style verification rule, including: obtaining a historical version number and a target version number corresponding to the interface code; performing version verification on the target version number based on the historical version number to obtain a version number verification result. A verification report is generated based on the verification result, including: the verification report is generated based on the version number verification result, wherein the verification report includes a first version number verification result, and the first version number verification result is error information related to a version number conflict.

[0130] Among them, the version number refers to the identification number of the version. Each interface code has a corresponding version number, and the version number of each interface code is different. The historical version number is all the past version numbers of the interface code. The target version number is the current version number of the interface code. The verification report includes the first version number verification result, and may also include the second version number verification result. Among them, the first version number verification result is a version number conflict, and the second version number verification result is a version number non-conflict. For example, the error message related to the version number conflict can be "The version number of the interface code conflicts with the historical version number", "The version number of the interface code is incorrect", etc., but not limited to this.

[0131] Specifically, the code verification program obtains the historical version number and the target version number corresponding to the interface code. The code verification program verifies whether the target version number conflicts with the historical version number and obtains a version number verification result. The code verification program generates a verification report based on the version number verification result. The displayed verification report includes a first version number verification result, and the first version number verification result is error information related to the version number conflict.

[0132] The above code verification method obtains the historical version number and the target version number corresponding to the interface code, and performs version verification on the target version number based on the historical version number. The displayed verification report includes error information related to version number conflicts, which can more intuitively display error information related to the version number, thereby reducing the error rate of the version number.

[0133] In one embodiment, the code verification method also includes: when the verification report does not contain error information, sending the interface code to the target terminal where the account with review authority is located; receiving the review result returned by the target terminal, wherein the review result is obtained after reviewing the interface code; when the review result is passed, generating an interface code file corresponding to the interface code.

[0134] Among them, the error information may be that the parts of speech of the above-mentioned uniform resource locator are not nouns, the parts of speech of the uniform resource locator contain verbs and the operation instruction is not a preset operation instruction, the first similarity and the second similarity both reach the similarity threshold, the target parameter identifier is misspelled, the read interface related instructions do not contain the reference paging parameter identifier, and the version number conflicts. An account with review authority is an account that has the right to review the interface code. For example, it can be an administrator account. The terminal where the account with review authority is located becomes the target terminal. For example, if account z with review authority logs in on terminal 1, then terminal 1 is the target terminal; if account z with review authority logs in on terminal 2, then terminal 2 is the target terminal.

[0135] Specifically, when the code verification program determines that the verification report does not contain error information, it automatically sends the interface code to the target terminal where the account with review authority is located. The target terminal obtains the review result obtained after reviewing the code and sends the review result to the server. The server sends the review result to the terminal that uploaded the interface code. If the review result is passed, the code verification program automatically generates an interface code file corresponding to the interface code. The interface code file can be an API document.

[0136] In this embodiment, Figure 7 The figure shows an interface diagram for initiating a review in one embodiment. The title is, "Query the merchant information of the collection unit based on the payment order number" interface is newly added. The process includes "Electronic Invoice API Review" (i.e., code style verification of the interface code) → "master" (i.e., review). The review rules can be set as needed. The review rules require the consent of all reviewers (i.e., accounts with review authority). The reviewer's account may include "AAA", "BBB"...not limited to this, and new reviewers may be added. On this interface, you can comment on, agree or reject the review results.

[0137] In the above-mentioned code verification method, when the verification report does not contain error information, the interface code is sent to the target terminal where the account with review authority is located, and the review result returned by the target terminal is received. The review result is obtained after reviewing the interface code. When the review result is passed, an interface code file corresponding to the interface code is generated, which can further verify the interface code and reduce the error rate of the interface code.

[0138] In one embodiment, the triggering operation includes a merge request, which is used to merge the interface code with the code of the source branch.

[0139] The interface code is the code of the target branch of the development. The source branch code contains the code of multiple interfaces. The interface merge request (MR) is used to merge the interface code with the source branch code.

[0140] Specifically, in response to a merge request for the interface code, the interface code is checked for code style according to preset style verification rules to obtain a verification result; a verification report is displayed, and the verification report is generated based on the verification result. If the verification report does not contain any error information, the interface code is sent to the target terminal where the account with review authority is located; the review result returned by the target terminal is received, where the review result is obtained after reviewing the interface code; if the review result is passed, an interface code file corresponding to the interface code is generated and the interface code is merged with the code of the source branch.

[0141] The above code verification method triggers an operation including a merge request, which is used to merge the interface code with the source branch code, that is, to perform code style verification when the interface code is about to be submitted, which can reduce the error rate of the interface code and improve the review efficiency.

[0142] In one embodiment, the verification report includes error information corresponding to the interface code, and the error information includes at least one of an error name, a style verification rule that does not meet the requirements, an error path, and an illegal value.

[0143] Specifically, the error name can be the type of error, for example, the parameter verification result can be called interface parameter error, illegal interface name, etc., but not limited to this. Examples of style verification rules that do not meet the requirements include the URL not containing a noun, the URL containing a noun but the corresponding operation instruction is not a preset operation instruction, the target parameter identifier and the reference parameter identifier in the database have a similarity threshold similarity, the target parameter description and the reference parameter description in the database have a similarity threshold similarity, the parameter identifier is misspelled, there is no paging parameter in the read interface related instructions, and there is at least one of the conflicts in version numbers, but not limited to these. The error path is used to characterize the path where the error occurs, etc. The illegal value is used to characterize the interface code where the error occurs.

[0144] The above code verification method, the verification report includes error information corresponding to the interface code, the error information includes at least one of the error name, non-compliant style verification rules, error path, and illegal value, which can display the error information more intuitively, facilitate subsequent code modification, and improve code modification efficiency.

[0145] In one embodiment, Figure 8 The following is a sequence diagram of a code verification method in one embodiment, including Terminal A, where an account with permission to submit interface code resides, a contract repository, a target terminal where an account with review permission resides, and Terminal B, where an account interested in the interface code resides. The contract repository is a Git repository that stores the OpenAPI (Open Application Programming Interface) for the payment interface. Git is an open-source distributed version control system used for agile and efficient project management.

[0146] Terminal A initiates a merge contract (i.e., a merge request) for the interface code. The contract repository verifies the interface code, i.e., performs a code style check on the interface code according to the preset style verification rules, and performs a syntax check on the interface code. The contract repository returns the verification result that does not conform to the code style to Terminal A and displays the verification report on Terminal A. Alternatively, when the verification result is passed, the interface code document is generated, and an SDK (Software Development Kit) is generated. The contract repository initiates a review request to the target terminal where the account with review authority is located, and sends the interface code to the target terminal where the account with review authority is located. The contract repository records the review data during the review process, i.e., receives the review result returned by the target terminal. When the review result is failed, Terminal A is prompted to modify the interface code. The review result may include error information related to the interface code. When the review result is passed, the merge contract (merge request) is executed to merge the interface code with the source branch code. The contract repository can also send API review information such as the verification report and review data to Terminal B where the account that is interested in the interface code is located. In addition, the contract warehouse can also generate weekly reports related to the interface code and return the weekly report to Account B who follows the interface code, that is, the weekly progress of the API.

[0147] In one embodiment, a code verification method includes:

[0148] Step (c1), displaying the interface code on the interface.

[0149] Step (c2), in response to the merge request for the interface code, determining the uniform resource locator in the interface code.

[0150] Step (c3) segmenting the uniform resource locator to obtain the target word.

[0151] Step (c4) verifies the part of speech of the target word and obtains the resource locator verification result.

[0152] Step (c5): when the resource locator verification result is a second resource locator verification result, determining the operation instruction corresponding to the uniform resource locator, wherein the second resource locator verification result is error information related to the part of speech containing a verb.

[0153] Step (c6): when the operation instruction is not a preset operation instruction, generating a verification report according to the second resource locator verification result.

[0154] Step (c7), obtaining each reference parameter identifier and each reference parameter description in the database.

[0155] Step (c8), detecting the target parameter identifier and the corresponding target parameter description in the interface code.

[0156] Step (c9) determines a first similarity between the target parameter identifier and each reference parameter identifier, and determines a second similarity between the target parameter description and each corresponding reference parameter description, to obtain a parameter similarity verification result.

[0157] Step (c10), detecting the target parameter identifier in the interface code.

[0158] Step (c11) verifies the target parameter identifier according to the words in the dictionary library to obtain the parameter word verification result.

[0159] Step (c12), determining the read interface related instructions in the interface code.

[0160] Step (c13), obtaining the reference paging parameter identifier.

[0161] Step (c14): verifying the read interface related instructions according to the reference paging parameter identifier to obtain a paging verification result.

[0162] Step (c15), obtain the historical version number and the target version number corresponding to the interface code.

[0163] Step (c16): perform version verification on the target version number based on the historical version number to obtain a version number verification result.

[0164] Step (c17) displays a verification report, the verification report including at least one of a first resource locator verification result, a second resource locator verification result, a first parameter similarity verification result, a first parameter word verification result, a first paging verification result, a first version number verification result, and a verification result that conforms to a preset style. The first resource locator verification result is error information related to the part of speech not being a noun, the second resource locator verification result is error information related to the part of speech containing a verb, the first parameter similarity verification result includes error information related to the first similarity and the corresponding second similarity both reaching a similarity threshold, the first parameter word verification result is error information related to a spelling error of a target parameter identifier, the first paging verification result is error information related to the read interface related instruction not containing a reference paging parameter identifier, and the first version number verification result is error information related to a version number conflict.

[0165] Step (c18), when the verification report does not contain any error information, the interface code is sent to the target terminal where the account with review authority is located.

[0166] Step (c19), receiving the review result returned by the target terminal, wherein the review result is obtained after reviewing the interface code.

[0167] Step (c20): When the review result is passed, an interface code file corresponding to the interface code is generated.

[0168] The above-mentioned code verification method displays the interface code on the interface, and in response to the triggering operation of the interface code, performs at least one of uniform resource locator verification, parameter verification, paging verification, and version verification on the interface code according to the preset style verification rules to obtain the verification result and display the verification report, wherein the verification report is generated based on the verification result, and can perform code style verification on the interface code, so that the code is more in line with the writing specifications, the code error rate is reduced, the manual verification work is reduced, the accuracy of the verification is improved, and the code is more in line with the preset code style. The interface code that conforms to the preset code style is easier to be called, which improves the readability of the interface code.

[0169] In one embodiment, the present application also provides an application scenario that utilizes the aforementioned code verification method. Specifically, the code verification method is applied in this application scenario as follows: displaying a payment interface code on an interface; in response to a request to merge the payment interface code, performing at least one of Uniform Resource Locator (URL) verification, parameter verification, paging verification, and version verification on the payment interface code according to preset style verification rules to obtain a verification result; and displaying a verification report generated based on the verification result. The payment interface code may be code for providing payment resource calls, such as for creating a voucher batch, activating a voucher batch, issuing a voucher batch, pausing a voucher batch, restarting a voucher batch, querying merchants available for vouchers, or querying items available for vouchers. A terminal with an account with interface call permission can complete the corresponding operation by calling the payment interface code. Verifying the payment interface code can reduce the error rate of the payment interface code, making it easier to call, and improving the efficiency of calling the payment interface.

[0170] In one embodiment, the present application also provides an application scenario, which applies the above-mentioned code verification method. Specifically, the application of the code verification method in this application scenario is as follows: displaying the mini-program interface code on the interface; in response to a merge request for the mini-program interface code, performing at least one of uniform resource locator verification, parameter verification, paging verification, and version verification on the program interface code according to a preset style verification rule to obtain a verification result; displaying a verification report, which is generated based on the verification result. Among them, the mini-program is an application that can be used without downloading and installing. The mini-program interface code can be used to provide an interface for accessing the server where the mini-program is located. By calling the mini-program interface code, the user terminal can realize communication between the mini-program and other servers to realize mini-program related operations. Then, verifying the mini-program interface code can reduce the error rate of the mini-program interface code, make the mini-program interface code easier to call, and improve the efficiency of calling the mini-program.

[0171] In one embodiment, the present application also provides an application scenario, which applies the above-mentioned code verification method. Specifically, the application of the code verification method in this application scenario is as follows: displaying the cloud server interface code on the interface; in response to a merge request for the cloud server interface code, performing at least one of uniform resource locator verification, parameter verification, paging verification, and version verification on the program interface code according to a preset style verification rule to obtain a verification result; displaying a verification report, which is generated based on the verification result. Among them, the cloud server is used to provide data storage services, website building services, etc. for groups or individuals, but is not limited to this. The cloud server interface code can be used to provide an interface for accessing the cloud server. By calling the cloud server interface code, the user terminal can realize communication between the cloud server and other servers or other terminals to realize operations related to the cloud server. Then, verifying the cloud server interface code can reduce the error rate of the cloud server interface code, make the cloud server interface code easier to call, and improve the efficiency of calling the cloud server.

[0172] It should be understood that although Figure 1 、 5 The steps in the flowcharts of FIG6 and FIG7 are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Figure 1 、 5At least part of the steps in 6 may include multiple steps or multiple stages. These steps or stages do not necessarily have to be performed at the same time, but can be performed at different times. The order of execution of these steps or stages is not necessarily one by one, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0173] In one embodiment, Figure 9 As shown, a code verification device is provided. The device can be a software module or a hardware module, or a combination of the two to form a part of a computer device. The device specifically includes: a first display module 902, a verification module 904, and a second display module 906, wherein:

[0174] The first display module 902 is used to display the interface code on the interface;

[0175] Verification module 904, configured to, in response to a triggering operation on the interface code, perform code style verification on the interface code according to preset style verification rules to obtain a verification result;

[0176] The second display module 906 is used to display a verification report, which is generated based on the verification result.

[0177] The above-mentioned code verification device displays the interface code on the interface, and in response to the triggering operation of the interface code, performs code style verification on the interface code according to the preset style verification rules, obtains the verification result, and displays the verification report, wherein the verification report is generated based on the verification result, and can perform code style verification on the interface code, so that the code is more in line with the writing specifications, reduces the code error rate, reduces the work of manual verification, improves the accuracy of verification, and can also make the code more in line with the preset code style. The interface code that conforms to the preset code style is easier to be called, which improves the readability of the interface code.

[0178] In one embodiment, the verification module 904 is configured to perform at least one of uniform resource locator verification, parameter verification, page verification, and version verification on the interface code according to a preset style verification rule to obtain a verification result.

[0179] The above-mentioned code verification device performs at least one of uniform resource locator verification, parameter verification, paging verification, and version verification on the interface code according to the preset style verification rules to obtain a verification result, which can verify whether the interface code conforms to the preset style, thereby making the code more in line with the writing specifications, reducing the code error rate, and making the code more in line with the preset code style. Interface code that conforms to the preset code style is easier to call, and the readability of the interface code is also improved.

[0180] In one embodiment, the verification module 904 is used to determine the uniform resource locator in the interface code; perform word segmentation on the uniform resource locator to obtain a target word; and verify the part of speech of the target word to obtain a resource locator verification result.

[0181] The above-mentioned code verification device determines the uniform resource locator in the interface code, performs word segmentation processing on the uniform resource locator, obtains the target word, verifies the part of speech of the target word, and obtains the resource location verification result. It can verify whether the uniform resource locator conforms to the preset style, thereby making the code more in line with the writing specifications, reducing the code error rate, reducing the work of manual verification, and improving the accuracy of verification.

[0182] In one embodiment, the second display module 906 is used to display a verification report, which is generated based on the resource locator verification result, wherein the verification report includes the first resource locator verification result, which is an error message related to the part of speech not being a noun.

[0183] The above-mentioned code verification device generates a verification report based on the resource locator verification result, wherein the verification report includes the first resource locator verification result, and the first resource locator verification result is error information related to the part of speech being not a noun. Under normal circumstances, the verification result displayed in the code verification report is an error result, and the error information related to the part of speech being not a noun is an error result. The verification report including the error result can be displayed, making the verification result readable, thereby reducing the error rate of the code.

[0184] In one embodiment, the second display module 906 is used to display a verification report. When the resource locator verification result is the second resource locator verification result, the operation instruction corresponding to the uniform resource locator is determined, wherein the second resource locator verification result is error information related to the verb included in the part of speech; when the operation instruction is not a preset operation instruction, a verification report is generated according to the second resource locator verification result, and the verification report includes the second resource locator verification result.

[0185] The above-mentioned code verification device, when the resource locator verification result is error information related to the verb included in the part of speech of the target word, then verifies the operation instruction corresponding to the uniform resource locator. When it is not a preset operation instruction, the displayed verification report includes the second resource locator verification result. Under normal circumstances, the verification result displayed in the verification report is an error result. The uniform resource locator includes a verb but the corresponding operation instruction is not a preset operation instruction, that is, it is an error result. The verification report including the error result can be displayed, making the verification result readable, thereby also reducing the error rate of the code.

[0186] In one embodiment, the verification module 904 is used to determine the uniform resource locator in the interface code; perform word segmentation processing on the uniform resource locator to obtain a target word; verify the part of speech of the target word to obtain a resource locator verification result; when the resource locator verification result is the second resource locator verification result, determine the operation instruction corresponding to the uniform resource locator, wherein the second resource locator verification result is error information related to the part of speech containing a verb; when the operation instruction is not a preset operation instruction, generate a verification report based on the first resource locator verification result and the second resource locator verification result, the verification report including the first resource locator verification result and the second resource locator verification result, wherein the first resource locator verification result is error information related to the part of speech not being a noun.

[0187] The above-mentioned code verification device determines the uniform resource locator in the interface code, performs word segmentation processing on the uniform resource locator, obtains the target word, verifies the part of speech of the target word, and obtains the resource locator verification result. It can verify whether the uniform resource locator conforms to the preset style. The verification report contains the first resource locator verification result and the second resource locator verification result. Under normal circumstances, the verification result displayed in the code verification report is an error result, and the first resource locator verification result and the second resource locator verification result are both error information. The verification report containing the error result can be displayed, making the verification result readable, thereby reducing the error rate of the code, making the code more compliant with the writing specifications, reducing the error rate of the code, reducing the work of manual verification, and improving the accuracy of verification.

[0188] In one embodiment, the verification module 904 is configured to obtain each reference parameter identifier and reference parameter description in the database; detect the target parameter identifier and the corresponding target parameter description in the interface code; determine a first similarity between the target parameter identifier and each reference parameter identifier, and determine a second similarity between the target parameter description and each corresponding reference parameter description, thereby obtaining a parameter similarity verification result. The second display module 906 is configured to display a verification report, which is generated based on the parameter similarity verification result, wherein the verification report includes the first parameter similarity verification result, and the first parameter similarity verification result includes error information related to the first similarity and the corresponding second similarity both reaching a similarity threshold.

[0189] The above-mentioned code verification device determines the first similarity between the target parameter identifier and each reference parameter identifier, and determines the second similarity between the target parameter description and each corresponding reference parameter description, to obtain a parameter similarity verification result. Under normal circumstances, the verification result displayed in the verification report is an erroneous result; since the first similarity and the corresponding second similarity both reach the similarity threshold, it means that the target parameter identifier and the target parameter description may be the same identifier and the same description as a certain reference parameter identifier and a certain reference parameter description in the database, that is, there is actually a correct identifier and description in the database, and there may be a subtle error in the target parameter identifier, then an erroneous result will be displayed in the verification report, making the parameter similarity verification result readable, thereby also reducing the error rate of the parameter identifier and parameter description.

[0190] In one embodiment, the verification module 904 is used to detect the target parameter identifier in the interface code and verify the target parameter identifier against the words in the dictionary library to obtain a parameter word verification result. The second display module 906 is used to display a verification report, which is generated based on the parameter word verification result. The verification report includes a first parameter word verification result, which is an error message related to a spelling error in the target parameter identifier.

[0191] The above-mentioned code verification device detects the target parameter identifier in the interface code, verifies the target parameter identifier according to the words in the dictionary library, verifies whether there are any spelling errors in the target parameter identifier, obtains the parameter word verification result, generates a verification report according to the parameter word verification result, and displays the verification report. The displayed verification report includes the first parameter word verification result, and the first parameter word verification result is error information related to the spelling error of the target parameter identifier, that is, the verification report includes the spelling error information of the parameter, so that the parameter word verification result is readable, thereby reducing the error rate of the parameter identifier.

[0192] In one embodiment, the verification module 904 is configured to identify interface read-related instructions in the interface code; obtain a reference paging parameter identifier; and verify the interface read-related instructions based on the reference paging parameter identifier to obtain a paging verification result. The second display module 906 is configured to display a verification report, which is generated based on the paging verification result. The verification report includes a first paging verification result, which is error information related to the fact that the interface read-related instructions do not contain a reference paging parameter identifier.

[0193] The above-mentioned code verification device determines the read interface related instructions in the interface code, obtains the reference paging parameter identifier, verifies the read interface related instructions according to the reference paging parameter identifier, and obtains the paging verification result. The verification report includes error information related to the fact that the read interface related instructions do not contain the reference paging parameter identifier. It can more intuitively display the error information corresponding to the read interface related instructions, thereby reducing the error rate of the read interface related instructions, making the interface code easier to call, and improving the efficiency of the call.

[0194] In one embodiment, the verification module 904 is used to obtain the historical version number and the target version number corresponding to the interface code; perform version verification on the target version number based on the historical version number to obtain a version number verification result. The second display module 906 is used to display a verification report, which is generated based on the version number verification result. The verification report includes a first version number verification result, which is an error message related to a version number conflict.

[0195] The above-mentioned code verification device obtains the historical version number and the target version number corresponding to the interface code, performs version verification on the target version number based on the historical version number, and the displayed verification report includes error information related to the version number conflict, which can more intuitively display the error information related to the version number, thereby reducing the error rate of the version number.

[0196] In one embodiment, the code verification device further includes a review module. The review module is configured to, when the verification report does not contain error information, send the interface code to a target terminal where an account with review authority is located; receive a review result returned by the target terminal, wherein the review result is obtained after reviewing the interface code; and, when the review result is passed, generate an interface code file corresponding to the interface code.

[0197] The above-mentioned code verification device, when the verification report does not contain error information, sends the interface code to the target terminal where the account with review authority is located, and receives the review result returned by the target terminal, wherein the review result is obtained after reviewing the interface code. When the review result is passed, an interface code file corresponding to the interface code is generated, which can further verify the interface code and reduce the error rate of the interface code.

[0198] In one embodiment, the triggering operation includes a merge request, which is used to merge the interface code with the code of the source branch.

[0199] The above-mentioned code verification device triggers an operation including a merge request, which is used to merge the interface code with the code of the source branch, that is, to perform code style verification when the interface code is about to be submitted, which can reduce the error rate of the interface code and improve the review efficiency.

[0200] In one embodiment, the verification report includes error information corresponding to the interface code, and the error information includes at least one of an error name, a style verification rule that does not meet the requirements, an error path, and an illegal value.

[0201] The above-mentioned code verification device, the verification report includes error information corresponding to the interface code, the error information includes at least one of the error name, non-compliant style verification rules, error path, and illegal value, which can display the error information more intuitively, facilitate subsequent code modification, and improve code modification efficiency.

[0202] For the specific definition of the code verification device, please refer to the definition of the code verification method above, which will not be repeated here. Each module in the above-mentioned code verification device can be implemented in whole or in part by software, hardware, or a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0203] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 10 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a code verification method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.

[0204] Those skilled in the art will understand that Figure 10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0205] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.

[0206] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.

[0207] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0208] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0209] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A code verification method, characterized in that: The method comprises: The interface code is displayed on the interface through the terminal where the account with the interface code submission authority is located; a merge contract is initiated for the interface code, so that the contract warehouse performs code style verification on the interface code according to the preset style verification rules, and obtains the verification result, including: obtaining each reference parameter identifier and each reference parameter description in the database; detecting the target parameter identifier and the corresponding target parameter description in the interface code; determining the first similarity between the target parameter identifier and each reference parameter identifier, and determining the second similarity between the target parameter description and each corresponding reference parameter description, to obtain the parameter similarity verification result; the parameter similarity verification result The result includes a first parameter similarity check result, a second parameter similarity check result, a third parameter similarity check result, and a fourth parameter similarity check result; the first parameter similarity check result includes error information related to the first similarity and the corresponding second similarity both reaching the similarity threshold; the second parameter similarity check result is that the first similarity reaches the similarity threshold and the corresponding second similarity does not reach the similarity threshold; the third parameter similarity check result is that the first similarity does not reach the similarity threshold and the corresponding second similarity reaches the similarity threshold; the fourth parameter similarity check result is that the first similarity and the corresponding second similarity both do not reach the similarity threshold; When the verification result is not in compliance with the code style, a verification report is displayed through the terminal where the account with the interface code submission authority is located, and the verification report is generated based on the verification result; Among them, when the verification report does not contain error information, the contract warehouse automatically sends the interface code to the target terminal where the account with review authority is located; receives the review result returned by the target terminal, wherein the review result is obtained after reviewing the interface code; when the review result is not passed, the terminal where the account with interface code submission authority is located is prompted to modify the interface code; when the review result is passed, the merge contract is automatically executed to merge the interface code with the source branch code.

2. The method according to claim 1, characterized in that The code style verification of the interface code is performed according to the preset style verification rules to obtain the verification result, including: At least one of uniform resource locator verification, parameter verification, page verification, and version verification is performed on the interface code according to a preset style verification rule to obtain a verification result.

3. The method according to claim 2, characterized in that The code style verification of the interface code is performed according to the preset style verification rules to obtain the verification result, including: Determining a uniform resource locator in the interface code; Performing word segmentation processing on the uniform resource locator to obtain a target word; The part of speech of the target word is verified to obtain a resource locator verification result.

4. The method according to claim 3, characterized in that The contract repository is used to determine the operation instruction corresponding to the uniform resource locator when the resource locator verification result is the second resource locator verification result; when the operation instruction is not a preset operation instruction, generate a verification report based on the second resource locator verification result, and the verification report includes the second resource locator verification result.

5. The method according to claim 2, characterized in that The code style verification of the interface code is performed according to the preset style verification rules to obtain the verification result, including: Detecting a target parameter identifier in the interface code; Verify the target parameter identifier according to the words in the dictionary library to obtain a parameter word verification result; The verification report is generated based on the verification results and includes: The verification report is generated based on the parameter word verification result, wherein the verification report includes a first parameter word verification result, and the first parameter word verification result is error information related to the spelling error of the target parameter identifier.

6. The method according to claim 2, characterized in that The code style verification of the interface code is performed according to the preset style verification rules to obtain the verification result, including: Determining read interface related instructions in the interface code; Get the reference paging parameter identifier; Verify the read interface related instructions according to the reference paging parameter identifier to obtain a paging verification result; The verification report is generated based on the verification results and includes: The verification report is generated according to the paging verification result, wherein the verification report includes a first paging verification result, and the first paging verification result is error information related to the fact that the read interface related instruction does not include the reference paging parameter identifier.

7. The method according to claim 2, characterized in that The code style verification of the interface code is performed according to the preset style verification rules to obtain the verification result, including: Obtain the historical version number and the target version number corresponding to the interface code; Performing version verification on the target version number according to the historical version number to obtain a version number verification result; The verification report is generated based on the verification results and includes: The verification report is generated according to the version number verification result, wherein the verification report includes a first version number verification result, and the first version number verification result is error information related to the version number conflict.

8. The method according to any one of claims 1 to 7, characterized in that The verification report includes error information corresponding to the interface code, and the error information includes at least one of an error name, a non-compliant style verification rule, an error path, and an illegal value.

9. A code verification device, characterized in that: The device comprises: The first display module is used to display the interface code on the interface through the terminal where the account with the interface code submission authority is located; a verification module, configured to initiate a contract merge for the interface code, so that the contract repository performs code style verification on the interface code according to preset style verification rules to obtain a verification result, including: obtaining each reference parameter identifier and each reference parameter description in a database; detecting a target parameter identifier and a corresponding target parameter description in the interface code; determining a first similarity between the target parameter identifier and each reference parameter identifier, and determining a second similarity between the target parameter description and each corresponding reference parameter description to obtain a parameter similarity verification result; the parameter similarity verification result includes a first parameter similarity verification result, a second parameter similarity verification result, a third parameter similarity verification result, and a fourth parameter similarity verification result; the first parameter similarity verification result includes error information related to both the first similarity and the corresponding second similarity reaching a similarity threshold; the second parameter similarity verification result is that the first similarity reaches the similarity threshold and the corresponding second similarity does not reach the similarity threshold; the third parameter similarity verification result is that the first similarity does not reach the similarity threshold and the corresponding second similarity reaches the similarity threshold; and the fourth parameter similarity verification result is that both the first similarity and the corresponding second similarity do not reach the similarity threshold; A second display module is configured to display a verification report generated based on the verification result via a terminal where an account with interface code submission authority is located when the verification result indicates that the code style is not met; Among them, the contract warehouse is used to automatically send the interface code to the target terminal where the account with review authority is located when the verification result does not contain error information; receive the review result returned by the target terminal, wherein the review result is obtained after reviewing the interface code; when the review result is not passed, prompt the terminal where the account with interface code submission authority is located to modify the interface code; when the review result is passed, automatically execute the merge contract to merge the interface code with the source branch code.

10. The code verification device according to claim 9, characterized in that: The code style verification of the interface code is performed according to the preset style verification rules to obtain the verification result, including: performing at least one of uniform resource locator verification, parameter verification, paging verification, and version verification on the interface code according to the preset style verification rules to obtain the verification result.

11. The code verification device according to claim 10, characterized in that: The code style verification of the interface code is performed according to preset style verification rules to obtain a verification result, including: determining the uniform resource locator in the interface code; performing word segmentation processing on the uniform resource locator to obtain a target word; and verifying the part of speech of the target word to obtain a resource locator verification result.

12. The code verification device according to claim 11, characterized in that: The contract repository is used to determine the operation instruction corresponding to the uniform resource locator when the resource locator verification result is the second resource locator verification result; when the operation instruction is not a preset operation instruction, generate a verification report based on the second resource locator verification result, and the verification report includes the second resource locator verification result.

13. The code verification device according to claim 10, characterized in that: The code style verification of the interface code is performed according to preset style verification rules to obtain a verification result, including: detecting a target parameter identifier in the interface code; verifying the target parameter identifier according to words in a dictionary library to obtain a parameter word verification result; the verification report is generated according to the parameter word verification result, wherein the verification report includes a first parameter word verification result, and the first parameter word verification result is error information related to a spelling error of the target parameter identifier.

14. The code verification device according to claim 10, characterized in that: The code style verification of the interface code is performed according to preset style verification rules to obtain a verification result, including: determining the read interface related instructions in the interface code; obtaining a reference paging parameter identifier; verifying the read interface related instructions according to the reference paging parameter identifier to obtain a paging verification result; the verification report is generated according to the paging verification result, wherein the verification report includes a first paging verification result, and the first paging verification result is error information related to the fact that the read interface related instructions do not contain the reference paging parameter identifier.

15. The code verification device according to claim 10, characterized in that: The code style verification is performed on the interface code according to the preset style verification rules to obtain the verification result, including: obtaining the historical version number and the target version number corresponding to the interface code; performing version verification on the target version number according to the historical version number to obtain the version number verification result; the verification report is generated according to the version number verification result, wherein the verification report includes a first version number verification result, and the first version number verification result is error information related to the version number conflict.

16. The code verification device according to any one of claims 9 to 15, characterized in that: The verification report includes error information corresponding to the interface code, and the error information includes at least one of an error name, a non-compliant style verification rule, an error path, and an illegal value.

17. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.

18. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

19. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.