Error detection method and device for published package, computer equipment and storage medium

By using the object detection model to detect the code files of the publishing package, and compare them with the preset results, summarizing the differences results, and generating a more comprehensive error collection file, it solves the problem of time-consuming and low accuracy of the existing publishing package detection methods, and achieves more efficient and accurate error detection.

CN119806997APending Publication Date: 2025-04-11INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411813659.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The existing package detection methods are time-consuming and labor-intensive, and are prone to omissions and errors, resulting in low detection accuracy.

Method used

By obtaining the code file and object detection model corresponding to the release package, input the code file into the object detection model, output the first detection result, and compare it with the preset detection result, summarizing the difference results, generating a more comprehensive second detection result, and finally generating the error collection file for the release package.

Benefits of technology

Improve the accuracy and efficiency of error detection of release packages, and reduce the detection omissions and errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806997A_ABST
    Figure CN119806997A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a release package error detection method and device, computer equipment and a storage medium, and the device comprises the steps: obtaining a code file and a target detection model corresponding to a release package; the code file is input into a target detection model, a first detection result is output, and the first detection result comprises at least one of grammar errors, semantic errors and logic structure errors obtained by detecting the code file and dependency relation errors among script units in the code file; comparing a difference between the first detection result and a preset detection result, and summarizing a difference result into the first detection result to obtain a second detection result corresponding to the code file; and according to the second detection result, generating an error set file of the release package, and sending the error set file to the client. The method can solve the problems that the error detection of the published packet is time-consuming and labor-consuming, omissions and errors are easy to occur, and the detection accuracy is low.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, computer equipment and storage medium for error detection of a release package. Background Art

[0002] With the rapid development of software development, the quality of release packages directly affects the stability of the software and user experience. Package Release Testing is an important part of the software development and deployment process, which aims to ensure the quality and stability of the software package before release.

[0003] Traditional release package detection methods rely on manual review, including code style check, dependency package version check, security check, and functional test result verification. The review process usually relies on the experience and judgment of the auditor, which may result in omissions and subjectivity. It is not only time-consuming and labor-intensive, but also prone to omissions and errors, resulting in low error detection accuracy for release packages. On the other hand, static analysis tools are used to automatically check release packages to find potential problems and non-compliant code files in the release packages. However, due to the limited detection capabilities of static analysis tools, they cannot capture all types of errors, resulting in insufficient error detection accuracy for release packages. Summary of the invention

[0004] In view of this, the present invention provides a method, apparatus, computer device and storage medium for error detection of a release package to solve the problem that error detection of a release package is time-consuming and labor-intensive, and prone to omissions and errors, resulting in low detection accuracy.

[0005] In a first aspect, the present invention provides an error detection method for a release package, the method comprising: obtaining a code file and a target detection model corresponding to the release package; inputting the code file into the target detection model, and outputting a first detection result, the first detection result including at least one of grammatical errors, semantic errors, logical structure errors and dependency errors between script units in the code file obtained by detecting the code file; comparing the difference between the first detection result and a preset detection result, and aggregating the difference results into the first detection result, to obtain a second detection result corresponding to the code file, the second detection result including at least one error, and the preset detection result including at least one of grammatical errors, semantic errors and logical structure errors obtained by detecting the code file; generating an error collection file of the release package according to the second detection result, and sending the error collection file to a client.

[0006] Based on the method of the first aspect above, the code file and the target detection model corresponding to the release package can be obtained; the code file is input into the target detection model, and the first detection result is output; and the first detection result is compared with the preset detection result, and the difference result of the comparison is summarized into the first detection result, so that the summarized second detection result can include more errors than the preset detection result. Compared with the error collection file of the code file in the related art that only includes the errors in the preset detection result, the embodiment of the present invention can make the error collection file of the code file include all errors in the first detection result and the preset detection result, reduce the omissions and errors in the error detection corresponding to the release package, improve the detection efficiency, and at the same time improve the error detection accuracy of the release package.

[0007] In an optional embodiment, obtaining a target detection model includes: obtaining an initial model and multiple historical code files, each historical code file including multiple historical code units; splitting the multiple historical code files into N historical code units; parsing the N historical code units, obtaining annotation information corresponding to each of the N historical code units and dependencies between the N historical code units, the annotation information being used to indicate whether each historical code unit has an anomaly; training the initial model based on the annotation information, the N historical code units and the dependencies to obtain a target detection model, the target detection model having the function of detecting whether each code unit has an anomaly and whether the dependencies are correct.

[0008] In an implementation manner of the present invention, based on N historical code units corresponding to multiple historical code files, annotation information corresponding to each historical code unit and the dependency relationship between historical code units can be parsed, and then the initial model can be trained to obtain a target detection model, so that the target detection model can be used to perform error detection on the code files in the future, thereby improving the accuracy of error detection of the release package.

[0009] In an optional implementation, the method further includes: detecting whether the code file includes the target code and the target software package on which the target code depends; if so, inputting the code file into a preset code detection tool and outputting a preset detection result.

[0010] In the implementation manner of the present invention, it is possible to detect whether a code file includes the target code and the target software package on which the target code depends, thereby avoiding the code file from lacking the target software package on which it depends, affecting the normal operation of the code file, and facilitating subsequent error detection of the code file.

[0011] In an optional implementation, obtaining the code file corresponding to the release package includes: obtaining the release package in response to a user's operation of uploading the release package; and parsing the release package to obtain a parsing result when the release package is detected to be complete, wherein the parsing result includes the code file.

[0012] In the implementation manner of the present invention, after obtaining the release package, the release package can be parsed to obtain the code file corresponding to the release package, so as to facilitate further error detection of the code file and implement error detection of the release package.

[0013] In an optional embodiment, detecting whether the release package is complete includes: obtaining the memory capacity required for the release package; detecting whether the memory capacity is less than or equal to a first threshold; if the memory capacity is less than or equal to the first threshold, obtaining the release package name of the release package, and detecting whether the file format of the release package conforms to the first preset format based on a field at a preset position in the release package name; if the file format of the release package conforms to the first preset format, obtaining a real hash value corresponding to the release package, comparing the real hash value with the preset hash value, and detecting whether the release package is complete; if the real hash value is consistent with the preset hash value, determining that the release package is complete.

[0014] In an embodiment of the present invention, after obtaining the release package, it can be detected whether the memory capacity required by the release package meets expectations, so as to avoid jamming when the release package process is incorrectly detected due to the release package being too large; then, it can be detected whether the file format of the release package meets the first preset format, so as to ensure that the file format of the release package is correct; and then, it can be detected whether the release package is complete, so as to ensure that the release package has not been tampered with or damaged.

[0015] In an optional implementation, the parsing result also includes a resource file; the method also includes: detecting whether the resource file includes a configuration file and a description document, the configuration file includes at least one parameter information required to run the code file, and the description document includes the target version information of the release package and the description information of the target software package; if so, based on the target version information and the corresponding relationship, determining whether the target code matches the target software package, the configuration file and the description document; if they match, detecting the resource file to obtain a third detection result, the third detection result including at least one of a format error, a file content error and a parameter error of the resource file; adding the third detection result to the error collection file, generating a new first error collection file, and sending the first error collection file to the client.

[0016] In an implementation manner of the present invention, error detection can be performed on the resource files corresponding to the release package to ensure that the resource files include configuration files and instruction documents, and to avoid missing necessary files in the resource files; to ensure that the versions of all files included in the resource files and code files match, and to ensure the compatibility of all files included in the resource files and code files. On this basis, error detection is further performed on the resource files to obtain a third detection result, and the third detection result is added to the error collection file, so that the first error collection file of the release package includes not only all errors in the code files, but also all errors in the resource files; thereby reducing omissions and errors in the error detection corresponding to the release package, improving the detection efficiency, and at the same time improving the error detection accuracy of the release package.

[0017] In an optional embodiment, detecting a resource file and obtaining a third detection result includes: obtaining a preset language processing algorithm; parsing the resource file through the preset language processing algorithm to obtain at least one key field corresponding to the resource file; based on the at least one key field, detecting whether the resource file has a file content error to obtain a first result; obtaining a first name of the configuration file and a second name of the description document; based on the first name and the second name, detecting whether the resource file has a format error to obtain a second result; based on at least one parameter information, detecting whether the resource file has a parameter error to obtain a third result; obtaining a third detection result based on the first result, the second result and the third result.

[0018] In an embodiment of the present invention, a resource file can be parsed based on a preset language processing algorithm, and then a third detection result can be obtained based on at least one key field obtained by the parsing, the first name of the configuration file and the second name of the description document, and at least one parameter information to determine whether the resource file has file content errors, format errors, or parameter errors.

[0019] In a second aspect, the present invention provides an error detection device for a release package, the device comprising: an acquisition module, used to acquire a code file and a target detection model corresponding to the release package; a processing module, used to input the code file into the target detection model, and output a first detection result, the first detection result including at least one of grammatical errors, semantic errors, logical structure errors and dependency errors between script units in the code file obtained by detecting the code file; the processing module is also used to compare the difference between the first detection result and a preset detection result, and summarize the difference results into the first detection result to obtain a second detection result corresponding to the code file, the second detection result including at least one error, and the preset detection result including at least one of grammatical errors, semantic errors and logical structure errors obtained by detecting the code file; the processing module is also used to generate an error collection file of the release package according to the second detection result, and send the error collection file to the client.

[0020] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the error detection method for publishing a package of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0021] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the error detection method for a release package of the first aspect or any corresponding embodiment thereof.

[0022] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the error detection method for a release package of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0024] Figure 1 is a schematic diagram of a release package error detection process in the related art;

[0025] Figure 2 is a topology diagram of an error detection system for publishing packages according to an embodiment of the present invention;

[0026] Figure 3 is a schematic flow chart of a method for detecting errors in a release package according to an embodiment of the present invention;

[0027] Figure 4 is a structural block diagram of an error detection device for a release package according to an embodiment of the present invention;

[0028] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0030] The embodiment of the present invention is applied to a scenario in which, during a software development and release process, developers obtain a release package after completing code development and need to perform error detection on the release package.

[0031] In related technologies, such as Figure 1 As shown, Figure 1 is a schematic diagram of a release package error detection process in the related art; Figure 1 Specifically, it includes:

[0032] Step 1: Release package creation. After completing the software function development, the developer uses the build tool (for example, the build tool is Maven, Gradle) to generate the release package. The release package usually includes executable files, dependent libraries, configuration files, etc. Step 2: Release package upload. The developer uploads the generated release package to the version control system or continuous integration / continuous deployment (CI / CD) platform. This process is usually completed through command line tools or graphical user interfaces. Step 3: Manual review. After the release package is uploaded, the development team will conduct a manual review. The review content includes: code style check, dependency package version check, security check, and functional test result verification. The review process usually relies on the experience and judgment of team members, and there may be omissions and subjective problems. Step 4: Static analysis. Some teams use static analysis tools (for example, static analysis tools are SonarQube, Checkstyle) to perform automated checks on release packages. Static analysis tools scan the code and generate reports to point out potential problems and non-compliance. Static analysis tools have limited detection capabilities and cannot capture all types of errors, especially those logical errors that depend on runtime context. Step 5: Defect repair. Developers fix the problems found based on manual review and static analysis reports. This process may be repeated until the release package meets the requirements. Step 6: Official release. Once the release package passes all checks, the development team will release it to the production environment. After the release, the team will monitor the operation of the software to ensure that no new problems arise.

[0033] but Figure 1There are multiple problems in the error detection process of release packages. For example, static code analysis tools analyze code files to identify potential defects, but usually do not include resource file checks. Relying on manual inspection of release packages item by item is inefficient and prone to subjective bias. This leads to low efficiency, low coverage, and poor accuracy in error detection of release packages, which cannot meet the high requirements of software development for release package quality.

[0034] In order to solve the above technical problems, an embodiment of the present invention provides an error detection method for a release package, which performs error detection on the code files of the release package and the resource files of the release package, so as to improve the error detection efficiency, accuracy and coverage of the release package.

[0035] Below Figure 2 Taking the error detection system 200 of the published package as an example, the method provided in the embodiment of the present application is described. Figure 2 It is only a schematic diagram and does not constitute a limitation on the applicable scenarios of the technical solution provided in this application.

[0036] like Figure 2 As shown, Figure 2 4 is a topological diagram of an error detection system for publishing packages according to an embodiment of the present invention. Figure 2 In the embodiment, the error detection system 200 for publishing packages may include an error detection device 201 for publishing packages and a client 202 .

[0037] The error detection device 201 for publishing a package in the embodiment of the present invention may be any device with computing and communication capabilities, such as a server, a server or a virtual machine.

[0038] It can be understood that the error detection device 201 may include a check module, a report generation module and a knowledge base module. Among them, the check module uses artificial intelligence generated content technology (AIGC) to perform error detection on the release package. The report generation module is used to generate an error collection file of the release package. The knowledge base module is used to record historical code files and detection result data.

[0039] The client 202 in the embodiment of the present invention can be any device with communication function and input / output function. The client 202 has a display function. The client 202 can display the error collection file of the release package.

[0040] Figure 2The error detection system 200 for publishing packages is only used as an example and is not used to limit the technical solution of the present application. Those skilled in the art should understand that in the specific implementation process, the error detection system 200 for publishing packages may also include other devices without limitation.

[0041] According to an embodiment of the present invention, an embodiment of a method for error detection of a release package is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0042] In this embodiment, a method for detecting an error in a published package is provided, which can be used in the above-mentioned error detection device for publishing a package (hereinafter referred to as the error detection device). Figure 3 is a flow chart of a method for detecting an error in a release package according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0043] S301: Obtain the code files and target detection model corresponding to the release package.

[0044] Among them, the target detection model has the function of detecting whether there are anomalies in each code unit and whether the dependencies are correct.

[0045] In the embodiment of the present invention, the code file includes the target code and the target software package on which the target code depends.

[0046] In one example, the error detection device obtains the release package in response to the user's operation of uploading the release package; when the release package is detected to be complete, the release package is parsed to obtain a parsing result.

[0047] The parsing results include code files and resource files.

[0048] The resource file includes a configuration file and a description document. The configuration file includes at least one parameter information required to run the code file. The description document includes the target version information of the release package and the description information of the target software package.

[0049] In some optional embodiments, the error detection device obtains the memory capacity required for the release package; detects whether the memory capacity is less than or equal to a first threshold; if the memory capacity is less than or equal to the first threshold, obtains the release package name of the release package, and detects whether the file format of the release package conforms to the first preset format based on the field at a preset position in the release package name; if the file format of the release package conforms to the first preset format, obtains the real hash value corresponding to the release package, compares the real hash value with the preset hash value, and detects whether the release package is complete; if the real hash value is consistent with the preset hash value, it is determined that the release package is complete.

[0050] The first threshold can be set according to actual needs and is not limited. For example, the first threshold can be 1 GB.

[0051] In the embodiment of the present invention, the preset position may be the suffix position of the release package name. The first preset format may be a compressed file format (ZIP format) or an archive file format (TAR format).

[0052] In the embodiment of the present invention, the hash value may be an MD5 checksum value or a secure hash algorithm 256-bit value (SHA-256 value).

[0053] In some optional embodiments, the error detection device obtains an initial model and multiple historical code files; splits the multiple historical code files into N historical code units; parses the N historical code units to obtain annotation information corresponding to each of the N historical code units and dependency relationships between the N historical code units; trains the initial model based on the annotation information, N historical code units and the dependency relationships to obtain a target detection model.

[0054] Each historical code file includes multiple historical code units.

[0055] In the embodiment of the present invention, the annotation information is used to indicate whether each historical code unit has an abnormality.

[0056] In an embodiment of the present invention, the initial model may be a convolutional neural network model (CNN), a recurrent neural network (RNN), or a long short-term memory network model (LSTM).

[0057] Optionally, the error detection device can optimize the target detection model parameters through a back-propagation algorithm, or use an appropriate loss function (e.g., a cross entropy loss function) and an optimization algorithm to optimize the target detection model parameters. The error detection device can use a validation set to evaluate the trained target detection model, calculate accuracy, recall, F1-score and other indicators, and ensure that the model performance meets the requirements. The error detection device can also perform model tuning based on the evaluation results, and optimize the target detection model by adjusting model parameters, increasing training data or improving feature extraction methods.

[0058] It is understandable that when the historical code files and detection result data in the knowledge base module are updated, the error detection device can retrain and optimize the model based on the updated data to improve the detection accuracy and adaptability.

[0059] S302: Input the code file into the target detection model and output a first detection result.

[0060] The first detection result includes at least one of a syntax error, a semantic error, a logical structure error, and a dependency error between script units in the code file obtained by detecting the code file.

[0061] In one example, before the error detection device inputs the code file into the target detection model, it is necessary to detect whether the file format of the code file conforms to the code format detected by the detection tool or the target detection model. If not, it is necessary to convert the file format of the code file into a code format that conforms to the code format detected by the detection tool or the target detection model. For example, the code format that conforms to the code format detected by the detection tool or the target detection model can be a comma-separated values ​​file format (CSV).

[0062] S303: Compare the difference between the first detection result and the preset detection result, and summarize the difference results into the first detection result to obtain a second detection result corresponding to the code file.

[0063] The second detection result includes at least one error.

[0064] In the embodiment of the present invention, the preset detection result includes at least one of a syntax error, a semantic error, and a logical structure error obtained by detecting the code file.

[0065] In an embodiment of the present invention, the difference between the first detection result and the preset detection result may be that the error type included in the first detection result is different from the error type included in the preset detection result; or the error type included in the first detection result and the preset detection result is the same, but the error occurs in different code units; or the first detection result includes errors that are not included in the preset detection result, or the preset detection result includes errors that are not included in the first detection result.

[0066] In some optional implementations, the error detection device detects whether the code file includes the target code and the target software package on which the target code depends; if so, the code file is input into a preset code detection tool and a preset detection result is output.

[0067] The preset code detection tool may be a static code analysis tool, for example, an ESLint tool, a Pylint tool, or a SonarQube tool.

[0068] As can be understood, the error detection device performs static checks on the code files to identify potential code defects, style issues and security vulnerabilities. Static code analysis tools can check the syntax errors, semantic errors and logical errors of the code files without executing the program.

[0069] S304: Generate an error collection file of the release package according to the second detection result, and send the error collection file to the client.

[0070] Optionally, the error detection device can also detect whether the resource file includes a configuration file and a description document; if so, based on the target version information and the corresponding relationship, determine whether the target code matches the target software package, the configuration file and the description document; if they match, detect the resource file to obtain a third detection result. Add the third detection result to the error collection file, generate a new first error collection file, and send the first error collection file to the client.

[0071] The third detection result includes at least one of a format error, a file content error, and a parameter error of the resource file.

[0072] In the embodiment of the present invention, the corresponding relationship may be a corresponding relationship between the target version information and the target software package, and a corresponding relationship between the target software package and the configuration file and the description document.

[0073] It can be understood that the error detection device detects whether the version information of all files matches, ensuring that the version number of the target code and the target software package is consistent with the version declared in the description document or configuration file. Different versions of code files correspond to different software packages; different software packages must be consistent with the versions declared in the description document or configuration file, thereby ensuring the compatibility between all files.

[0074] In some optional embodiments, the error detection device obtains a preset language processing algorithm; parses the resource file through the preset language processing algorithm to obtain at least one key field corresponding to the resource file; based on the at least one key field, detects whether there is a file content error in the resource file to obtain a first result; obtains the first name of the configuration file and the second name of the description document; based on the first name and the second name, detects whether there is a format error in the resource file to obtain a second result; based on at least one parameter information, detects whether there is a parameter error in the resource file to obtain a third result; based on the first result, the second result and the third result, obtains a third detection result.

[0075] Among them, the preset language processing algorithm can be a natural language processing algorithm.

[0076] In one example, an error detection device detects whether a target key field exists in at least one key field; if so, a first result is obtained that a resource file has a file content error; based on the first field at a preset position in the first name, a configuration file is detected to comply with a second preset format, and based on the second field at a preset position in the second name, a description document is detected to comply with a third preset format; if not, a second result is obtained that a format error exists in the resource file; and at least one parameter information is detected to comply with a preset parameter information set; if not, a third result is obtained that a parameter error exists in the resource file.

[0077] The target key field is any preset field included in the preset field set, and the file content error corresponds to the target key field.

[0078] The preset parameter information set is a set of preset parameter information required for running the code file corresponding to the target version information.

[0079] In the embodiment of the present invention, the second preset format may be an extensible markup language file format (ExtensibleMarkup Language File, XML) or an executable file format (Executable File, EXE).

[0080] In the embodiment of the present invention, the third preset format may be a text file format (Text File, TXT) or a document file format (Word Document File, DOC).

[0081] Optionally, the error detection device can also generate an abstract syntax tree corresponding to the code file; convert the abstract syntax tree into a graph, and analyze the code file based on the graph neural network, identify the function call relationship in the code file, and record the variable dependency relationship; based on the function call relationship and the variable dependency relationship, detect whether there are circular dependencies, undefined variables, and repeatedly defined variables or functions in the code file, obtain a fourth detection result, compare the difference between the fourth detection result and the first error collection file, and add the difference result to the first error collection file to generate a new second error collection file, and send the second error collection file to the client.

[0082] It can be understood that the second error collection file includes more errors than the first error collection file.

[0083] Furthermore, after receiving the second error collection file, the client may display all errors included in the second error collection file on the display interface, and based on all errors, display a solution corresponding to each error to correct or modify the content in the release package.

[0084] For example: For missing dependency errors, it is recommended to add the missing packages in the code file and ensure that they are installed correctly. For version incompatibility, it is recommended to update the file version or use a compatible version in the code. For unnecessary packages, it is recommended to remove the package from the code file and delete the corresponding information of the package from the resource file to reduce project complexity. For format errors, standard format examples are provided for reference. For missing parameters, it is recommended to add necessary parameters and provide default values. For unused variables in the code file, it is recommended to delete or comment out unused code. For logical errors, it is recommended that developers perform code unit testing to ensure that the code logic meets expectations. For potential null pointer exceptions in code files, it is recommended to perform non-null checks before using objects.

[0085] Based on the above Figure 3 The method can obtain the code file and target detection model corresponding to the release package; input the code file into the target detection model, and output the first detection result; and compare the first detection result with the preset detection result, and summarize the difference results of the comparison into the first detection result, so that the summarized second detection result can include more errors than the preset detection result. In addition, all errors of the resource files corresponding to the third detection result can also be summarized into an error collection file.

[0086] Compared with the related art in which the error collection file of the code file only includes the errors in the preset detection results, the implementation mode of the present invention can obtain all the errors of the code file and all the errors of the resource file, reduce the omissions and errors in the error detection corresponding to the release package, improve the detection efficiency, and at the same time improve the error detection accuracy of the release package.

[0087] In this embodiment, a release package error detection device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0088] This embodiment provides a release package error detection device, such as Figure 4 As shown, Figure 4 is a structural block diagram of an error detection device for a release package according to an embodiment of the present invention, the device comprising:

[0089] The acquisition module 401 is used to acquire the code file and target detection model corresponding to the release package.

[0090] The processing module 402 is used to input the code file into the target detection model and output a first detection result, wherein the first detection result includes at least one of syntax errors, semantic errors, logical structure errors and dependency errors between script units in the code file obtained by detecting the code file.

[0091] The processing module 402 is also used to compare the difference between the first detection result and the preset detection result, and summarize the difference results into the first detection result to obtain a second detection result corresponding to the code file, the second detection result includes at least one error, and the preset detection result includes at least one of the grammatical errors, semantic errors and logical structure errors obtained by detecting the code file.

[0092] The processing module 402 is further configured to generate an error collection file of the release package according to the second detection result, and send the error collection file to the client.

[0093] In some optional embodiments, the acquisition module 401 is specifically used to obtain an initial model and multiple historical code files, each historical code file includes multiple historical code units; split the multiple historical code files into N historical code units; parse the N historical code units, obtain annotation information corresponding to each of the N historical code units and the dependency relationship between the N historical code units, the annotation information is used to indicate whether each historical code unit has an anomaly; train the initial model based on the annotation information, N historical code units and the dependency relationship to obtain a target detection model, which has the function of detecting whether each code unit has an anomaly and whether the dependency relationship is correct.

[0094] In some optional implementations, the processing module 402 is further used to detect whether the code file includes the target code and the target software package on which the target code depends; if so, the code file is input into a preset code detection tool and a preset detection result is output.

[0095] In some optional implementations, the acquisition module 401 is further specifically used to obtain a release package in response to a user's operation of uploading a release package; when the release package is detected to be complete, the release package is parsed to obtain a parsing result, which includes a code file.

[0096] In some optional implementations, the acquisition module 401 is also specifically used to obtain the memory capacity required for the release package; detect whether the memory capacity is less than or equal to a first threshold; if the memory capacity is less than or equal to the first threshold, obtain the release package name of the release package, and detect whether the file format of the release package conforms to the first preset format based on the field at a preset position in the release package name; if the file format of the release package conforms to the first preset format, obtain the real hash value corresponding to the release package, compare the real hash value with the preset hash value, and detect whether the release package is complete; if the real hash value is consistent with the preset hash value, determine that the release package is complete.

[0097] In some optional implementations, the parsing result also includes a resource file; the processing module 402 is also used to detect whether the resource file includes a configuration file and a description document, the configuration file includes at least one parameter information required to run the code file, and the description document includes the target version information of the release package and the description information of the target software package; if so, based on the target version information and the corresponding relationship, determine whether the target code matches the target software package, the configuration file and the description document; if they match, detect the resource file to obtain a third detection result, the third detection result includes at least one of a format error, a file content error and a parameter error of the resource file; add the third detection result to the error collection file, generate a new first error collection file, and send the first error collection file to the client.

[0098] In some optional implementations, the processing module 402 is also specifically used to obtain a preset language processing algorithm; parse the resource file through the preset language processing algorithm to obtain at least one key field corresponding to the resource file; based on the at least one key field, detect whether the resource file has a file content error to obtain a first result; obtain the first name of the configuration file and the second name of the description document; based on the first name and the second name, detect whether the resource file has a format error to obtain a second result; based on at least one parameter information, detect whether the resource file has a parameter error to obtain a third result; based on the first result, the second result and the third result, obtain a third detection result.

[0099] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0100] The error detection device for the release package in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0101] The embodiment of the present invention also provides a computer device having the above Figure 4 The error detection device of the release package is shown.

[0102] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.

[0103] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0104] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0105] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0106] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0107] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0108] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0109] Part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes but is not limited to source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.

[0110] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for detecting errors in a release package, characterized in that: The method comprises: Get the code files and target detection model corresponding to the release package; Inputting the code file into the target detection model, and outputting a first detection result, wherein the first detection result includes at least one of a syntax error, a semantic error, a logical structure error, and a dependency error between script units in the code file obtained by detecting the code file; Comparing the difference between the first detection result and the preset detection result, and summarizing the difference result into the first detection result, to obtain a second detection result corresponding to the code file, wherein the second detection result includes at least one error, and the preset detection result includes at least one of the syntax error, the semantic error, and the logical structure error obtained by detecting the code file; An error collection file of the release package is generated according to the second detection result, and the error collection file is sent to the client.

2. The method according to claim 1, characterized in that: The acquiring of the target detection model comprises: Acquire an initial model and a plurality of historical code files, each of the historical code files comprising a plurality of historical code units; Splitting the multiple historical code files into N historical code units; Parsing the N historical code units, obtaining annotation information corresponding to each of the N historical code units and dependency relationships between the N historical code units, wherein the annotation information is used to indicate whether each of the historical code units has an exception; The initial model is trained based on the annotation information, the N historical code units and the dependency relationship to obtain the target detection model, which has the function of detecting whether there is an anomaly in each of the code units and whether the dependency relationship is correct.

3. The method according to claim 1, characterized in that The method further comprises: Detecting whether the code file includes the target code and the target software package on which the target code depends; If yes, the code file is input into a preset code detection tool, and the preset detection result is output.

4. The method according to claim 3, characterized in that: The step of obtaining the code file corresponding to the release package includes: In response to a user's operation of uploading the publishing package, obtaining the publishing package; When it is detected that the release package is complete, the release package is parsed to obtain a parsing result, which includes the code file.

5. The method according to claim 4, characterized in that The detecting that the release package is complete includes: Obtaining the memory capacity required for the release package; Detecting whether the memory capacity is less than or equal to a first threshold; If the memory capacity is less than or equal to the first threshold, obtaining a publishing package name of the publishing package, and detecting whether a file format of the publishing package complies with a first preset format according to a field at a preset position in the publishing package name; In the case that the file format of the release package conforms to the first preset format, obtaining a real hash value corresponding to the release package, comparing the real hash value with the preset hash value, and detecting whether the release package is complete; If the real hash value is consistent with the preset hash value, it is determined that the release package is complete.

6. The method according to claim 4, characterized in that The parsing result also includes a resource file; the method also includes: Detecting whether the resource file includes a configuration file and a description document, wherein the configuration file includes at least one parameter information required to run the code file, and the description document includes target version information of the release package and description information of the target software package; If so, determining whether the target code matches the target software package, the configuration file, and the instruction document based on the target version information and the corresponding relationship; If a match is found, the resource file is detected to obtain a third detection result, wherein the third detection result includes at least one of a format error, a file content error, and a parameter error of the resource file; The third detection result is added to the error collection file to generate a new first error collection file, and the first error collection file is sent to the client.

7. The method according to claim 6, characterized in that The detecting the resource file to obtain a third detection result includes: Obtaining a preset language processing algorithm; Parsing the resource file by using the preset language processing algorithm to obtain at least one key field corresponding to the resource file; Based on the at least one key field, detecting whether the resource file has the file content error, and obtaining a first result; Obtaining a first name of the configuration file and a second name of the description document; Based on the first name and the second name, detecting whether the resource file has the format error, and obtaining a second result; Based on the at least one parameter information, detecting whether the resource file has the parameter error, and obtaining a third result; The third detection result is obtained based on the first result, the second result and the third result.

8. A device for detecting errors in a release package, characterized in that: The device comprises: The acquisition module is used to obtain the code files and target detection models corresponding to the release package; a processing module, configured to input the code file into the target detection model, and output a first detection result, wherein the first detection result includes at least one of a syntax error, a semantic error, a logical structure error, and a dependency error between script units in the code file obtained by detecting the code file; The processing module is further used to compare the difference between the first detection result and the preset detection result, and summarize the difference result into the first detection result to obtain a second detection result corresponding to the code file, wherein the second detection result includes at least one error, and the preset detection result includes at least one of the syntax error, the semantic error and the logical structure error obtained by detecting the code file; The processing module is further configured to generate an error collection file of the release package according to the second detection result, and send the error collection file to the client.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the error detection method for the release package described in any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the error detection method for a release package according to any one of claims 1 to 7.