CN112650663A - Code processing method, device, equipment and medium - Google Patents

Code processing method, device, equipment and medium Download PDF

Info

Publication number
CN112650663A
CN112650663A CN201910962474.7A CN201910962474A CN112650663A CN 112650663 A CN112650663 A CN 112650663A CN 201910962474 A CN201910962474 A CN 201910962474A CN 112650663 A CN112650663 A CN 112650663A
Authority
CN
China
Prior art keywords
code
codes
user
quality
row
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910962474.7A
Other languages
Chinese (zh)
Inventor
周静
马钊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN201910962474.7A priority Critical patent/CN112650663A/en
Publication of CN112650663A publication Critical patent/CN112650663A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Abstract

The application discloses a code processing method, a device, equipment and a medium, which are applied to the technical field of computers and used for realizing automatic distribution of quality detection results and improving the distribution efficiency of the quality detection results. The method specifically comprises the following steps: acquiring a code warehouse to be detected; performing quality detection on the code warehouse to obtain quality detection results of each row of problem codes in the code warehouse; submitting user identifications based on codes of all rows of problem codes, and respectively creating quality inspection authorized users; and respectively distributing the quality detection results of each row of problem codes to corresponding quality inspection authorized users. In this way, the code submitting user identification of each row of problem codes is obtained, the user identification is submitted based on the code of each row of problem codes, and the quality inspection authorized users are respectively created, so that the code detection platform can respectively distribute the quality detection results of each row of problem codes to the corresponding quality inspection authorized users, thereby realizing the automatic distribution of the quality detection results and improving the distribution efficiency of the quality detection results.

Description

Code processing method, device, equipment and medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a code processing method, apparatus, device, and medium.
Background
In recent years, with the continuous development of network technology and multimedia technology, various types of application software are produced, wherein the code quality of the application software is closely related to user experience, use safety and the like, and the application software is gradually an important factor for evaluating the application software.
In order to implement detection of code quality of application software, a code detection platform is proposed in the prior art, which can detect various code problems such as repeated codes, bugs, errors and the like existing in source codes of application software, and developers can modify the source codes according to the code problems detected by the code detection platform to implement quality optimization of the source codes.
At present, how to realize automatic distribution of a code quality detection result by a code detection platform and improve distribution efficiency of the code quality detection result is a problem to be solved at present.
Disclosure of Invention
The embodiment of the application provides a code processing method, a code processing device, a code processing apparatus and a code processing medium, which are used for realizing automatic distribution of a code quality detection result by a code detection platform and improving the distribution efficiency of the code quality detection result.
The technical scheme provided by the embodiment of the application is as follows:
in one aspect, an embodiment of the present application provides a code processing method, including:
acquiring a code warehouse to be detected;
performing quality detection on the code warehouse to obtain a quality detection result of each row of problem codes in the code warehouse, wherein the problem codes are codes which cannot pass the quality detection;
code submission user identifications of all rows of problem codes are obtained, the user identifications are submitted based on the code submission user identifications of all rows of problem codes, and quality inspection authorized users are respectively established;
and respectively distributing the quality detection results of each row of problem codes to corresponding quality inspection authorized users.
In a possible implementation manner, after performing quality detection on the code repository to obtain a quality detection result of each row of problem codes in the code repository, the method further includes:
reading the code of the corresponding problem code from each row of problem codes and submitting the code to a user identifier;
and (4) associating the quality detection result of each row of problem codes with the code submitting user identification of each row of problem codes and storing the association in a quality detection result database.
In one possible implementation, obtaining the code submitting user identification of each row of question codes comprises:
and reading codes of each row of problem codes from the quality detection result database and submitting the codes to user identification.
In one possible implementation, obtaining the code submitting user identification of each row of question codes comprises:
and reading the code of the corresponding problem code from each row of problem codes and submitting the user identification.
In a possible implementation manner, before submitting user identifications based on codes of each row of problem codes and respectively creating quality inspection authorized users, the method further includes:
and determining that no quality inspection authorized user identification matched with the code submitting user identification of each row of problem codes exists in the currently stored quality inspection authorized user set.
In a possible implementation manner, before submitting user identifications based on codes of each row of problem codes and respectively creating quality inspection authorized users, the method further includes:
and submitting the codes of all rows of problem codes to user identification for deduplication processing.
In one possible implementation, submitting user identifications based on codes of all rows of question codes, and respectively creating quality inspection authorized users comprises the following steps:
and calling a user creation interface, submitting user identification as a login user name by using codes of all rows of problem codes, and respectively creating corresponding quality inspection authorized users.
In a possible implementation manner, when submitting user identifications based on codes of each row of problem codes and respectively creating quality inspection authorized users, the method further includes:
determining qualified codes of all rows in a code warehouse, wherein the qualified codes are codes passing quality detection;
and reading codes of corresponding qualified codes from all rows of qualified codes, submitting user identifications, submitting the user identifications based on the codes of all rows of qualified codes, and respectively creating quality inspection authorized users.
In a possible implementation manner, after the quality inspection authorized user is created, the method further includes:
and updating the quality inspection authorized user set based on the created quality inspection authorized user identification of each quality inspection authorized user.
In a possible implementation manner, after the quality inspection authorized user is created, the method further includes:
and updating the login time of each created quality inspection authorized user based on the current timestamp.
In another aspect, an embodiment of the present application provides a code processing apparatus, including:
the code acquisition unit is used for acquiring a code warehouse to be detected;
the code detection unit is used for carrying out quality detection on the code warehouse to obtain a quality detection result of each row of problem codes in the code warehouse, wherein the problem codes are codes which cannot pass the quality detection;
the user creating unit is used for acquiring codes of all rows of problem codes and submitting user identifications, submitting the user identifications based on the codes of all rows of problem codes, and respectively creating quality inspection authorized users;
and the result distribution unit is used for respectively distributing the quality detection results of the problem codes of all rows to corresponding quality inspection authorized users.
In a possible implementation manner, the code processing apparatus provided in an embodiment of the present application further includes:
and the associated storage unit is used for reading the codes of the corresponding problem codes from the problem codes of each row and submitting the codes of the corresponding problem codes to the user identification after the code detection unit performs quality detection on the code warehouse to obtain the quality detection results of the problem codes of each row in the code warehouse, and storing the quality detection results of the problem codes of each row and the code submission user identification of the problem codes of each row in the quality detection result database in an associated manner.
In a possible implementation manner, when the code for obtaining each row of question codes submits the user identifier, the user creating unit is specifically configured to:
and reading codes of each row of problem codes from the quality detection result database and submitting the codes to user identification.
In a possible implementation manner, when the code for obtaining each row of question codes submits the user identifier, the user creating unit is specifically configured to:
and reading the code of the corresponding problem code from each row of problem codes and submitting the user identification.
In a possible embodiment, before submitting the user identifications based on the codes of the rows of question codes and respectively creating the quality inspection authorized users, the user creating unit is further configured to:
and determining that no quality inspection authorized user identification matched with the code submitting user identification of each row of problem codes exists in the currently stored quality inspection authorized user set.
In a possible embodiment, before submitting the user identifications based on the codes of the rows of question codes and respectively creating the quality inspection authorized users, the user creating unit is further configured to:
and submitting the codes of all rows of problem codes to user identification for deduplication processing.
In a possible embodiment, when submitting user identifications based on codes of each row of problem codes and respectively creating quality inspection authorized users, the user creating unit is specifically configured to:
and calling a user creation interface, submitting user identification as a login user name by using codes of all rows of problem codes, and respectively creating corresponding quality inspection authorized users.
In a possible embodiment, when submitting user identifications based on codes of each row of problem codes and respectively creating quality inspection authorized users, the user creating unit is further configured to:
determining qualified codes of all rows in a code warehouse, wherein the qualified codes are codes passing quality detection;
and reading codes of corresponding qualified codes from all rows of qualified codes, submitting user identifications, submitting the user identifications based on the codes of all rows of qualified codes, and respectively creating quality inspection authorized users.
In a possible implementation manner, the code processing apparatus provided in an embodiment of the present application further includes:
and the user updating unit is used for updating the quality inspection authorized user set based on the quality inspection authorized user identification of each quality inspection authorized user created by the user creating unit after the quality inspection authorized user is created by the user creating unit.
In a possible implementation manner, the code processing apparatus provided in an embodiment of the present application further includes:
and the time updating unit is used for updating the login time of each quality control authorized user created by the user creating unit based on the current timestamp after the quality control authorized user is created by the user creating unit.
In another aspect, an embodiment of the present application provides a code processing apparatus, including: the code processing method comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the code processing method provided by the embodiment of the application is realized when the processor executes the computer program.
On the other hand, the embodiment of the present application further provides a computer-readable storage medium, where computer instructions are stored, and when the computer instructions are executed by a processor, the computer instructions implement the code processing method provided by the embodiment of the present application.
The beneficial effects of the embodiment of the application are as follows:
in the embodiment of the application, the code submitting user identification of each row of problem codes is obtained, the user identification is submitted based on the code of each row of problem codes, and the quality inspection authorized users are respectively created, so that the code detection platform can respectively distribute the obtained quality detection results of each row of problem codes to the corresponding quality inspection authorized users, thereby realizing the automatic distribution of the quality detection results and further improving the distribution efficiency of the quality detection results.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a system framework diagram of a code processing system in an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating an overview of a code processing method according to an embodiment of the present application;
FIG. 3A is a flowchart illustrating a code processing method according to an embodiment of the present application;
fig. 3B is a schematic diagram illustrating a distribution status change of a quality monitoring result in an embodiment of the present application;
FIG. 3C is a schematic view of a viewing interface of a quality detection result in an embodiment of the present application;
FIG. 4 is a flowchart illustrating a code processing method according to an embodiment of the present application;
FIG. 5 is a functional block diagram of a code processing apparatus according to an embodiment of the present application;
fig. 6 is a schematic hardware configuration diagram of a code processing apparatus in an embodiment of the present application.
Detailed Description
In order to make the present application better understood by those skilled in the art, technical terms mentioned in the present application will first be explained.
1. The code management platform is a platform for managing codes, and includes: GitLab, etc. Wherein, the GitLab is an open-source distributed version control system, and can manage the code, version and other related data of various projects such as application software.
The code submitting user, which is a user submitting code on the code management platform, may be, but is not limited to: the login user of the code management platform includes: the code submitting user may be: a login user of GitLab;
the code submits a user identifier, which is a user name of a login user of the code management platform, for example: the code submitting user identification may be, but is not limited to: username of login user of GitLab.
2. The code detection platform is a platform for performing quality detection on codes, and comprises the following steps: SonarQube et al. The SonarQube is an open-source code analysis platform, can detect quality problems such as repeated codes, obvious errors, potential bugs, coding specifications and the like in source codes of various projects such as application software and the like, and can be displayed through a Web UI.
The quality inspection authorized user is a login user of the code detection platform, for example: the quality control authorized user may be, but is not limited to: a logging user of SonarQube;
the quality inspection authorized user identifier is a user name of a login user of the code detection platform, for example: the quality control authorized user identification may be, but is not limited to: the user name of a login user of SonarQube;
the quality inspection authorized user set is a set of user names of all login users of the code detection platform, the quality inspection authorized user set can also record the recent login time of each login user, and can be stored in a list form, for example: the set of quality control authorized users may be, but is not limited to: the method comprises the steps of recording user names and latest login time of all login users of the SonarQube in a SonarQube authorized user list.
3. And the code warehouse is a set of all codes corresponding to various items such as application software. In the application, the code warehouse is a set of all codes corresponding to the item to be detected, which are obtained from the code management platform, wherein each line of codes contained in the code warehouse carries the codes of the line of codes to submit the user identification.
4. Problem codes are codes in the code warehouse that fail quality detection, such as: codes with significant errors, codes that do not conform to the encoding specification, codes with potential vulnerabilities, and the like.
5. And the qualified code is a code which passes the quality detection in the code warehouse.
6. The quality detection result database is used for storing quality detection results for the code detection platform, in the application, the quality detection result database at least stores the quality detection results of each row of problem codes in the code warehouse, and also stores a code problem record table for searching the quality detection results of each row of problem codes in the code warehouse, and the code problem record table at least records the following fields: the location index of the problem code in the code repository, the location index of the quality test result of the problem code in the quality test result database, the code submission user identification of the problem code, and the like.
It should be noted that, in the present application, the terms "first", "second", and the like are used for distinguishing similar objects, and are not necessarily used for describing a specific order or sequence. It is to be understood that such terms are interchangeable under appropriate circumstances such that the embodiments described herein are capable of operation in sequences other than those illustrated or otherwise described herein. Further, reference to "and/or" in this application describes an association relationship that associates objects, meaning that three relationships may exist, e.g., a and/or B, may represent: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
In order to make the purpose, technical solution and advantages of the present application more clearly and clearly understood, the technical solution in the embodiments of the present application will be described below in detail and completely with reference to the accompanying drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
At present, after a code detection platform performs quality detection on a code warehouse to be detected to obtain quality detection results of problem codes in each row in the code warehouse, the code detection platform displays the quality detection results of the problem codes in each row in the code warehouse in a form of a quality monitoring result list under the condition that developers corresponding to the code warehouse do not successfully log in the code detection platform, and after developers corresponding to the code warehouse need to select the quality detection results of the problem codes one by one from the quality monitoring result list, the corresponding problem codes can be modified and optimized according to the selected quality detection results. Obviously, the efficiency of the current processing method for the quality detection result is low, the user experience is poor, and how to realize the automatic distribution of the quality detection result under the condition of not successfully logging in the code detection platform is a problem to be solved at present.
To this end, an embodiment of the present application provides a code processing system, which is shown in fig. 1 and may include a code management platform 101 and a code detection platform 102, where the code management platform 101 and the code detection platform 102 are communicatively connected through a communication network 103. In practical application, each developer in the same project can upload part of the codes of the project written by each developer to the code management platform 101, the code management platform 101 takes the project as a dimension, stores part of the codes uploaded by each developer in the same project to the same code warehouse for management, for example, the code management platform 101 may periodically check the code repository for the project, check that a change has occurred in the code repository for the project, sending a code detection request to the code detection platform 102, when the code detection platform 102 receives the code detection request sent by the code management platform 101, the code warehouse corresponding to the item to be detected can be acquired from the code management platform 101, and by adopting the code processing method provided by the embodiment of the application, and performing quality detection, quality detection result distribution and other processing on the code warehouse corresponding to the project. Specifically, referring to fig. 2, before processing the code warehouse, the code detection platform 102 may be configured to allow the code detection platform 102 to read the code submitting user identifier, and then, when the code detection platform 102 processes the code warehouse, the quality detection may be performed on the code warehouse to obtain the quality detection result of each row of problem codes in the code warehouse, obtain the code submitting user identifier of each row of problem codes, submit the user identifier based on each row of problem codes, respectively create quality inspection authorized users, and respectively distribute the quality detection result of each row of problem codes to corresponding quality inspection authorized users. In this way, even under the condition of unsuccessfully logging in the code detection platform 102, the code detection platform 102 can submit the user identification by acquiring the codes of each row of problem codes, and submit the user identification based on the codes of each row of problem codes, and respectively create quality inspection authorized users, so that the code detection platform 102 can respectively distribute the obtained quality detection results of each row of problem codes to the corresponding quality inspection authorized users, thereby realizing the automatic distribution of the quality detection results, improving the distribution efficiency of the quality detection results, and effectively solving the problem that developers need to screen the quality detection results of the respective problem codes one by one from the quality monitoring result list under the condition of unsuccessfully logging in the code detection platform 102, thereby influencing the user experience.
It should be understood that the number of the code management platform 101, the code detection platform 102 and the communication network 103 in fig. 1 is only illustrative, and any number of the code management platform 101, the code detection platform 102 and the communication network 103 may be provided according to actual needs, and the present application is not limited thereto.
After introducing the application scenario and the design concept of the embodiment of the present application, the following describes a technical solution provided by the embodiment of the present application.
In the embodiment of the present application, before the code detection platform 102 is used to perform quality detection on the code repository and distribute the quality detection result, the code detection platform 102 needs to be configured to allow the code to be read from the code repository and submitted to the user identifier in advance in the configuration of the code detection platform 102. In this way, the code detection platform 102 may, during the process of performing quality detection on the code repository and distributing the quality detection result, submit the user identifier by reading the code corresponding to the code from each row of codes included in the code repository.
Further, after the code detection platform 102 is preconfigured, the code detection platform 102 may be used to perform quality detection on the code warehouse of the item to be detected and distribute a quality detection result, specifically, as shown in fig. 3A, a flow of the code processing method provided in the embodiment of the present application is as follows:
step 301: and acquiring a code warehouse to be detected.
In practical applications, the code management platform 101 may periodically check the code warehouse of each managed item, and when a code change in the code warehouse of a certain item is detected, the code detection platform 102 may be triggered to perform quality detection on the code warehouse of the item. More specifically, the code management platform 101 may carry information such as an item name of the item and/or a storage address of the code repository in the code detection request and send the code detection request to the code detection platform 102, so as to trigger the code detection platform 102 to perform quality detection on the code repository of the item, and further, the code management platform 101 may associate and store the item name of the item and/or the storage address of the code repository with a platform identifier of the code detection platform 102.
In specific implementation, when the code detection platform 102 receives a code detection request sent by the code management platform 101, the access interface of the code management platform 101 may be called and a Token (Token) is carried, so as to obtain a code warehouse to be detected from the code management platform 101. More specifically, the code detection platform 102 may generate a first Token based on the item name and/or the storage address carried in the code detection request by using a Token generation algorithm agreed with the code management platform 101 in advance, transmit the first Token and the platform identifier to the code management platform 101 by calling an access interface of the code management platform 101, after receiving the first Token and the platform identifier transmitted by the code detection platform 102, the code management platform 101 obtains the item name and/or the storage address associated with the platform identifier according to the platform identifier, and based on the obtained item name and/or the storage address, generate a second Token by using the Token generation algorithm agreed with the code management platform 101 in advance, determine that the first Token and the second Token are the same, obtain a corresponding code repository based on the obtained item name and/or the storage address, and returns the code repository to the code instrumentation platform 102 so that the code instrumentation platform 102 obtains the code repository to be tested.
Step 302: and performing quality detection on the code warehouse to obtain a quality detection result of each row of problem codes in the code warehouse.
In specific implementation, the code detection platform 102 may perform quality detection on each line of codes in the code repository from aspects of repeated codes, obvious errors, potential bugs, coding specifications, and the like, so as to obtain quality detection results of each line of problem codes in the code repository, where quality detection fails.
In practical application, in order to quickly and accurately retrieve the quality detection results of each row of problem codes in the code repository, after the code detection platform 102 performs quality detection on the code repository to obtain the quality detection results of each row of problem codes in the code repository, the code detection platform may further read the code submitting user identifier of the corresponding problem code from each row of problem codes in the code repository, and store the quality detection results of each row of problem codes and the code submitting user identifier of each row of problem codes in the quality detection result database in an associated manner. Further, the code detection platform 102 may also create a code problem record table for the code repository in the quality detection result database, and write information such as a position index of the problem code in the code repository, a position index of the quality detection result of the problem code in the quality detection result database, and a code submission user identifier of the problem code into a corresponding field of the code problem record table for each row of problem codes in the code repository for subsequent retrieval of the quality detection results of each row of problem codes in the code repository stored in the quality detection result database according to the code problem record table.
Step 303: and acquiring codes of all rows of problem codes, submitting user identifications, and respectively creating quality inspection authorized users based on the codes of all rows of problem codes.
In specific implementation, when the code detection platform 102 acquires the code of each row of problem codes and submits the user identifier, the following method may be adopted, but is not limited to:
the first mode is as follows: the code detection platform 102 reads the codes of each row of problem codes from the quality detection result database and submits the codes to the user identification. More specifically, the code detection platform 102 may retrieve the code submitting user identification field from the code problem record table stored in the quality detection result database, and read all the code submitting user identifications recorded under the code submitting user identification field, so that the code submitting user identifications of each row of problem codes may be obtained.
The second mode is as follows: the code detection platform 102 reads the code submitting user identification of the corresponding problem code from each row of problem codes, thereby obtaining the code submitting user identification of each row of problem codes.
In practical application, in order to reduce unnecessary resource waste and improve code processing efficiency, after obtaining the code submitting user identifications of each row of problem codes, the code detection platform 102 may also check whether a quality inspection authorized user identification matching with the code submitting user identification of each row of problem codes exists in the quality inspection authorized user set, and when determining that the quality inspection authorized user identification matching with the code submitting user identification of each row of problem codes exists in the quality inspection authorized user set, may directly distribute the quality detection results of each row of problem codes in the code warehouse to corresponding quality inspection authorized users based on the quality inspection authorized user identification matching with the code submitting user identification of each row of problem codes in the quality inspection authorized user set; otherwise, when it is determined that the quality inspection authorized user identification matched with the code submitting user identification of each row of problem codes does not exist in the quality inspection authorized user set, the user identifications are submitted based on the codes of each row of problem codes, and the quality inspection authorized users are respectively created.
In practical application, code submitting user identifications corresponding to each row of problem codes may be repeated, and therefore, in order to avoid repeated creation of quality inspection authorized users, after obtaining the code submitting user identifications of each row of problem codes, the code detection platform 102 may also perform deduplication processing on the code submitting user identifications of each row of problem codes first, and then create the quality inspection authorized users respectively based on the code submitting user identifications obtained after the deduplication processing. More specifically, the code detection platform 102 may invoke a user creation interface, submit a user identifier with each code as a login user name, and create corresponding quality control authorized users, respectively.
It should be noted that, in this embodiment of the application, when the code detection platform 102 creates the quality inspection authorized user, it may further obtain each row of qualified codes in the code repository, read the code of the corresponding qualified code from each row of qualified codes, submit the user identifier based on the code of each row of qualified codes, and create the quality inspection authorized users respectively. More specifically, after reading the code submitting user identifiers of the corresponding qualified codes from each row of qualified codes, the code detection platform 102 may also check whether a quality inspection authorized user identifier matching the code submitting user identifiers of each row of qualified codes exists in the quality inspection authorized user set, and may not process the code submitting user identifiers of each row of qualified codes when it is determined that the quality inspection authorized user identifier matching the code submitting user identifier of each row of qualified codes exists in the quality inspection authorized user set; otherwise, when it is determined that the quality inspection authorized user identification matched with the code submitting user identification of each row of qualified codes does not exist in the inspection quality inspection authorized user set, the code submitting user identification of each row of qualified codes can be subjected to deduplication processing, a user creating interface is called, and corresponding quality inspection authorized users are created respectively by taking each code submitting user identification obtained after deduplication processing as login user names. In this way, when the code submitting user that detects the qualified code submits the code again, the subsequent code detection platform 102 may automatically distribute the quality detection result of the code to the quality inspection authorized user corresponding to the code submitting user, thereby further improving the code processing efficiency.
Further, in order to ensure the accuracy and real-time performance of each quality inspection authorized user identifier recorded in the quality inspection authorized user set, after the code detection platform 102 creates the quality inspection authorized user, the code detection platform may further update the quality inspection authorized user set based on the created quality inspection authorized user identifier of each quality inspection authorized user.
In practical applications, for quality control authorized users who have not successfully logged in the code detection platform 102 recently, that is, for inactive users, the code detection platform 102 may not implement automatic distribution of quality monitoring results, and based on this, to ensure smooth distribution of quality detection results, after the code detection platform 102 creates a quality control authorized user, the login time of each created quality control authorized user may also be updated based on the current timestamp. More specifically, the code detection platform 102 may retrieve the login time field from the quality inspection authorized user set, and update the created login time of each quality inspection authorized user in the login time field according to the current timestamp, so that each created quality inspection authorized user becomes an active user, thereby ensuring smooth distribution of the quality detection result.
Step 304: and respectively distributing the quality detection results of each row of problem codes to corresponding quality inspection authorized users.
In practical application, after the code detection platform 102 distributes the quality detection results of each row of problem codes to the corresponding quality inspection authorized users, referring to fig. 3B, the quality detection results of each row of problem codes are switched from an undistributed state to a distributed state to the quality inspection authorized users. Further, since the code detection platform 102 uses the code submission user identifier in the code management platform 101 when creating the quality control authorized user, the user name of the code detection platform 102 is the same as the user name of the code management platform 101, based on which, the developer can determine the user name in the code management platform 101 as the user name in the code detection platform 102 and log in, so that, referring to fig. 3C, the developer can see the quality detection results of all problem codes distributed to the quality control authorized user by the code detection platform 102 in "my problem", and further, effectively solve the problem that the developer needs to filter the quality detection results of respective problem codes one by one from the quality monitoring result list under the condition of not successfully logging in the code detection platform 102, thereby affecting the user experience.
The following describes the code processing method provided in the embodiment in further detail with reference to a specific application scenario in which the code management platform 101 is a GitLab and the code detection platform 102 is a SonarQube.
In practical application, before using SonarQube to perform quality detection on a code repository and distribute a quality detection result, a setting item "sonar.
Further, after the SonarQube is preconfigured, the SonarQube can be used to perform quality detection on a code warehouse to be detected in the GitLab and distribute a quality detection result, specifically, as shown in fig. 4, a flow of the code processing method provided in the embodiment of the present application is as follows:
step 401: the code repository for each Git project managed is periodically checked by the GitLab.
Step 402: when the code in the code warehouse of a given Git project is checked to be changed, the GitLab carries information such as the project name of the given Git project and/or the storage address of the code warehouse in a code detection request and sends the code detection request to the SonarQube.
Step 403: and the GitLab stores the project name and/or the storage address of the code warehouse of the Git project in association with the platform identifier Sonar of the SonarQube.
Step 404: the SonarQube generates a first Token by using a Token generation algorithm agreed with GitLab in advance based on the item name and/or the storage address carried by the code detection request.
Step 405: the SonarQube transmits the first Token and the platform identification Sonar to the GitLab by calling the access interface of the GitLab.
Step 406: and the GitLab acquires the project name and/or the storage address associated with the platform identification from the stored association relation according to the platform identification Sonar transmitted by the sonarQube.
Step 407: and the GitLab generates a second Token by using a Token generation algorithm agreed with the GitLab in advance based on the acquired project name and/or storage address.
Step 408: and determining that the first Token and the second Token are the same by the GitLab, and acquiring a corresponding code warehouse based on the acquired project name and/or storage address.
Step 409: GitLab returns the obtained code repository to the SonarQube.
Step 410: and the SonarQube performs quality detection on the code warehouse to obtain the quality detection result of each row of problem codes in the code warehouse.
Step 411: the Sonar Qube reads the codes of the corresponding problem codes from the problem codes in each row of the code warehouse and submits the codes of the corresponding problem codes to the user identification, and the quality detection results of the problem codes in each row and the code submitting user identification of the problem codes in each row are stored in a Sonar detection result database in an associated mode.
Step 412: the sonarqbe creates a code problem record table (hereinafter referred to as issue table) for the code warehouse in the Sonar detection result database, and writes information such as a position index of the issue code in the code warehouse, a position index of a quality detection result of the issue code in the Sonar detection result database, a code submission user identifier of the issue code and the like into corresponding fields of the issue table for each row of issue codes of the code warehouse.
Step 413: SonarQube retrieves the code submission user identification field (hereinafter referred to as the author _ login field) from the issue table, and reads all code submission user identifications recorded under the author _ login field.
Step 414: and the SonarQube performs duplicate removal processing on all the read code submitting user identifications to obtain each code submitting user identification.
Step 415: SonarQube detects whether a quality inspection authorized user identifier (called a Sonar user identifier below) matched with each code submitting user identifier exists in a quality inspection authorized user set (called a Sonar user list below); if yes, go to step 416; if not, go to step 417.
Step 416: and the Sonar Qube distributes the quality detection results of each row of problem codes in the code warehouse to corresponding quality inspection authorized users respectively based on the Sonar user identifications matched with the code submitting user identifications in the Sonar user list.
Step 417: the SonarQube calls a user creation interface (for example, the user creation interface is/api/users/create interface), submits user identification as a login user name by using each code, and respectively creates corresponding quality control authorized users (hereinafter referred to as Sonar users).
It is worth mentioning that when the sonarqbe creates Sonar users, the Sonar qube can also submit user identifiers based on codes of qualified codes in each row in the code warehouse, and respectively create corresponding Sonar users, and the specific creation mode is the same as that described above, and repeated parts are not described again.
Step 418: the Sonar Qube updates the Sonar user list based on the created Sonar user identifications of the various Sonar users.
Step 419: the SonarQube retrieves the login time field (for example, the login time field is a last _ connection _ date field) from the Sonar user list, and updates the created login time of each Sonar user in the last _ connection _ date field according to the current timestamp.
Step 420: the Sonar Qube distributes the quality detection results of each line of problem codes in the code warehouse to corresponding Sonar users respectively based on each newly created Sonar user recorded in the Sonar user list.
Based on the foregoing embodiments, an embodiment of the present application provides a code processing apparatus, and referring to fig. 5, a code processing apparatus 500 provided in an embodiment of the present application at least includes:
a code obtaining unit 501, configured to obtain a code warehouse to be detected;
a code detection unit 502, configured to perform quality detection on the code repository to obtain a quality detection result of each row of problem codes in the code repository, where a problem code is a code that does not pass quality detection;
a user creating unit 503, configured to obtain codes of each row of problem codes and submit user identifiers, and submit user identifiers based on the codes of each row of problem codes, and create quality inspection authorized users respectively;
and the result distribution unit 504 is configured to distribute the quality detection results of each row of problem codes to corresponding quality inspection authorized users.
In a possible implementation manner, the code processing apparatus provided in an embodiment of the present application further includes:
and an associated storage unit 505, configured to, after the code detection unit 502 performs quality detection on the code repository to obtain quality detection results of each row of problem codes in the code repository, read a code submission user identifier of a corresponding problem code from each row of problem codes, and store the quality detection results of each row of problem codes and the code submission user identifier of each row of problem codes in an associated manner in a quality detection result database.
In a possible implementation manner, when the code for acquiring each row of question codes submits the user identifier, the user creating unit 503 is specifically configured to:
and reading codes of each row of problem codes from the quality detection result database and submitting the codes to user identification.
In a possible implementation manner, when the code for acquiring each row of question codes submits the user identifier, the user creating unit 503 is specifically configured to:
and reading the code of the corresponding problem code from each row of problem codes and submitting the user identification.
In a possible embodiment, before submitting user identifications based on codes of each row of problem codes and respectively creating quality inspection authorized users, the user creating unit 503 is further configured to:
and determining that no quality inspection authorized user identification matched with the code submitting user identification of each row of problem codes exists in the currently stored quality inspection authorized user set.
In a possible embodiment, before submitting user identifications based on codes of each row of problem codes and respectively creating quality inspection authorized users, the user creating unit 503 is further configured to:
and submitting the codes of all rows of problem codes to user identification for deduplication processing.
In a possible implementation manner, when submitting user identifications based on codes of each row of question codes and respectively creating quality inspection authorized users, the user creating unit 503 is specifically configured to:
and calling a user creation interface, submitting user identification as a login user name by using codes of all rows of problem codes, and respectively creating corresponding quality inspection authorized users.
In a possible embodiment, when submitting user identifications based on codes of each row of question codes and respectively creating quality inspection authorized users, the user creating unit 503 is further configured to:
determining qualified codes of all rows in a code warehouse, wherein the qualified codes are codes passing quality detection;
and reading codes of corresponding qualified codes from all rows of qualified codes, submitting user identifications, submitting the user identifications based on the codes of all rows of qualified codes, and respectively creating quality inspection authorized users.
In a possible implementation manner, the code processing apparatus provided in an embodiment of the present application further includes:
a user updating unit 506, configured to update the quality control authorized user set based on the quality control authorized user identifier of each quality control authorized user created by the user creating unit 503 after the user creating unit 503 creates the quality control authorized user.
In a possible implementation manner, the code processing apparatus provided in an embodiment of the present application further includes:
a time updating unit 507, configured to update the login time of each quality inspection authorized user created by the user creating unit 503 based on the current timestamp after the user creating unit 503 creates the quality inspection authorized user.
It should be noted that the principle of the code processing apparatus 500 provided in the embodiment of the present application for solving the technical problem is similar to that of the code processing method provided in the embodiment of the present application, and therefore, for implementation of the code processing apparatus 500 provided in the embodiment of the present application, reference may be made to implementation of the code processing method provided in the embodiment of the present application, and repeated details are not repeated.
After the code processing method and apparatus provided by the embodiment of the present application are introduced, a brief description is provided next for a code processing device provided by the embodiment of the present application.
The code processing apparatus provided in the embodiment of the present application may be a server corresponding to a code quality detection platform, and referring to fig. 6, the code processing apparatus 600 provided in the embodiment of the present application at least includes: the code processing method comprises a processor 601, a memory 602 and a computer program stored on the memory 602 and capable of running on the processor 601, wherein the code processing method provided by the embodiment of the application is realized when the processor 601 executes the computer program.
It should be noted that the code processing apparatus 600 shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments.
The code processing apparatus 600 provided by the embodiment of the present application may further include a bus 603 connecting different components (including the processor 601 and the memory 602). Bus 603 represents one or more of any of several types of bus structures, including a memory bus, a peripheral bus, a local bus, and so forth.
The Memory 602 may include readable media in the form of volatile Memory, such as Random Access Memory (RAM) 6021 and/or cache Memory 6022, and may further include Read Only Memory (ROM) 6023.
The memory 602 may also include a program means 6025 having a set (at least one) of program modules 6024, the program modules 6024 including, but not limited to: an operating subsystem, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The code processing apparatus 600 may also communicate with one or more external devices 604 (e.g., keyboard, remote control, etc.), with one or more devices that enable a user to interact with the code processing apparatus 600 (e.g., cell phone, computer, etc.), and/or with any device that enables the code processing apparatus 600 to communicate with one or more other code processing apparatuses 600 (e.g., router, modem, etc.). Such communication may be through an Input/Output (I/O) interface 605. Further, the code processing device 600 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public Network, such as the internet) via the Network adapter 606. As shown in FIG. 6, a network adapter 606 communicates with the other modules of the code processing apparatus 600 via the bus 603. It should be understood that although not shown in FIG. 6, other hardware and/or software modules may be used in conjunction with the code processing apparatus 600, including but not limited to: microcode, device drivers, Redundant processors, external disk drive Arrays, disk array (RAID) subsystems, tape drives, and data backup storage subsystems, to name a few.
The following describes a computer-readable storage medium provided by embodiments of the present application. The embodiment of the application provides a computer-readable storage medium, which stores computer instructions, and the computer instructions, when executed by a processor, implement the code processing method provided by the embodiment of the application. Specifically, the executable program may be built in or installed in the code processing apparatus 600, so that the code processing apparatus 600 may implement the code processing method provided by the embodiment of the present application by executing the built-in or installed executable program.
Furthermore, the code processing method provided by the embodiment of the present application may also be implemented as a program product including program code for causing the code processing apparatus 600 to execute the code processing method provided by the embodiment of the present application when the program product can be run on the code processing apparatus 600.
The program product provided by the embodiments of the present application may be any combination of one or more readable media, where the readable media may be a readable signal medium or a readable storage medium, and the readable storage medium may be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof, and in particular, more specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a RAM, a ROM, an Erasable Programmable Read-Only Memory (EPROM), an optical fiber, a portable Compact disk Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The program product provided by the embodiment of the application can adopt a CD-ROM and comprises program codes, and can run on a computing device. However, the program product provided by the embodiments of the present application is not limited thereto, and in the embodiments of the present application, the readable storage medium may be any tangible medium that can contain or store a program, which can be used by or in connection with an instruction execution system, apparatus, or device.
It should be noted that although several units or sub-units of the apparatus are mentioned in the above detailed description, such division is merely exemplary and not mandatory. Indeed, the features and functions of two or more units described above may be embodied in one unit, according to embodiments of the application. Conversely, the features and functions of one unit described above may be further divided into embodiments by a plurality of units.
Further, while the operations of the methods of the present application are depicted in the drawings in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if such modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to encompass such modifications and variations.

Claims (13)

1. A code processing method, comprising:
acquiring a code warehouse to be detected;
performing quality detection on the code warehouse to obtain a quality detection result of each row of problem codes in the code warehouse, wherein the problem codes are codes which cannot pass the quality detection;
code submission user identifications of the problem codes of all rows are obtained, and quality inspection authorized users are respectively created on the basis of the code submission user identifications of the problem codes of all rows;
and respectively distributing the quality detection results of the problem codes of all rows to corresponding quality inspection authorized users.
2. The code processing method according to claim 1, wherein after performing quality inspection on the code repository to obtain a quality inspection result of each row of problem codes in the code repository, the method further comprises:
reading codes of corresponding problem codes from the problem codes in each row and submitting the codes to user identification;
and submitting the quality detection result of each row of problem codes and the code of each row of problem codes to a user identifier to be stored in a quality detection result database in an associated manner.
3. The code processing method of claim 2, wherein obtaining code submission user identifications for each line of issue codes comprises:
and reading codes of the problem codes of all rows from the quality detection result database and submitting user identifications.
4. The code processing method of claim 1, wherein obtaining code submission user identifications for each line of issue codes comprises:
and reading the code of the corresponding problem code from the problem codes in each row and submitting the code to a user identifier.
5. The code processing method of claim 1, wherein before submitting user identifications based on the codes of the lines of problem codes and respectively creating quality inspection authorized users, further comprising:
and determining that no quality inspection authorized user identification matched with the code submitting user identification of each row of problem codes exists in the currently stored quality inspection authorized user set.
6. The code processing method of claim 1, wherein before submitting user identifications based on the codes of the lines of problem codes and respectively creating quality inspection authorized users, further comprising:
and submitting the codes of the problem codes of all rows to user identification for duplicate removal.
7. The code processing method of claim 1, wherein submitting user identifications based on the codes of the lines of problem codes, respectively creating quality inspection authorized users, comprises:
and calling a user creation interface, submitting user identification as a login user name by using the codes of the problem codes of all rows, and respectively creating corresponding quality inspection authorized users.
8. The code processing method according to any one of claims 1 to 7, wherein when submitting user identifications based on the codes of the respective lines of problem codes and respectively creating quality inspection authorized users, further comprising:
determining qualified codes of all rows in the code warehouse, wherein the qualified codes are codes passing quality detection;
and reading codes of corresponding qualified codes from the qualified codes in each row, submitting user identifications, submitting the user identifications based on the codes of the qualified codes in each row, and respectively creating quality inspection authorized users.
9. The code processing method of claim 8, wherein after creating the quality control authorized user, further comprising:
and updating the quality inspection authorized user set based on the created quality inspection authorized user identification of each quality inspection authorized user.
10. The code processing method of claim 8, wherein after creating the quality control authorized user, further comprising:
and updating the login time of each created quality inspection authorized user based on the current timestamp.
11. A code processing apparatus, comprising:
the code acquisition unit is used for acquiring a code warehouse to be detected;
the code detection unit is used for performing quality detection on the code warehouse to obtain a quality detection result of each row of problem codes in the code warehouse, wherein the problem codes are codes which cannot pass the quality detection;
the user creating unit is used for acquiring codes of all rows of problem codes and submitting user identifications, submitting the user identifications based on the codes of all rows of problem codes, and respectively creating quality inspection authorized users;
and the result distribution unit is used for respectively distributing the quality detection results of the problem codes of all rows to corresponding quality inspection authorized users.
12. A code processing apparatus, comprising: memory, processor and computer program stored on the memory and executable on the processor, the processor implementing the code processing method according to any of claims 1-10 when executing the computer program.
13. A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions which, when executed by a processor, implement a code processing method according to any one of claims 1 to 10.
CN201910962474.7A 2019-10-11 2019-10-11 Code processing method, device, equipment and medium Pending CN112650663A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910962474.7A CN112650663A (en) 2019-10-11 2019-10-11 Code processing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910962474.7A CN112650663A (en) 2019-10-11 2019-10-11 Code processing method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN112650663A true CN112650663A (en) 2021-04-13

Family

ID=75342671

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910962474.7A Pending CN112650663A (en) 2019-10-11 2019-10-11 Code processing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN112650663A (en)

Similar Documents

Publication Publication Date Title
US11449379B2 (en) Root cause and predictive analyses for technical issues of a computing environment
US11163731B1 (en) Autobuild log anomaly detection methods and systems
CN104679602B (en) For disposing the method and system of event in storage area network
US10657030B2 (en) System and method for testing software in a multi-platform testing environment
KR102268355B1 (en) Cloud deployment infrastructure validation engine
US9864679B2 (en) Identifying severity of test execution failures by analyzing test execution logs
US10496768B2 (en) Simulating a production environment using distributed computing technologies
US10229028B2 (en) Application performance monitoring using evolving functions
CN108369504A (en) It is distributed to the update by model-driven of variation topology
US10911447B2 (en) Application error fingerprinting
KR20210049033A (en) Method for fault injection, device, electronic equipment and storage medium
CN107924360A (en) Diagnosis frame in computing system
US20210096957A1 (en) Retention rule compliance of record deletion based on deletion log
US11822542B2 (en) Propagated deletion of database records and derived data
CN106557878B (en) Development project management method and device
JP2017532660A (en) Automatic tenant upgrade for multi-tenant services
WO2021111235A1 (en) Microservices change management and analytics
CN115812298A (en) Block chain management of supply failure
CN111435306A (en) Code management method and device
CN112650663A (en) Code processing method, device, equipment and medium
CN111949479B (en) Interactive system and index creation condition determining method and equipment
CN113010208A (en) Version information generation method, version information generation device, version information generation equipment and storage medium
CN102841842B (en) For the automation controller of next generation test system
CN109814911A (en) Method, apparatus, computer equipment and storage medium for Manage Scripts program
US11683230B1 (en) Applying a feature on demand upgrade responsive to measured utilization

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination