Code detection rule configuration method, code detection method, equipment, storage medium and program product

By integrating functional modules in the development platform, automatically obtaining and configuring code detection plug-ins and rules, the problem of manual configuration and plug-in acquisition and installation in the existing technology is solved, and efficient code detection rule configuration and plug-in installation are achieved.

CN120045438APending Publication Date: 2025-05-27BEIJING 58 INFORMATION TTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510128088.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-27
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

In the prior art, code detection rules need to be manually configured and are less efficient. At the same time, the acquisition and installation of code detection plug-ins also require manual operations, resulting in inefficiency.

Method used

Integrate functional modules in the development platform, respond to code detection rules configuration operations, display the configuration interface, determine the target technology stack, and automatically obtain the target detection plug-in from the plug-in management platform, automatically obtain the target detection rules from the server, generate configuration files, and deploy plug-ins and configuration files on the development device.

Benefits of technology

It realizes the automatic acquisition of code detection plug-in and the automatic configuration of code detection rules, improves configuration efficiency, and improves installation efficiency through automated installation, supporting automatic acquisition and configuration of multi-tech stacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045438A_ABST
    Figure CN120045438A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a code detection rule configuration method, a code detection method, equipment, a storage medium and a program product, which are applied to a function module integrated in a development platform, and display a configuration interface in response to a code detection rule configuration operation. Based on a configuration operation in the configuration interface, determining a target technology stack corresponding to the to-be-detected code; obtaining a target detection plug-in corresponding to the target technology stack from the plug-in management platform, and obtaining a target detection rule corresponding to the target technology stack from the server; generating a configuration file based on the target technology stack and the corresponding target detection rule; deploying a target detection plug-in and a configuration file on the development equipment; the development equipment is used for running the target detection plug-in so as to detect the code corresponding to the target technology stack according to the target detection rule indicated in the configuration file. According to the scheme of the embodiment of the invention, automatic configuration of the code detection rule is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of software development, and in particular, to a method for configuring code detection rules, a code detection method, a device, a storage medium, and a program product. Background Art

[0002] During the software development process, in order to improve code quality, it is usually necessary to detect the code to help developers discover and fix problems in the code and ensure that the submitted code meets the preset style and standards. Generally, a code detection plugin is used to detect the code according to the code detection rules.

[0003] Currently, code detection rules are often implemented by manual configuration, with low efficiency. Summary of the Invention

[0004] Embodiments of the present application provide a method for configuring code detection rules, a code detection method, a device, a storage medium, and a program product to improve the efficiency of configuring code detection rules.

[0005] In a first aspect, an embodiment of the present application provides a method for configuring code detection rules, which is applied to a functional module integrated in a development platform, and the development platform runs on a development device, including:

[0006] Responding to a code detection rule configuration operation, displaying a configuration interface;

[0007] Based on the configuration operation in the configuration interface, determining a target technology stack corresponding to the code to be detected;

[0008] Obtaining a target detection plugin corresponding to the target technology stack from a plugin management platform, and obtaining a target detection rule corresponding to the target technology stack from a server;

[0009] Generating a configuration file based on the target technology stack and the corresponding target detection rule;

[0010] Deploying the target detection plugin and the configuration file on the development device; the development device is used to run the target detection plugin to detect the code corresponding to the target technology stack according to the target detection rule indicated in the configuration file.

[0011] In a second aspect, an embodiment of the present application provides a code detection method, which is applied to a development platform, and a functional module is integrated in the development platform, and the development platform runs on a development device, including:

[0012] Responding to a code detection operation, determining target code and a target technology stack corresponding to the target code;

[0013] Obtaining a configuration file deployed on the development device;

[0014] Find the target detection rule corresponding to the target technology stack from the configuration file;

[0015] Run the target detection plugin corresponding to the target technology stack deployed on the development device, and detect the target code according to the target detection rule; wherein, the configuration file is generated based on the target technology stack and the corresponding target detection rule, the target detection plugin is obtained by the functional module from the plugin management platform based on the target technology stack, and the target detection rule is obtained by the functional module from the server based on the target technology stack.

[0016] In a third aspect, an embodiment of the present application provides a computing device, including a storage component and a processing component; the storage component stores one or more computer program instructions, and the computer program instructions are called and executed by the processing component, and the processing component executes the one or more computer program instructions to implement the code detection rule configuration method as described in the first aspect or the code detection method as described in the second aspect.

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, and the computer program is executed by a computer to implement the code detection rule configuration method as described in the first aspect or the code detection method as described in the second aspect.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product storing a computer program, and when the computer program is executed by a computer, it implements the code detection rule configuration method as described in the first aspect or the code detection method as described in the second aspect.

[0019] The solution of the embodiment of the present application integrates a functional module in the development platform. By using this functional module, in response to a code detection rule configuration operation, a configuration interface can be displayed, and based on the configuration operation in the configuration interface, the target technology stack corresponding to the code to be detected can be determined. Using this functional module, the target detection plugin corresponding to the target technology stack can be automatically obtained from the plugin management platform, and the target detection rule corresponding to the target technology stack can be automatically obtained from the server. Based on the target technology stack and the corresponding target detection rule, a configuration file is generated, realizing the automatic acquisition of the code detection plugin and the automatic configuration of the code detection rule, and improving the configuration efficiency. Moreover, by using this functional module, the target detection plugin and the configuration file can also be deployed on the development device, realizing the automatic installation of the code detection plugin and improving the installation efficiency.

[0020] These aspects or other aspects of the present application will be more clearly understood in the following description of the embodiments. Description of the Drawings

[0021] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0022] Figure 1 Fig. shows a flowchart of an embodiment of a code detection rule configuration method provided by the present application;

[0023] Figure 2 Fig. shows a flowchart of an embodiment of a code detection method provided by the present application;

[0024] Figure 3 Fig. shows a schematic diagram of the architecture of a code detection rule configuration system in an actual application;

[0025] Figure 4 Fig. shows a schematic structural diagram of an embodiment of a code detection rule configuration device provided by the present application;

[0026] Figure 5 Fig. shows a schematic structural diagram of an embodiment of a code detection device provided by the present application;

[0027] Figure 6 Fig. shows a schematic structural diagram of an embodiment of a computing device provided by the present application. Detailed implementation manners

[0028] In order to enable those skilled in the art of the present technology to better understand the solutions of the present application, the following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application.

[0029] In some processes described in the specification, claims and the above-mentioned drawings of the present application, a plurality of operations appear in a specific order. However, it should be clearly understood that these operations can be executed not in the order in which they appear in this text or in parallel. The operation numbers such as 101, 102, etc. are only used to distinguish different operations, and the numbers themselves do not represent any execution order. In addition, these processes can include more or fewer operations, and these operations can be executed in sequence or in parallel. It should be noted that the descriptions such as "first", "second", etc. in this text are used to distinguish different messages, devices, modules, etc., and do not represent a sequence, nor do they limit that "first" and "second" are of different types.

[0030] The technical solution of the embodiment of the present application is applicable to development scenarios, especially in the front-end development scenario. Front-end development refers to the process of creating front-end interfaces such as WEB (World Wide Web) pages or APPs (applications) and presenting them to users, realizing the interaction and experience between Internet products and user interfaces, which is usually implemented by technologies such as HTML (Hyper Text Markup Language), CSS (Cascading Style Sheets), and JavaScript (a dynamic programming language). In front-end development, for example, JavaScript code used in front-end development is usually detected by using an ESLint plugin (a code detection tool for identifying and reporting problems in JavaScript code, which helps developers follow consistent coding styles and specifications), in accordance with ESLint rules (rules executed by the ESLint plugin, which define the formats and conventions that JavaScript code should follow, such as format-related rules, code quality-related rules, etc. Format-related rules can include, for example, code line break styles, and code quality-related rules can include, for example, code statement disabling rules).

[0031] As described in the foregoing background art section, currently, code detection rules often adopt manual configuration to implement, and code detection plugins often need to be manually obtained and installed from the plugin management platform, with low efficiency.

[0032] To improve the configuration efficiency, the inventor considered that if the front-end scaffolding (a tool for quickly building and starting front-end projects) is used and code detection rules are preset inside the scaffolding, the problem of manual configuration can be solved. However, in actual applications, different development projects may adopt different technology stacks for implementation, and different technology stacks often use different code detection plugins and rules for code detection. Limited by the structure and characteristics of the front-end scaffolding, only code detection rules for a single technology stack can be set inside the scaffolding, which cannot meet the detection requirements of multi-technology stack project development.

[0033] Based on this, the inventor conducted a series of thoughts and experiments, and proposed the technical solution of this application, which is applied to the functional module integrated in the development platform. The development platform runs on the development device and includes: responding to the code detection rule configuration operation, displaying a configuration interface; based on the configuration operation in the configuration interface, determining the target technology stack corresponding to the code to be detected; according to the correspondence between the technology stack and the acquisition address, searching for the target acquisition address corresponding to the target technology stack, and according to the target acquisition address, acquiring the target detection plug-in and the target detection rule corresponding to the target technology stack; generating a configuration file based on the target technology stack and the corresponding target detection rule; deploying the target detection plug-in and the configuration file on the development device; the development device is used to run the target detection plug-in to detect the code corresponding to the target technology stack according to the target detection rule indicated in the configuration file.

[0034] By integrating a functional module in the development platform, with the use of this functional module, it can respond to the code detection rule configuration operation, display a configuration interface, and based on the configuration operation in the configuration interface, determine the target technology stack corresponding to the code to be detected. Using this functional module, it can automatically obtain the target detection plug-in corresponding to the target technology stack from the plug-in management platform, and automatically obtain the target detection rule corresponding to the target technology stack from the server. Based on the target technology stack and the corresponding target detection rule, a configuration file is generated, realizing the automatic acquisition of the code detection plug-in and the automatic configuration of the code detection rule, improving the configuration efficiency. Moreover, with the use of this functional module, it can also deploy the target detection plug-in and the configuration file on the development device, realizing the automatic installation of the code detection plug-in and improving the installation efficiency. In addition, this functional module can be set to support the recognition of multiple technology stacks. Therefore, by using this functional module, the target technology stack can be recognized, the corresponding code detection plug-in can be obtained from the plug-in management platform, and the corresponding code detection rule can be obtained from the server. Thus, it can realize the automatic acquisition of the code detection plug-ins and rules corresponding to different technology stacks, meeting the detection requirements of multi-technology stack projects.

[0035] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative efforts belong to the scope of protection of the present application.

[0036] The technical solution of the embodiment of the present application can be applied to a system architecture including a development platform and a server. A connection is established between the development platform and the server through a network. The network provides a medium for the communication link between the development platform and the server. The network can include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0037] Through the network, the development platform can interact with the server to obtain code detection rules, etc.

[0038] Optionally, the system architecture further includes a plugin management platform. A connection is established between the development platform and the plugin management platform through a network. Through the network, the development platform can interact with the plugin management platform to obtain code detection plugins, etc.

[0039] Among them, the development platform can be integrated with functional modules. The development platform refers to a platform that provides various tools and resources to help developers quickly and efficiently develop application programs. The development platform can be a browser, an APP (Application), or a web application such as an H5 (HyperText Markup Language5) application, or a light application (also known as a mini program, a lightweight application program), or a cloud application, etc. The development platform can be deployed in an electronic device and needs to rely on the device or certain apps in the device to run, etc. The electronic device can, for example, have a display screen and support information browsing, etc., such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. For the sake of understanding, various other types of applications can usually be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0040] In a practical application, the electronic device can refer to the electronic device used by the development user and can be called a development device.

[0041] The server can include servers that provide various services, such as servers that store code detection rules, etc.

[0042] The plugin management platform can also include servers that provide various services, such as servers that store code detection plugins, etc.

[0043] It should be noted that both the server and the plugin management platform can be implemented as a distributed server cluster composed of multiple servers, or can be implemented as a single server. The server can also be a server of a distributed system, or a server combined with a blockchain. The server can also be a cloud server, or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology.

[0044] It should be noted that the code detection rule configuration method provided in the embodiments of the present application is generally executed by a functional module integrated on a development platform, and the code detection method is generally executed by the development platform.

[0045] It should be noted that the embodiments of the present application may involve the use of user data. In practical applications, user-specific personal data can be used in the solutions described herein within the scope permitted by applicable laws and regulations, provided that the requirements of the applicable laws and regulations of the country where the user is located are met (for example, the user gives clear consent, and the user is effectively notified, etc.).

[0046] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties. The collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.

[0047] It should be noted that the technical solutions of the embodiments of the present application are applicable to a network virtual environment. The users described generally refer to "virtual users". Real users can register user accounts on the server side through registration to obtain user identities in the network environment.

[0048] As Figure 1 shown, it is a flowchart of an embodiment of a code detection rule configuration method provided by the present application, which can be executed by a functional module integrated in a development platform, and the development platform runs on a development device. The method may include the following steps:

[0049] 101: In response to a code detection rule configuration operation, display a configuration interface.

[0050] Among them, the code detection rule configuration operation may be a trigger operation by the developer in the user interface of the development platform, such as a configuration command input operation, a configuration control confirmation operation, etc. In response to this configuration operation, a configuration interface can be displayed in the user interface.

[0051] 102: Based on the configuration operation in the configuration interface, determine the target technology stack corresponding to the code to be detected.

[0052] In the embodiments of the present application, the technology stack may, for example, include ES6 (ECMAScript 6.0, the next-generation standard of a JavaScript language), node (a JavaScript runtime environment based on the Chrome V8 engine (a Google open-source JavaScript engine)), react (a JavaScript library for building user interfaces, mainly used for building web applications, especially SPAs (single page web applications)), react-native (compared with react, focuses on building native mobile applications and supports iOS and Android platforms), vue (a JavaScript framework for building user interfaces), etc. The settings can be made according to actual development needs.

[0053] During the configuration process, based on the configuration operations, the target technology stack corresponding to the code to be detected can be determined. Among them, the configuration operations in the configuration interface may, for example, include input operations, selection operations, etc. The target technology stack may include one or more technology stacks, and the settings can be made according to actual development needs.

[0054] It should be noted that based on the characteristics of each technology stack, usually one of the ES6 and node technology stacks is selected for configuration, and usually one of the react, react-native, and vue technology stacks is selected for configuration. For example, two technology stacks, ES6 and react, can be configured, or two technology stacks, node and vue, can be configured, and so on.

[0055] 103: Obtain the target detection plugin corresponding to the target technology stack from the plugin management platform, and obtain the target detection rule corresponding to the target technology stack from the server.

[0056] In practical applications, different technology stacks may correspond to different code detection plugins. Taking the ESLint plugin as an example, the code detection plugin corresponding to the ES6 technology stack can be eslint-plugin-import, the code detection plugins corresponding to the node technology stack can be eslint-plugin-import and eslint-plugin-node, the code detection plugins corresponding to the react technology stack can be eslint-plugin-react and eslint-plugin-jsx-a11y, the code detection plugin corresponding to the react-native technology stack can be eslint-plugin-react-native, and the code detection plugin corresponding to the vue technology stack can be eslint-plugin-vue.

[0057] Among them, the plugin management platform can refer to NPM (Node Package Manager, a NodeJS package management and distribution tool), and the plugin management platform can support the acquisition of code detection plugins corresponding to multiple technology stacks. The server can refer to the server corresponding to front-end development, and the server can store code detection rules corresponding to multiple technology stacks. Among them, the code detection rules stored in the server can include general detection rules and custom detection rules. The general detection rule can be, for example, eslint-config-airbnb (the front-end coding specification defined by Airbnb), and the custom detection rule can be eslint-config-escfe.

[0058] Optionally, the code detection rules in the server, such as custom detection rules, can be generated and uploaded by one or more development users. The development users can refer to the members of the project development team to meet the rule configuration needs of different members in the team and improve the personalized configuration of code detection rules.

[0059] In this embodiment, the functional module can support the identification and response of multiple technology stacks, so that it can automatically obtain the target detection plugin corresponding to the target technology stack from the plugin management platform and automatically obtain the target detection rule corresponding to the target technology stack from the server according to the target technology stack specified by the development user.

[0060] 104: Generate a configuration file based on the target technology stack and the corresponding target detection rule.

[0061] 105: Deploy the target detection plugin and the configuration file on the development device.

[0062] Specifically, the functional module can automatically install the obtained target detection plugin on the development device and automatically store the configuration file in the code file corresponding to the development project. Among them, the target detection rule can be stored in the root directory of the development project. Optionally, when the general detection rule in the target detection rule is inconsistent with the custom detection rule, the custom detection rule can be automatically replaced with the corresponding general detection rule to meet the personalized coding requirements.

[0063] Thus, the development device can be used to run the target detection plugin to detect the code corresponding to the target technology stack according to the target detection rule indicated in the configuration file.

[0064] In this embodiment, by integrating a functional module in the development platform, the functional module can, in response to a code detection rule configuration operation, display a configuration interface, and based on the configuration operation in the configuration interface, determine the target technology stack corresponding to the code to be detected. The functional module automatically obtains the target detection plugin corresponding to the target technology stack from the plugin management platform, and automatically obtains the target detection rule corresponding to the target technology stack from the server, and generates a configuration file based on the target technology stack and the corresponding target detection rule, realizing the automatic acquisition of the code detection plugin and the automatic configuration of the code detection rule, and improving the configuration efficiency. Moreover, by using the functional module, the target detection plugin and the configuration file can also be deployed on the development device, realizing the automatic installation of the code detection plugin and improving the installation efficiency.

[0065] In some embodiments, in response to a code detection rule configuration operation, displaying the configuration interface may include:

[0066] In response to a preset command character input in the user interface of the development platform, display a command line interface in the user interface.

[0067] At this time, based on the configuration operation in the configuration interface, determining the target technology stack corresponding to the code to be detected may include:

[0068] Based on the technology stack identification information input in the command line interface, determine the target technology stack corresponding to the code to be detected.

[0069] For example, the preset command character may be "entry" and can be set according to actual needs. For example, based on the "ES6" identification information input in the command line interface, the functional module can determine that the target technology stack is the ES6 technology stack, and thus automatically obtain the code detection plugin corresponding to the ES6 technology stack from the plugin management platform, and automatically obtain the code detection rule corresponding to the ES6 technology stack from the server.

[0070] By adopting a unified command line configuration method, only by inputting the technology stack identification information in the command line interface, the determination of the target technology stack can be realized, and then the automatic acquisition and configuration of the target detection plugin and the target detection rule can be realized, simplifying the configuration operation and improving the configuration efficiency.

[0071] In practical applications, the code used in front-end development may involve static type code. When detecting this type of code, code parsing is usually performed first, and then the parsed code is detected. Therefore, in some embodiments, the above configuration method may further include:

[0072] Judge whether the code to be detected includes static type code;

[0073] If so, obtain the static code detection plugin and the parsing tool from the plugin management platform.

[0074] Among them, static-typed code can refer to TypeScript (an open-source programming language developed by Microsoft, built by adding static type definitions on top of JavaScript). The code detection plugin corresponding to TypeScript code (hereinafter referred to as the static code detection plugin) can be, for example, eslint-plugin-typescript, and the parsing tool can be, for example, @typescript-eslint / parser.

[0075] On this basis, generating a configuration file based on the target technology stack and the corresponding target detection rules may include:

[0076] Generate a configuration file based on the target technology stack, the corresponding target detection rules, the static code detection rules, and the association information of the parsing tool. The association information can include, for example, the parsed code version, the code file or directory to be parsed, etc., which can be set according to the actual development scenario.

[0077] At this time, the above method may further include:

[0078] Deploy the static code detection plugin and the parsing tool on the development device.

[0079] Among them, the development device can also be used to parse static-typed code using the parsing tool and run the static code detection plugin to detect the parsed code according to the target detection rules indicated in the configuration file.

[0080] Optionally, if it is determined that the code to be detected does not include static-typed code, the above operations do not need to be performed.

[0081] By determining whether the code to be detected includes static-typed code, and when the determination result is yes, automatically obtaining the corresponding code detection plugin and the parsing tool from the plugin management platform using the functional module and automatically deploying them on the development device, the automatic acquisition and installation of the code detection plugin and the parsing tool corresponding to the static-typed code are realized, without the need for the development user to manually obtain and install, improving the acquisition and installation efficiency.

[0082] In front-end development, the code detection rules can also be updated. Therefore, in some embodiments, the above method may further include:

[0083] Deploy a hook plugin on the development device.

[0084] Among them, the development device can be used to run a hook plugin to detect whether there is an update to the target detection rule. In the case of an update, obtain the updated target detection rule, and run the target detection plugin to detect the code corresponding to the target technology stack according to the updated target detection rule.

[0085] In this embodiment, the hook plugin can be used to automatically detect whether there is an update to the target detection rule on the server before the code detection plugin runs. In the case of an update, obtain the updated target detection rule from the server. The hook plugin can be the pre-commit-eslint tool. Specifically, it can detect whether there is an update according to the version identification information of the code detection rule, the time uploaded to the server, etc. This application does not limit this.

[0086] Optionally, the updated code detection rule can be uploaded to the server by one or more development users in the development project team, and the code detection rule can be updated according to the actual development needs.

[0087] By deploying the hook plugin, the automatic detection of the update of the code detection rule in the server is realized. In the case of an update, the updated target detection rule is automatically obtained, and then the automatic update of the code detection rule can be realized after one code detection plugin, so that the target detection plugin can detect the code according to the updated target detection rule, ensuring that the code to be detected meets the real-time development needs and improving the update efficiency of the code detection rule.

[0088] The foregoing one or more embodiments have described the configuration process of the code detection plugin and the rule. Next, the code detection process will be described.

[0089] As Figure 2 shown, it is a flowchart of an embodiment of a code detection method provided by this application, which can be applied to a development platform. The development platform integrates functional modules, and the development platform runs on a development device. The method can include the following steps:

[0090] 201: In response to a code detection operation, determine the target code and the target technology stack corresponding to the target code.

[0091] Among them, the code detection operation can, for example, refer to the submission operation of the development user for the project development code.

[0092] 202: Obtain the configuration file deployed on the development device.

[0093] Among them, the configuration file is generated based on the target technology stack and the corresponding target detection rules. The target detection plugin is automatically obtained by the functional module from the plugin management platform based on the target technology stack and automatically deployed on the development device. The target detection rules are obtained by the functional module from the server based on the target technology stack. The specific implementation has been described in the corresponding embodiments shown in Figure 1 and will not be elaborated here.

[0094] 203: Search for the target detection rules corresponding to the target technology stack in the configuration file.

[0095] 204: Run the target detection plugin corresponding to the target technology stack deployed on the development device, and detect the target code according to the target detection rules.

[0096] In this embodiment, the development platform can, in response to the code detection operation, determine the target code and the target technology stack corresponding to the target code, obtain the configuration file deployed on the development device, and search for the target detection rules corresponding to the target technology stack therein, so as to run the target detection plugin corresponding to the target technology stack deployed on the development device and detect the target code according to the target detection rules. By integrating the functional module in the development platform, using this functional module, in response to the code detection rule configuration operation, a configuration interface can be displayed, and based on the configuration operations in the configuration interface, the target technology stack corresponding to the code to be detected can be determined. Using this functional module, the target detection plugin corresponding to the target technology stack can be automatically obtained from the plugin management platform, and the target detection rules corresponding to the target technology stack can be automatically obtained from the server. Based on the target technology stack and the corresponding target detection rules, a configuration file is generated, realizing the automatic acquisition of the code detection plugin and the automatic configuration of the code detection rules, improving the configuration efficiency. Moreover, using this functional module, the target detection plugin and the configuration file can also be deployed on the development device, realizing the automatic installation of the code detection plugin and improving the installation efficiency.

[0097] In some embodiments, if the target code includes static-type code, the above detection method may further include:

[0098] Run the parsing tool deployed on the development device to parse the static-type code, and run the static code detection plugin deployed on the development device to detect the parsed code according to the target detection rules. Thus, the code detection of the static-type code is realized.

[0099] In some embodiments, before running the target detection plugin corresponding to the target technology stack deployed on the development device to detect the target code according to the target detection rules, the above method may further include:

[0100] Run the hook plugin deployed on the development device to detect whether there is an update to the target detection rules;

[0101] If so, obtain the updated target detection rules from the server.

[0102] On this basis, running the target detection plugin corresponding to the target technology stack deployed on the development device to detect the target code according to the target detection rules may include:

[0103] Run the target detection plugin corresponding to the target technology stack deployed on the development device to detect the target code according to the updated target detection rules. Thus, the code is detected according to the updated target detection rules, ensuring that the code to be detected meets the real-time development requirements.

[0104] For ease of understanding, the following will be combined with Figure 3 the shown system architecture diagram to illustrate the technical solution of the present application. As Figure 3 shown, the system architecture may include a development platform (not shown in the figure), on which a function module 31 and other development modules, a plugin management platform 32 and a server 33 are integrated. The present application does not limit this.

[0105] Among them, the function module 31 supports the identification and configuration of multiple types of technology stacks. As shown in the figure, it includes ES6, node, react, react-native, and vue technology stacks. The function module 31 responds to the code detection rule configuration operation, displays a command-line interface, determines the target technology stack based on the technology stack identification information input by the development user in the command-line interface, and sends a plugin acquisition request to the plugin management platform 32 to obtain the corresponding target detection plugin from the plugin management platform 32, and sends a rule acquisition request to the server 33 to obtain the corresponding code detection rules from the server 33. Generate a configuration file based on the target technology stack and the corresponding target detection rules, and automatically deploy the target detection plugin and the configuration file on the development device.

[0106] By integrating the function module in the development platform, using this function module, in response to the code detection rule configuration operation, a configuration interface can be displayed, and based on the configuration operation in the configuration interface, the target technology stack corresponding to the code to be detected can be determined. Using this function module, the target detection plugin corresponding to the target technology stack can be automatically obtained from the plugin management platform, and the target detection rules corresponding to the target technology stack can be automatically obtained from the server. Based on the target technology stack and the corresponding target detection rules, a configuration file is generated, realizing the automatic acquisition of the code detection plugin and the automatic configuration of the code detection rules, improving the configuration efficiency. Moreover, using this function module, the target detection plugin and the configuration file can also be deployed on the development device, realizing the automatic installation of the code detection plugin and improving the installation efficiency.

[0107] Optionally, the function module 31 can also determine whether the code to be detected includes static-typed code. When the determination result is yes, it automatically obtains the corresponding code detection plug-in and parsing tool from the plug-in management platform 32 and automatically deploys them on the development device, realizing the automatic acquisition and installation of the code detection plug-in and parsing tool corresponding to the static-typed code, without the need for the development user to manually obtain and install them, thus improving the acquisition and installation efficiency.

[0108] Optionally, the function module 31 can also deploy a hook plug-in on the development device to realize the automatic detection of the update of the code detection rules in the server. When there is an update, it automatically obtains the updated target detection rules so that the target detection plug-in can detect the code according to the updated target detection rules, ensuring that the code to be detected meets the real-time development requirements and improving the update efficiency of the code detection rules.

[0109] As Figure 4 shown, it is a schematic structural diagram of an embodiment of a code detection rule configuration device provided by the present application. The device may include the following units:

[0110] A display unit 401, configured to display a configuration interface in response to a code detection rule configuration operation;

[0111] A first determination unit 402, configured to determine the target technology stack corresponding to the code to be detected based on the configuration operation in the configuration interface;

[0112] A first acquisition unit 403, configured to acquire a target detection plug-in corresponding to the target technology stack from the plug-in management platform and acquire a target detection rule corresponding to the target technology stack from the server;

[0113] A generation unit 404, configured to generate a configuration file based on the target technology stack and the corresponding target detection rules;

[0114] A first installation unit 405, configured to deploy the target detection plug-in and the configuration file on the development device; the development device can be used to run the target detection plug-in to detect the code corresponding to the target technology stack according to the target detection rules indicated in the configuration file.

[0115] In some embodiments, the device may further include:

[0116] A judgment unit, configured to judge whether the code to be detected includes static-typed code;

[0117] A second acquisition unit, configured to acquire a static code detection plug-in and a parsing tool from the plug-in management platform when the result of the judgment unit is yes;

[0118] A generating unit 404, which can be specifically used to generate a configuration file based on a target technology stack, corresponding target detection rules, and association information of a parsing tool;

[0119] The apparatus may further include:

[0120] A second installation unit, configured to deploy a static code detection plugin and a parsing tool on a development device; the development device can also be used to parse static-type code using the parsing tool and run the static code detection plugin to detect the parsed code according to the target detection rules indicated in the configuration file.

[0121] In some embodiments, the apparatus may further include:

[0122] A third installation unit, configured to deploy a hook plugin on a development device; the development device can also be used to run the hook plugin to detect whether there is an update to the target detection rules, and in the case of an update, obtain the updated target detection rules from a server, and run a target detection plugin to detect the code corresponding to the target technology stack according to the updated target detection rules.

[0123] In some embodiments, a display unit 401 can be specifically used to display a command-line interface in the user interface in response to a preset command character input in the user interface of the development platform;

[0124] A first determination unit 402 can be specifically used to determine a target technology stack corresponding to the code to be detected based on the technology stack identification information input in the command-line interface.

[0125] Figure 4 The illustrated code detection rule configuration apparatus can be used to implement Figure 1 the illustrated code detection rule configuration method, and its implementation principle and technical effects will not be elaborated further. Among them, Figure 4 one or more units of the illustrated code detection rule configuration apparatus can constitute functional modules in the above system architecture. For the code detection rule configuration apparatus in the above embodiments, the specific manners in which each unit performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.

[0126] As Figure 5 shown, it is a schematic structural diagram of an embodiment of a code detection apparatus provided by the present application. The apparatus may include the following units:

[0127] A second determination unit 501, configured to determine target code and a target technology stack corresponding to the target code in response to a code detection operation;

[0128] A third acquisition unit 502, configured to acquire a configuration file deployed on a development device;

[0129] A search unit 503, configured to search for a target detection rule corresponding to a target technology stack from a configuration file;

[0130] A first detection unit 504, configured to run a target detection plugin corresponding to the target technology stack deployed on a development device, and detect target code according to the target detection rule; wherein, the configuration file is generated based on the target technology stack and the corresponding target detection rule, the target detection plugin is obtained by a functional module from a plugin management platform based on the target technology stack, and the target detection rule is obtained by the functional module from a server based on the target technology stack.

[0131] In some embodiments, the apparatus may further include:

[0132] A second detection unit, configured to run a hook plugin deployed on a development device to detect whether there is an update to the target detection rule;

[0133] A fourth acquisition unit, configured to obtain an updated target detection rule from a server when the result of the second detection unit indicates that there is an update to the target detection rule;

[0134] The first detection unit 504 may specifically be configured to run a target detection plugin corresponding to the target technology stack deployed on a development device, and detect target code according to the updated target detection rule.

[0135] Figure 5 The illustrated code detection apparatus can be used to implement Figure 2 The illustrated code detection method, and its implementation principle and technical effects will not be elaborated herein. Among them, Figure 5 One or more units of the illustrated code detection apparatus may constitute a development platform in the above system architecture. For the code detection apparatus in the above embodiments, the specific manners in which each unit performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.

[0136] As Figure 6 shown, a structural schematic diagram of an embodiment of a computing device provided in this application, the device may include a storage component 601 and a processing component 602;

[0137] The storage component 601 may be configured to store one or more computer program instructions, wherein the one or more computer program instructions are called and executed by the processing component 602 to implement Figure 1 The illustrated code detection rule configuration method, or Figure 2 The illustrated code detection method.

[0138] Of course, the above computing device may certainly further include other components, such as an input / output interface, a communication component, etc.

[0139] The input / output interface provides an interface between the processing component and the peripheral interface module, and the peripheral interface module can be an output device, an input device, etc. The communication component is configured to facilitate communication between the computing device and other devices in a wired or wireless manner, etc.

[0140] It should be noted that the above computing device can be a physical device or an elastic computing host provided by a cloud computing platform, etc. It can be implemented as a distributed cluster composed of multiple servers or terminal devices, or can be implemented as a single server or a single terminal device.

[0141] The above computing device can also be implemented as an electronic device. An electronic device can refer to a device used by a user and having functions such as Internet access, computing, and communication required by the user. For example, it can be a mobile phone, a tablet computer, a personal computer, a wearable device, etc. It can be understood that the above electronic device will necessarily also include other components such as a display component, an input / output interface, and a communication component, which will not be elaborated here.

[0142] In the above one or more embodiments, the processing component can include one or more processors to execute computer instructions to complete all or part of the steps in the above method. Of course, the processing component can also be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for executing the above method.

[0143] The storage component is configured to store various types of data to support the operation of the terminal. The storage component can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disc.

[0144] The display component can be an electroluminescent (EL) element, a liquid crystal display, or a microdisplay having a similar structure, or a retina-direct display or a similar laser scanning display.

[0145] The embodiment of the present application also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a computer, it can implement Figure 1 the code detection rule configuration method shown, or Figure 2 the code detection method shown. The computer-readable medium can be included in the computing device described in the above embodiments; or it can exist alone without being assembled into the computing device.

[0146] A computer-readable storage medium may, for example, be but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above, etc.

[0147] The embodiments of the present application also provide a computer program product, which includes a computer program carried on a computer-readable storage medium. When the computer program is executed by a computer, it can implement Figure 1 the code detection rule configuration method shown, or Figure 2 the code detection method shown.

[0148] In such an embodiment, the computer program may be downloaded and installed from a network, and / or installed from a removable medium. When the computer program is executed by a processor, it executes various functions defined in the system of the present application.

[0149] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described systems, apparatuses, and units can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.

[0150] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative labor.

[0151] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than limiting them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A code detection rule configuration method, characterized in that: Applicable to functional modules integrated in a development platform, which runs on a development device and includes: In response to the code detection rule configuration operation, display a configuration interface; Based on the configuration operation in the configuration interface, determine the target technology stack corresponding to the code to be detected; Acquire a target detection plug-in corresponding to the target technology stack from a plug-in management platform, and acquire a target detection rule corresponding to the target technology stack from a server; Generate a configuration file based on the target technology stack and corresponding target detection rules; The target detection plug-in and the configuration file are deployed on the development device; the development device is used to run the target detection plug-in to detect the code corresponding to the target technology stack according to the target detection rules indicated in the configuration file.

2. The method according to claim 1, characterized in that Also includes: Determine whether the code to be detected includes static type code; If yes, obtain the static code detection plug-in and parsing tool from the plug-in management platform; The generating of the configuration file based on the target technology stack and the corresponding target detection rule includes: Generate a configuration file based on the target technology stack and the corresponding target detection rules, and the associated information of the parsing tool; The method further comprises: The static code detection plug-in and the parsing tool are deployed on the development device; the development device is also used to use the parsing tool to parse the static type of code, and run the static code detection plug-in to detect the parsed code according to the target detection rules indicated in the configuration file.

3. The method according to claim 1, characterized in that Also includes: deploying the hook plugin on the development device; The development device is also used to run the hook plug-in to detect whether there is an update to the target detection rules, and if there is an update, obtain the updated target detection rules from the server, and run the target detection plug-in to detect the code corresponding to the target technology stack according to the updated target detection rules.

4. The method according to any one of claims 1 or 3, characterized in that: The target detection rule is generated by at least one development user and uploaded to the server.

5. The method according to claim 1, characterized in that In response to the code detection rule configuration operation, displaying the configuration interface includes: In response to a preset command character input in a user interface of the development platform, displaying a command line interface in the user interface; The determining, based on the configuration operation in the configuration interface, a target technology stack corresponding to the code to be detected comprises: Based on the technology stack identification information input in the command line interface, a target technology stack corresponding to the code to be detected is determined.

6. A code detection method, characterized in that: Applied to a development platform, the development platform integrates functional modules, the development platform runs on a development device, and includes: In response to the code detection operation, determining a target code and a target technology stack corresponding to the target code; Obtaining a configuration file deployed on the development device; Searching the configuration file for a target detection rule corresponding to the target technology stack; Run the target detection plug-in corresponding to the target technology stack deployed on the development device, and detect the target code according to the target detection rules; wherein the configuration file is generated based on the target technology stack and the corresponding target detection rules, the target detection plug-in is obtained by the functional module from the plug-in management platform based on the target technology stack, and the target detection rules are obtained by the functional module from the server based on the target technology stack.

7. The method according to claim 6, characterized in that Before running the target detection plug-in corresponding to the target technology stack deployed on the development device, the method further includes: Running the hook plug-in deployed on the development device to detect whether there is a target detection rule update; If yes, obtaining updated target detection rules from the server; The running of the target detection plug-in corresponding to the target technology stack deployed on the development device and detecting the target code according to the target detection rule includes: The target detection plug-in corresponding to the target technology stack deployed on the development device is run to detect the target code according to the updated target detection rule.

8. A computing device, characterized in that It comprises a storage component and a processing component; the storage component stores one or more computer program instructions, the computer program instructions are called and executed by the processing component, and the processing component executes the one or more computer program instructions to implement the code detection rule configuration method as described in any one of claims 1 to 5, or the code detection method as described in any one of claims 6 to 7.

9. A computer-readable storage medium, characterized in that: A computer program is stored, and the computer program is executed by a computer to implement the code detection rule configuration method according to any one of claims 1 to 5, or the code detection method according to any one of claims 6 to 7.

10. A computer program product, characterized in that A computer program is stored, and when the computer program is executed by a computer, the code detection rule configuration method according to any one of claims 1 to 5 or the code detection method according to any one of claims 6 to 7 is implemented.