CN117539740A - Code quality detection method, apparatus, device, storage medium, and program - Google Patents

Code quality detection method, apparatus, device, storage medium, and program Download PDF

Info

Publication number
CN117539740A
CN117539740A CN202210882478.6A CN202210882478A CN117539740A CN 117539740 A CN117539740 A CN 117539740A CN 202210882478 A CN202210882478 A CN 202210882478A CN 117539740 A CN117539740 A CN 117539740A
Authority
CN
China
Prior art keywords
code
target
questionnaire
module
determining
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
CN202210882478.6A
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.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network 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 Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202210882478.6A priority Critical patent/CN117539740A/en
Publication of CN117539740A publication Critical patent/CN117539740A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3616Software analysis for verifying properties of programs using software metrics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0639Performance analysis of employees; Performance analysis of enterprise or organisation operations
    • G06Q10/06395Quality analysis or management

Abstract

The embodiment of the disclosure provides a code quality detection method, a device, equipment, a storage medium and a program, wherein the method comprises the following steps: when the code submitting operation is monitored, determining a code submitting user corresponding to the code submitting operation and target code data of the indicated submission; determining a target questionnaire from the target code data, the target questionnaire comprising at least one question for querying the code quality of the target code data; a target questionnaire is sent to a first terminal device corresponding to a code submitting user, and a first questionnaire result corresponding to the target questionnaire is received, wherein the first questionnaire result comprises answer information provided by the code submitting user for each question; and determining a code quality detection result corresponding to the target code data according to the first questionnaire result. The questionnaire is pushed to the code submitting user, and the code quality detection result is determined based on the questionnaire result, so that the method has higher flexibility and can meet the code quality detection requirements of different application scenes.

Description

Code quality detection method, apparatus, device, storage medium, and program
Technical Field
The embodiment of the disclosure relates to the technical field of software, in particular to a code quality detection method, a device, equipment, a storage medium and a program.
Background
With the development of software technology, many programs can be implemented by software codes. With the enlargement and complication of program development, a program may be cooperatively completed by a plurality of developers, which brings great uncertainty to the code quality of the program.
The code quality can influence the running stability of the program and the development iteration efficiency of the program, so that the code quality of the program is often required to be detected in the actual development process. Currently, code data can be detected by a static code detection tool (such as a PC-Lint tool) to determine whether a grammar error exists in the code data.
However, the above detection method has a certain limitation, and is only suitable for detecting quality problems such as grammar errors in codes, but cannot detect quality problems in terms of code structure, code understandability, code maintainability, and the like.
Disclosure of Invention
The embodiment of the disclosure provides a code quality detection method, a device, equipment, a storage medium and a program, which have higher flexibility and can meet the code quality detection requirements of different application scenes.
In a first aspect, an embodiment of the present disclosure provides a code quality detection method, including:
when the code submitting operation is monitored, determining a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation;
determining a target questionnaire according to the target code data, wherein the target questionnaire comprises: at least one question for querying code quality of the object code data;
the target questionnaire is sent to first terminal equipment corresponding to the code submitting user, and first questionnaire results corresponding to the target questionnaire are received from the first terminal equipment, wherein the first questionnaire results comprise: the code submitting answer information provided by the user for the at least one question;
and determining a code quality detection result corresponding to the target code data according to the first questionnaire result.
In a second aspect, an embodiment of the present disclosure provides a code quality detection apparatus, including:
the first determining module is used for determining a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation when the code submitting operation is monitored;
The second determining module is configured to determine a target questionnaire according to the target code data, where the target questionnaire includes: at least one question for querying code quality of the object code data;
the receiving and transmitting module is used for sending the target questionnaire to first terminal equipment corresponding to the code submitting user and receiving first questionnaire results corresponding to the target questionnaire from the first terminal equipment, wherein the first questionnaire results comprise: the code submitting answer information provided by the user for the at least one question;
and a third determining module, configured to determine a code quality detection result corresponding to the target code data according to the first questionnaire result.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions to implement the method as described in the first aspect.
In a fourth aspect, embodiments of the present disclosure provide a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement the method as described in the first aspect.
In a fifth aspect, embodiments of the present disclosure provide a computer program product comprising a computer program which, when executed by a processor, implements the method according to the first aspect.
The embodiment of the disclosure provides a code quality detection method, a device, equipment, a storage medium and a program, wherein the method comprises the following steps: when the code submitting operation is monitored, determining a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation; determining a target questionnaire according to the target code data, wherein the target questionnaire comprises: at least one question for querying code quality of the object code data; the method comprises the steps of sending a target questionnaire to first terminal equipment corresponding to a code submitting user, and receiving a first questionnaire result corresponding to the target questionnaire from the first terminal equipment, wherein the first questionnaire result comprises: code submitting answer information provided by the user for at least one question; and determining a code quality detection result corresponding to the target code data according to the first questionnaire result. In the above process, the code quality detection result is determined by pushing a form of questionnaire to the code submitting user, so that: the questions in the questionnaire can be reasonably set based on the code quality detection requirement, so that the code submitting user feeds back quality questions related to the code quality detection requirement, and the code quality detection requirement is achieved. Therefore, the code quality detection scheme provided by the disclosure has higher flexibility, and can meet the code quality detection requirements of different application scenes.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the solutions in the prior art, a brief description will be given below of the drawings that are needed in the embodiments or the description of the prior art, it being obvious that the drawings in the following description are some embodiments of the present disclosure, and that other drawings may be obtained from these drawings without inventive effort to a person of ordinary skill in the art.
Fig. 1 is a schematic diagram of an application scenario provided in an embodiment of the present disclosure;
fig. 2 is a flow chart of a code quality detection method according to an embodiment of the disclosure;
FIG. 3 is a schematic illustration of a questionnaire provided by an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a questionnaire result corresponding to the questionnaire shown in FIG. 3;
fig. 5 is a flowchart of another code quality detection method according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram of a code quality detection result provided in an embodiment of the disclosure;
FIG. 7 is a diagram illustrating another code quality detection result provided by an embodiment of the present disclosure;
fig. 8 is a schematic diagram of a code quality detection process according to an embodiment of the disclosure;
fig. 9 is a schematic structural diagram of a code quality detecting device according to an embodiment of the present disclosure;
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some embodiments of the present disclosure, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without inventive effort, based on the embodiments in this disclosure are intended to be within the scope of this disclosure.
The embodiment of the disclosure provides a code quality detection method, a device, equipment, a storage medium and a program, and relates to the technical field of software. An application scenario related to an embodiment of the present disclosure will be described first with reference to fig. 1.
Fig. 1 is a schematic diagram of an application scenario provided in an embodiment of the present disclosure. As shown in fig. 1, the application scenario includes: code warehouse and code quality detection device. Wherein the code repository is for storing code data. Code data corresponding to one or more programs may be stored in a code repository. The code quality detection means may be in the form of software and/or hardware, and the code quality detection means may be deployed on one or more electronic devices.
Referring to fig. 1, a code submission user submits code data to a code repository to store the code data of the present submission into the code repository. The code quality detection device can monitor code submitting operation corresponding to the code warehouse; when the code submitting operation is monitored, a questionnaire is pushed to a code submitting user, the questionnaire is used for inquiring the code quality of the code data submitted at this time, a questionnaire result fed back by the code submitting user is obtained, and then a code quality detection result corresponding to the code data is determined according to the questionnaire result.
In the technical scheme, the code quality detection result corresponding to the code data is determined by pushing a form of a questionnaire to a code submitting user, so that: the code quality detection requirement can be realized by reasonably setting questions in a questionnaire based on the code quality detection requirement and submitting the quality questions related to the quality detection requirement to a code through the questionnaire. For example, when it is necessary to detect code quality of objective dimension such as grammar error, a quality question for asking about objective dimension may be set in the questionnaire; when code quality of subjective dimensions such as code structure, code understandability, code maintainability, etc. needs to be detected, quality questions for asking subjective dimensions may be set in the questionnaire. When it is necessary to detect the quality of codes in both objective dimension and subjective dimension, a quality question for inquiring about objective dimension and a quality question for inquiring about subjective dimension can be set simultaneously in the questionnaire. Therefore, the code quality detection scheme provided by the disclosure has higher flexibility, and can meet the code quality detection requirements of different application scenes.
Furthermore, the code submitting user is a user taking the code data submitted at this time as a change, which is equivalent to other users, and the code submitting user has deeper knowledge on the code data submitted at this time, so that the code quality detection result corresponding to the code data is determined by pushing a questionnaire to the code submitting user, and the code quality detection result has higher accuracy.
The technical solutions provided by the present disclosure are described in detail below with reference to several specific embodiments. The following embodiments may be combined with each other and may not be described in further detail in some embodiments for the same or similar concepts or processes.
Fig. 2 is a flow chart of a code quality detection method according to an embodiment of the disclosure. The method of the present embodiment may be performed by a code quality detection apparatus. As shown in fig. 2, the method of the present embodiment includes:
s201: when the code submitting operation is monitored, a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation are determined.
Wherein the code submission operation refers to an operation in which a user submits code data to a code repository to store the code data to the code repository.
And the user submitting the code data to the code warehouse is the code submitting user. It should be appreciated that the code submission user is a user that makes changes to the code data submitted at this time, and has more in-depth knowledge of the code data submitted at this time than other users.
Code data submitted by a code submission user to a code repository is referred to as target code data. The object code data may include code data in one or more code files.
Illustratively, the code quality detection device is communicatively coupled to the code repository, and the code quality detection device may monitor the code submission operations described above. The code repository may send a notification message to the code quality detection apparatus when the code submission user inputs a code submission operation to the code repository. If the code quality detection device receives the notification message, the code submitting operation is detected.
S202: determining a target questionnaire according to the target code data, wherein the target questionnaire comprises: at least one problem for interrogating code quality of object code data.
In this embodiment, the target questionnaire may include code quality-related questions in one or more dimensions.
As one example, code quality-related questions of objective dimensions may be included in the target questionnaire, as follows by way of example: is there a grammar error? Is there a function of higher circle complexity? Is there a problem that the code does not meet the naming convention?
As another example, code quality related questions of subjective dimensions, etc., may be included in the target questionnaire, as follows by way of example: is there a problem of unclear code structure? Is there a problem of complex and difficult code logic? Is there a problem with poor code maintainability?
As yet another example, the target questionnaire may include: problems associated with code quality in the objective dimension, and problems associated with code quality in the subjective dimension.
Fig. 3 is a schematic diagram of a questionnaire provided by an embodiment of the present disclosure. As shown in fig. 3, 4 questions are exemplified in the questionnaire, the 4 questions being used to ask quality questions in different aspects, respectively. For example, question 1 is for an inquiry code structure aspect, question 2 is for an inquiry code intelligibility aspect, question 3 is for an inquiry code maintainability aspect, and question 4 is for an inquiry code normalization aspect.
With continued reference to fig. 3, for each question, one or more answers to be selected may be provided in the questionnaire, e.g., answer a to be selected, answer B to be selected, answer C to be selected. The user may answer the question by checking a certain answer to be selected. Optionally, for each question, a text entry box may also be provided in the questionnaire, in which the user may enter a specific question description.
Note that the structure of the questionnaire shown in fig. 3, and the content of the questionnaire are only one possible example, and the present embodiment is not limited thereto.
In some possible implementations, the target questionnaire may be determined from the encoding language employed by the target code data. For example, a questionnaire corresponding to each coding language is designed for different coding languages in advance. And if the target code data adopts the first coding language, determining the questionnaire corresponding to the first coding language as the target questionnaire.
In an actual software development scenario, considering that when code quality is detected, code data written for different coding languages usually have different requirements for code quality detection, in the implementation manner, corresponding questionnaires are respectively designed for the different coding languages, so that the quality detection requirements under the different coding language scenarios can be met.
In other possible implementations, the target questionnaire may be determined from the module to which the target code data relates. For example, a questionnaire corresponding to each module is designed in advance for each module. If the target code data relates to the first module, determining the questionnaire corresponding to the first module as the target questionnaire. Optionally, if the number of modules involved in the object code data is multiple, at least one object module may be determined from the multiple modules, and a questionnaire corresponding to the at least one object module is determined as the target questionnaire.
In an actual software development scenario, considering that when the code quality is detected, the requirements of code quality detection are generally different for different modules, in the implementation manner, the quality detection requirements of different modules can be met by respectively designing corresponding questionnaires for different modules.
S203: sending a target questionnaire to first terminal equipment corresponding to a code submitting user, and receiving a first questionnaire result corresponding to the target questionnaire from the first terminal equipment; the first questionnaire results include: the code submits answer information provided by the user for the at least one question.
In this embodiment, the code quality detection apparatus transmits the target questionnaire to the first terminal device. And after receiving the target questionnaire, the first terminal equipment displays the target questionnaire so that the code submitting user fills in the target questionnaire to obtain a first questionnaire result.
Illustratively, fig. 4 is a schematic diagram of a questionnaire result corresponding to the questionnaire shown in fig. 3. As shown in fig. 4, for each question in the questionnaire, the code submitting user may sort out one or more target answers among a plurality of answers to be selected, and may also input the question description information corresponding to the question in the text input box. Thus, after the code submitting user fills out the questionnaire, the questionnaire result corresponding to the questionnaire can be obtained.
Further, after the first terminal device detects the submitting operation of the code submitting user to the target questionnaire, a first questionnaire result is sent to the code quality detecting device. Wherein, the first questionnaire result comprises: the code submits answer information that the user provides for each question. The answer information corresponding to each question may indicate at least one target answer among a plurality of candidate answers corresponding to the question, and may also indicate question description information corresponding to the question.
S204: and determining a code quality detection result corresponding to the target code data according to the first questionnaire result.
After receiving the first questionnaire result from the first terminal device, the code quality detection device can obtain a code quality detection result corresponding to the target code data by analyzing the first questionnaire result.
The following is described in connection with an example. In the process of developing a requirement, when the code responsible for other users needs to be changed, the code submitting user may find quality problems in the code data responsible for other users, such as poor code comprehensibility, poor code maintainability, unclear code structure and the like. In this case, the code submission user may record the quality problem found. After the current demand development is completed, when a code submitting user submits the code to a code warehouse, the code quality detection device monitors a change submitting operation and triggers the target questionnaire to be pushed to the code submitting user, so that the code submitting user feeds back the quality problems found in the development process through the target questionnaire. It can be understood that, because the requirements are developed and completed in the code submitting stage, the quality problems collected by the code submitting user are perfect, and at the moment, the target questionnaire is pushed to the code submitting user, so that the quality problems fed back by the code submitting user are comprehensive.
In this embodiment, a code quality detection result corresponding to code data is determined by pushing a form of a questionnaire to a code submitting user, so that: the questions in the questionnaire can be reasonably set based on the code quality detection requirement, so that the code submitting user feeds back quality questions related to the code quality detection requirement, and the code quality detection requirement is achieved. For example, when it is necessary to detect code quality of objective dimension such as grammar error, a quality question for asking about objective dimension may be set in the questionnaire; when code quality of subjective dimensions such as code structure, code understandability, code maintainability, etc. needs to be detected, quality questions for asking subjective dimensions may be set in the questionnaire. When it is necessary to detect the quality of codes in both objective dimension and subjective dimension, a quality question for inquiring about objective dimension and a quality question for inquiring about subjective dimension can be set simultaneously in the questionnaire. Therefore, the code quality detection scheme provided by the disclosure has higher flexibility, and can meet the code quality detection requirements of different application scenes.
Furthermore, the code submitting user is a user taking the code data submitted at this time as a change, which is equivalent to other users, and the code submitting user has deeper knowledge on the code data submitted at this time, so that the code quality detection result corresponding to the code data is determined by pushing a questionnaire to the code submitting user, and the code quality detection result has higher accuracy.
In addition, in this embodiment, when the code submitting operation is monitored every time, the code quality detection is triggered on the submitted code data, so that the quality problem existing in the code data can be found in time, the code data can be optimized in time, the code quality is improved continuously, and the negative influence of the quality problem on the running stability of the program and the subsequent development iteration efficiency is reduced.
On the basis of the embodiment shown in fig. 2, the technical solution of the present disclosure will be described in more detail with reference to fig. 5 to 8.
Fig. 5 is a flowchart of another code quality detection method according to an embodiment of the present disclosure. This embodiment may be used as a refinement of the embodiment shown in fig. 2. As shown in fig. 5, the method of the present embodiment includes:
s501: when the code submitting operation is monitored, determining a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation, wherein the target code data comprises sub-target code data corresponding to a plurality of preset modules.
It should be understood that the implementation of S501 is similar to S201, and will not be described here.
The embodiment mainly aims at the scene that the code data submitted at the time relate to a plurality of preset modules, namely, the target code data comprise sub-target code data corresponding to the preset modules. The plurality of preset modules may be function modules/service modules obtained based on function/service division of the program. Taking a short video program as an example, the plurality of preset modules may include: prop module, beauty module, special effect module, music module etc..
S502: and determining the target module in the plurality of preset modules according to the sub-target code data corresponding to the plurality of preset modules.
In this embodiment, corresponding questionnaires may be designed in advance for different modules, respectively. After the target module is determined in the plurality of preset modules, the questionnaire corresponding to the target module can be used as a target questionnaire to be pushed to the code submitting user.
In a possible implementation manner, the target module may be determined in the plurality of preset modules in the following manner:
(1) And determining quality maintenance users corresponding to the preset modules respectively.
In an actual software development process, each module typically corresponds to a quality maintenance user. The quality maintenance user is a user responsible for maintaining and managing the code quality of the preset module. For a module, its corresponding quality maintenance user is typically the developer responsible for software development of the module.
(2) And determining at least one candidate module in the plurality of preset modules according to the quality maintenance users corresponding to the plurality of preset modules, wherein the quality maintenance users corresponding to the candidate modules are different from the code submitting users.
(3) And determining a target module in the at least one candidate module according to the subcode data corresponding to the at least one candidate module.
In this embodiment, since the quality maintenance user corresponding to each module is usually a developer responsible for developing software for the module, the quality maintenance user is usually authorized to code quality of the module, and is not easy to find the code quality problem of the module. The accuracy of the code quality detection result corresponding to the module can be affected by the feedback of the quality maintenance user on the code quality of the corresponding module.
For this reason, in the step (2), some preset modules are first removed from the plurality of preset modules, and the quality maintainer corresponding to the removed preset modules is the same as the code submitting user. And determining the remaining preset modules after the elimination as candidate modules, wherein the quality maintenance users corresponding to the candidate modules are different from the code submitting users.
Because the quality maintenance users corresponding to the remaining candidate modules are different from the code submitting users after the elimination process of the step (2), in the step (3), the target module is determined in the candidate modules, and the target module is ensured to be a module meeting the following conditions: the corresponding quality maintenance user is different from the code submitting user, so that the condition that the code submitting user feeds back the code quality of the module responsible for the code submitting user can be avoided, and further, the code quality detection result corresponding to the target module can be improved.
In some possible implementations, the above step (3) may be implemented in the following manner: and aiming at each candidate module in the at least one candidate module, acquiring sub-original code data corresponding to the candidate module from a code warehouse, and determining code change information corresponding to the candidate module according to the sub-original code data corresponding to the candidate module and the sub-target code data corresponding to the candidate module.
For a certain candidate module, the sub-original code data corresponding to the candidate module refers to the sub-code data corresponding to the candidate module before the code is submitted, and the sub-target code data corresponding to the candidate module refers to the sub-code data corresponding to the candidate module after the code is submitted. The code change information corresponding to the candidate module can be determined by comparing and analyzing the sub-original code data corresponding to the candidate module and the sub-target code data corresponding to the candidate module. The code change information indicates a difference between the sub-original code data and the sub-object code data.
Further, according to the code change information corresponding to each of the at least one candidate module, determining a target module in the at least one candidate module. For example, if it is determined that a candidate module makes more code changes according to code change information corresponding to the candidate module, the candidate module is determined as the target module.
Optionally, the code change information corresponding to each candidate module includes: at least one of the number of lines of code change and the code change ratio. The number of code change lines is the number of changed code lines. The code change ratio refers to the ratio between the number of code lines that have changed and the total number of module code lines.
In some implementations, a candidate module satisfying a preset condition in the at least one candidate module may be determined as a target module; wherein the preset conditions include at least one of the following:
(A) The code change proportion is larger than or equal to a first preset threshold value;
(B) The code change proportion is the largest;
(C) The number of code change lines is greater than or equal to a second preset threshold.
By adopting the implementation mode, the candidate module with more code change amount can be determined as the target module, and the code submitting user has higher confidence level on the code quality feedback result of the target code data because the code submitting user has more code change amount on the target module, so that the accuracy of the code quality detection result corresponding to the target module can be improved.
S503: determining a questionnaire corresponding to the target module in a questionnaire database as a target questionnaire; the target questionnaire includes: the questionnaire database is used for inquiring at least one question of the code quality of the sub-object code data corresponding to the object module, and the questionnaire database is used for storing questionnaires corresponding to different modules.
In this embodiment, the identifiers of the different modules and the questionnaires corresponding to the identifiers may be stored in advance in the questionnaire database. After the target module is determined, the identification of the target module is matched with the identifications of the modules in the questionnaire database, and the questionnaire corresponding to the successfully matched identification is determined as the target questionnaire.
In this embodiment, questions in questionnaires corresponding to different modules may be the same or different, and this embodiment is not limited thereto.
S504: the method comprises the steps of sending a target questionnaire to first terminal equipment corresponding to a code submitting user, and receiving a first questionnaire result corresponding to the target questionnaire from the first terminal equipment, wherein the first questionnaire result comprises: the code submits answer information provided by the user for the at least one question.
It should be understood that the specific implementation of S504 is similar to S203, and will not be described here.
S505: and determining a code quality detection result corresponding to the target module according to the first questionnaire result.
For example, the first questionnaire result may be parsed to obtain the at least one question and answer information provided by the code submission user for each question. The questionnaire shown in fig. 3 and the questionnaire results shown in fig. 4 are exemplified. Each question in the target questionnaire corresponds to a number of answers to be selected. And analyzing the first questionnaire result to obtain each question, a plurality of answers to be selected corresponding to each question and answer information provided by a code submitting user for each question. The answer information for each question includes at least one target answer of the plurality of answers to be selected. Optionally, the answer information corresponding to each question may further include question description information corresponding to the question.
Further, a code quality detection result corresponding to the target module can be determined according to the at least one question and the answer information corresponding to each question. The following description is provided in connection with two possible implementations, respectively.
In a first implementation manner, the code quality detection result corresponding to the target module may be determined in the following manner:
(1) Generating current quality investigation result information corresponding to the target module according to the at least one question and the answer information corresponding to each question, wherein the current quality investigation result information can comprise: the at least one question, and answer information corresponding to each question.
Optionally, the quality investigation result information may further include: the code submits the identity of the user and the time of submission of the first questionnaire result. Thus, the code quality problem corresponding to the target module can be tracked conveniently.
(2) And determining the current quality score corresponding to the target module according to the weight information corresponding to the at least one question and the answer information corresponding to each question.
For example, a question score corresponding to each question may be determined according to the answer information corresponding to each question, for example, for a certain question, if the answer information corresponding to the question is the answer a to be selected, the question score corresponding to the question is 10; if the answer information corresponding to the question is the answer B to be selected, the question score corresponding to the question is 50; if the answer information corresponding to the question is the answer C to be selected, the question score corresponding to the question is 90.
Each question can also correspond to weight information, and the question score corresponding to each question can be weighted according to the weight information corresponding to each question, so that the current quality score corresponding to the target module can be obtained.
(3) And determining a code quality detection result corresponding to the target module according to the quality investigation result information and the quality score.
As an example, fig. 6 is a schematic diagram of a code quality detection result provided by an embodiment of the disclosure. As shown in fig. 6, the code quality detection result may include the current quality investigation result information, and the current quality score. Thus, the code quality condition of the target module can be intuitively known through the quality detection result.
In a second implementation manner, the code quality detection result corresponding to the target module may be determined in the following manner:
(1) Generating current quality investigation result information corresponding to the target module according to the at least one question and the answer information corresponding to each question, wherein the current quality investigation result information can comprise: the at least one question, and answer information corresponding to each question.
(2) And determining the current quality score corresponding to the target module according to the weight information corresponding to the at least one question and the answer information corresponding to each question.
The steps (1) and (2) are similar to the steps (1) and (2) in the foregoing implementation manner, and are not described herein.
(3) Acquiring at least one historical quality score corresponding to the target module, and determining an average quality score corresponding to the target module according to the current quality score and the at least one historical quality score; wherein the historical quality score is derived based on historical questionnaire results corresponding to the target questionnaire.
It should be understood that, the process of determining the historical quality score based on the historical questionnaire result is similar to the process of determining the current quality score based on the first questionnaire result in this embodiment, and will not be described in detail herein.
(4) And acquiring at least one piece of historical quality survey result information corresponding to the target module, wherein the historical quality survey result information is obtained based on a historical questionnaire result corresponding to the target questionnaire.
It should be understood that, the process of determining the historical quality survey result information based on the historical questionnaire result is similar to the process of determining the current quality survey result information based on the first questionnaire result in this embodiment, and will not be described in detail herein.
(5) And determining a code quality detection result corresponding to the target module according to the current quality investigation result information, the at least one historical quality investigation result information and the average quality score.
In the second implementation manner, when the code quality detection result corresponding to the target module is determined, not only the current quality investigation result information but also at least one historical quality investigation result information are considered, and the code quality detection result has higher accuracy by comprehensively considering the quality investigation result information of multiple times.
For example, it is assumed that at the first moment, the user a submits the code to the code repository, and the code change amount of the first module is larger in the code data submitted by the user a, so the code quality detection device pushes the questionnaire corresponding to the first module to the user a after detecting the code submitting operation of the user a, and receives the first questionnaire result fed back by the user a. In this case, the code quality detection result corresponding to the first module may be determined by using the first implementation manner described above. The code quality detection result is shown in fig. 6.
And at a second time later, the user B submits codes to the code warehouse, and the code change amount of the first module is larger in code data submitted by the user B, so that the code quality detection device pushes the questionnaire corresponding to the first module to the user B after monitoring the code submitting operation of the user B and receives a second questionnaire result fed back by the user B. In this case, the code quality detection result corresponding to the first module may be determined by using the second implementation manner described above. As an example, fig. 7 is a schematic diagram of another code quality detection result provided by an embodiment of the present disclosure. As shown in fig. 7, the code quality detection result may include the current quality investigation result information (i.e., the code quality information fed back by the user B), the historical quality investigation result information (i.e., the code quality information fed back by the user a), and the average quality score. Thus, the code quality condition of the target module can be intuitively known through the quality detection result. And the code quality detection result has higher accuracy due to the comprehensive consideration of the quality investigation result information of multiple times.
In some possible implementations, after determining the code quality detection result corresponding to the target module, the code quality detection device may further include:
s506: and determining a quality maintenance user corresponding to the target module, and sending a quality detection result corresponding to the target module to second terminal equipment corresponding to the quality maintenance user.
Accordingly, after receiving the quality detection result corresponding to the target module, the second terminal device may present the quality detection result shown in fig. 6 or fig. 7 to the quality maintenance user, so that the quality maintenance user can intuitively understand the code quality condition corresponding to the target module, optimize the code data corresponding to the target module according to the code quality condition, and continuously improve the code quality of the target module.
The technical solution of the present disclosure is illustrated below in conjunction with a specific example on the basis of the embodiment shown in fig. 5.
Fig. 8 is a schematic diagram of a code quality detection process according to an embodiment of the disclosure. As shown in fig. 8, assume that user a submits code to the code repository. After monitoring the code submitting operation, the code quality detecting device determines that the code submitting user corresponding to the code submitting operation is user A, and pulls the target code data submitted at this time from the code warehouse.
With continued reference to fig. 8, the code quality detection apparatus determines, by analyzing the object code data, the modules of the changes involved in the object code data include: module 1, module 2, module 3 and module 4. Assuming that the quality maintenance user corresponding to the module 1 is the user B, the quality maintenance user corresponding to the module 2 is the user C, the quality maintenance user corresponding to the module 3 is the user D, and the quality maintenance user corresponding to the module 4 is the user a. Because the quality maintenance user corresponding to the module 4 is the same as the current code submitting user, the module 4 is filtered out, so that the problem that the quality detection result of the module 4 is inaccurate because the user A feeds back the code quality of the module (module 4) responsible for the user A. Filtering by the above modules to obtain candidate modules includes: module 1, module 2 and module 3.
With continued reference to fig. 8, the code quality detection apparatus may determine code change information, e.g., number of code change lines, code change proportion, for each candidate module, respectively. Assuming that the number of code change lines corresponding to the module 1 is 250 lines, the code change ratio is 60%, the number of code change lines corresponding to the module 2 is 10 lines, the code change ratio is 3%, the number of code change lines corresponding to the module 3 is 15 lines, and the code change ratio is 20%. Therefore, the amount of change made by the user a to the module 1 is larger, and the amounts of change made by the modules 2 and 3 are smaller, which means that the user a is more familiar with the code data of the module 1 in the code change process, and the confidence of the user a to the quality feedback information of the module 1 is higher, so that the module 2 and the module 3 are filtered, and the module 1 is determined as the target module.
With continued reference to fig. 8, questionnaires corresponding to the respective modules are stored in the questionnaire database, for example, module 1 corresponds to questionnaire 1, module 2 corresponds to questionnaire 2, module 3 corresponds to questionnaire 3, and module 4 corresponds to questionnaire 4. The code quality detecting means acquires the questionnaire corresponding to the module 1 from the questionnaire database as a target questionnaire, that is, takes the questionnaire 1 as a target questionnaire.
With continued reference to fig. 8, the code quality measurement device sends a questionnaire 1 to the terminal device corresponding to the user a, so that the user fills out the questionnaire 1 according to the quality problems recorded in the requirement development process. After completion of filling, the user a feeds back the questionnaire result corresponding to the questionnaire 1 to the code quality detection device. The code quality detection device obtains a code quality detection result corresponding to the module 1 through analyzing and processing the questionnaire result.
With continued reference to fig. 8, since the quality maintenance user corresponding to the module 1 is the user B, the code quality detection device sends the code quality detection result corresponding to the module 1 to the terminal device corresponding to the user B. The code quality detection result corresponding to the module 1 is shown in fig. 6 or fig. 7. Therefore, the user B can intuitively know the quality problems in the module 1 according to the code quality detection result, optimize the quality problems and improve the code quality corresponding to the module 1.
In this embodiment, the code quality detection process is integrated into the code submitting process, and the code quality detection is triggered by each code submitting operation, so that the code quality detection has sustainability, and the code quality can be continuously improved.
Fig. 9 is a schematic structural diagram of a code quality detecting device according to an embodiment of the present disclosure. The apparatus may be in the form of software and/or hardware. As shown in fig. 9, the code quality apparatus 900 provided in this embodiment includes: a first determination module 901, a second determination module 902, a transceiver module 903, and a third determination module 904. Wherein,
the first determining module 901 is configured to determine, when a code submitting operation is monitored, a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation;
a second determining module 902, configured to determine a target questionnaire according to the target code data, where the target questionnaire includes: at least one question for querying code quality of the object code data;
the transceiver module 903 is configured to send the target questionnaire to a first terminal device corresponding to the code submitting user, and receive a first questionnaire result corresponding to the target questionnaire from the first terminal device, where the first questionnaire result includes: the code submitting answer information provided by the user for the at least one question;
And a third determining module 904, configured to determine a code quality detection result corresponding to the target code data according to the first questionnaire result.
In a possible implementation manner, the target code data includes sub-target code data corresponding to a plurality of preset modules; the second determining module 902 is specifically configured to:
determining a target module in the plurality of preset modules according to sub-target code data corresponding to the plurality of preset modules;
determining a questionnaire corresponding to the target module in a questionnaire database as the target questionnaire; the questionnaire database is used for storing questionnaires corresponding to different modules;
according to the first questionnaire result, determining a code quality detection result corresponding to the target code data, including:
and determining a code quality detection result corresponding to the target module according to the first questionnaire result.
In a possible implementation manner, the second determining module 902 is specifically configured to:
determining quality maintenance users corresponding to the preset modules respectively;
determining at least one candidate module in the plurality of preset modules according to quality maintenance users corresponding to the plurality of preset modules respectively, wherein the quality maintenance users corresponding to the candidate modules are different from the code submitting users;
And determining the target module in the at least one candidate module according to the subcode data corresponding to the at least one candidate module.
In a possible implementation manner, the second determining module 902 is specifically configured to:
for each candidate module, sub-original code data corresponding to the candidate module is obtained from a code warehouse, and code change information corresponding to the candidate module is determined according to the sub-original code data corresponding to the candidate module and the sub-target code data corresponding to the candidate module;
and determining the target module in the at least one candidate module according to the code change information corresponding to each of the at least one candidate module.
In a possible implementation manner, the code change information corresponding to each candidate module includes: at least one of a number of lines of code change and a code change ratio; the second determining module 902 is specifically configured to:
determining a candidate module meeting a preset condition in the at least one candidate module as the target module; wherein the preset conditions include at least one of the following:
the code change proportion is larger than or equal to a first preset threshold value;
the code change proportion is the largest;
The number of the code change lines is larger than or equal to a second preset threshold value.
In one possible implementation, each question in the target questionnaire corresponds to a plurality of answers to be selected; the third determining module 904 is specifically configured to:
analyzing the first questionnaire result to obtain at least one question and answer information provided by the code submitting user for each question; wherein the answer information of each question comprises at least one target answer in the plurality of answers to be selected;
and determining a code quality detection result corresponding to the target module according to the at least one question and the answer information corresponding to each question.
In a possible implementation manner, the third determining module 904 is specifically configured to:
generating current quality investigation result information corresponding to the target module according to the at least one question and the answer information corresponding to each question, wherein the current quality investigation result information comprises the at least one question and the answer information corresponding to each question;
determining the current quality score corresponding to the target module according to the weight information corresponding to the at least one question and the answer information corresponding to each question;
And determining a code quality detection result corresponding to the target module according to the current quality investigation result information and the current quality score.
In a possible implementation manner, the third determining module 904 is specifically configured to:
acquiring at least one historical quality score corresponding to the target module, and determining an average quality score corresponding to the target module according to the current quality score and the at least one historical quality score; wherein the historical quality score is obtained based on a historical questionnaire result corresponding to the target questionnaire;
acquiring at least one piece of historical quality survey result information corresponding to the target module, wherein the historical quality survey result information is obtained based on a historical questionnaire result corresponding to the target questionnaire;
and determining a code quality detection result corresponding to the target module according to the current quality investigation result information, the at least one historical quality investigation result information and the average quality score.
In a possible implementation, the transceiver module 903 is further configured to:
determining a quality maintenance user corresponding to the target module;
and sending a code quality detection result corresponding to the target module to second terminal equipment corresponding to the quality maintenance user.
The code quality detection device provided in this embodiment may be used to execute the code quality detection method provided in any of the above method embodiments, and its implementation principle and technical effects are similar, and are not described here again.
In order to achieve the above embodiments, the embodiments of the present disclosure further provide an electronic device.
Referring to fig. 10, there is shown a schematic structural diagram of an electronic device 1000 suitable for use in implementing embodiments of the present disclosure, which electronic device 1000 may be a terminal device or a server. The terminal device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a personal digital assistant (Personal Digital Assistant, PDA for short), a tablet (Portable Android Device, PAD for short), a portable multimedia player (Portable Media Player, PMP for short), an in-vehicle terminal (e.g., an in-vehicle navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 10 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 10, the electronic apparatus 1000 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 1001 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access Memory (Random Access Memory, RAM) 1003. In the RAM 1003, various programs and data necessary for the operation of the electronic apparatus 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other by a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
In general, the following devices may be connected to the I/O interface 1005: input devices 1006 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 1007 including, for example, a liquid crystal display (Liquid Crystal Display, LCD for short), a speaker, a vibrator, and the like; storage 1008 including, for example, magnetic tape, hard disk, etc.; and communication means 1009. The communication means 1009 may allow the electronic device 1000 to communicate wirelessly or by wire with other devices to exchange data. While fig. 10 shows an electronic device 1000 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. The above-described functions defined in the method of the embodiment of the present disclosure are performed when the computer program is executed by the processing device 1001.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above-described embodiments.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (Local Area Network, LAN for short) or a wide area network (Wide Area Network, WAN for short), or it may be connected to an external computer (e.g., connected via the internet using an internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The name of the unit does not in any way constitute a limitation of the unit itself, for example the first acquisition unit may also be described as "unit acquiring at least two internet protocol addresses".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to a first aspect, according to one or more embodiments of the present disclosure, there is provided a code quality detection method, including:
when the code submitting operation is monitored, determining a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation;
determining a target questionnaire according to the target code data, wherein the target questionnaire comprises: at least one question for querying code quality of the object code data;
the target questionnaire is sent to first terminal equipment corresponding to the code submitting user, and first questionnaire results corresponding to the target questionnaire are received from the first terminal equipment, wherein the first questionnaire results comprise: the code submitting answer information provided by the user for the at least one question;
and determining a code quality detection result corresponding to the target code data according to the first questionnaire result.
According to one or more embodiments of the present disclosure, the object code data includes sub-object code data corresponding to a plurality of preset modules; determining a target questionnaire according to the target code data, comprising:
Determining a target module in the plurality of preset modules according to sub-target code data corresponding to the plurality of preset modules;
determining a questionnaire corresponding to the target module in a questionnaire database as the target questionnaire; the questionnaire database is used for storing questionnaires corresponding to different modules;
according to the first questionnaire result, determining a code quality detection result corresponding to the target code data, including:
and determining a code quality detection result corresponding to the target module according to the first questionnaire result.
According to one or more embodiments of the present disclosure, determining, according to sub-object code data corresponding to the plurality of preset modules, an object module among the plurality of preset modules includes:
determining quality maintenance users corresponding to the preset modules respectively;
determining at least one candidate module in the plurality of preset modules according to quality maintenance users corresponding to the plurality of preset modules respectively, wherein the quality maintenance users corresponding to the candidate modules are different from the code submitting users;
and determining the target module in the at least one candidate module according to the subcode data corresponding to the at least one candidate module.
According to one or more embodiments of the present disclosure, determining the target module in the at least one candidate module according to the sub-code data corresponding to the at least one candidate module includes:
for each candidate module, sub-original code data corresponding to the candidate module is obtained from a code warehouse, and code change information corresponding to the candidate module is determined according to the sub-original code data corresponding to the candidate module and the sub-target code data corresponding to the candidate module;
and determining the target module in the at least one candidate module according to the code change information corresponding to each of the at least one candidate module.
According to one or more embodiments of the present disclosure, the code change information corresponding to each candidate module includes: at least one of a number of lines of code change and a code change ratio; determining the target module in the at least one candidate module according to the code change information corresponding to the at least one candidate module, wherein the method comprises the following steps:
determining a candidate module meeting a preset condition in the at least one candidate module as the target module; wherein the preset conditions include at least one of the following:
The code change proportion is larger than or equal to a first preset threshold value;
the code change proportion is the largest;
the number of the code change lines is larger than or equal to a second preset threshold value.
According to one or more embodiments of the present disclosure, each question in the target questionnaire corresponds to a plurality of answers to be selected; according to the first questionnaire result, determining a code quality detection result corresponding to the target module, including:
analyzing the first questionnaire result to obtain at least one question and answer information provided by the code submitting user for each question; wherein the answer information of each question comprises at least one target answer in the plurality of answers to be selected;
and determining a code quality detection result corresponding to the target module according to the at least one question and the answer information corresponding to each question.
According to one or more embodiments of the present disclosure, determining a code quality detection result corresponding to the target module according to the at least one question and answer information corresponding to each question includes:
generating current quality investigation result information corresponding to the target module according to the at least one question and the answer information corresponding to each question, wherein the current quality investigation result information comprises the at least one question and the answer information corresponding to each question;
Determining the current quality score corresponding to the target module according to the weight information corresponding to the at least one question and the answer information corresponding to each question;
and determining a code quality detection result corresponding to the target module according to the current quality investigation result information and the current quality score.
According to one or more embodiments of the present disclosure, determining a code quality detection result corresponding to the target module according to the current quality investigation result information and the current quality score includes:
acquiring at least one historical quality score corresponding to the target module, and determining an average quality score corresponding to the target module according to the current quality score and the at least one historical quality score; wherein the historical quality score is obtained based on a historical questionnaire result corresponding to the target questionnaire;
acquiring at least one piece of historical quality survey result information corresponding to the target module, wherein the historical quality survey result information is obtained based on a historical questionnaire result corresponding to the target questionnaire;
and determining a code quality detection result corresponding to the target module according to the current quality investigation result information, the at least one historical quality investigation result information and the average quality score.
According to one or more embodiments of the present disclosure, after determining the code quality detection result corresponding to the target module according to the first questionnaire result, the method further includes:
determining a quality maintenance user corresponding to the target module;
and sending a code quality detection result corresponding to the target module to second terminal equipment corresponding to the quality maintenance user.
In a second aspect, according to one or more embodiments of the present disclosure, there is provided a code quality detection apparatus including:
the first determining module is used for determining a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation when the code submitting operation is monitored;
the second determining module is configured to determine a target questionnaire according to the target code data, where the target questionnaire includes: at least one question for querying code quality of the object code data;
the receiving and transmitting module is used for sending the target questionnaire to first terminal equipment corresponding to the code submitting user and receiving first questionnaire results corresponding to the target questionnaire from the first terminal equipment, wherein the first questionnaire results comprise: the code submitting answer information provided by the user for the at least one question;
And a third determining module, configured to determine a code quality detection result corresponding to the target code data according to the first questionnaire result.
According to one or more embodiments of the present disclosure, the object code data includes sub-object code data corresponding to a plurality of preset modules; the second determining module is specifically configured to:
determining a target module in the plurality of preset modules according to sub-target code data corresponding to the plurality of preset modules;
determining a questionnaire corresponding to the target module in a questionnaire database as the target questionnaire; the questionnaire database is used for storing questionnaires corresponding to different modules;
according to the first questionnaire result, determining a code quality detection result corresponding to the target code data, including:
and determining a code quality detection result corresponding to the target module according to the first questionnaire result.
According to one or more embodiments of the present disclosure, the second determining module is specifically configured to:
determining quality maintenance users corresponding to the preset modules respectively;
determining at least one candidate module in the plurality of preset modules according to quality maintenance users corresponding to the plurality of preset modules respectively, wherein the quality maintenance users corresponding to the candidate modules are different from the code submitting users;
And determining the target module in the at least one candidate module according to the subcode data corresponding to the at least one candidate module.
According to one or more embodiments of the present disclosure, the second determining module is specifically configured to:
for each candidate module, sub-original code data corresponding to the candidate module is obtained from a code warehouse, and code change information corresponding to the candidate module is determined according to the sub-original code data corresponding to the candidate module and the sub-target code data corresponding to the candidate module;
and determining the target module in the at least one candidate module according to the code change information corresponding to each of the at least one candidate module.
According to one or more embodiments of the present disclosure, the code change information corresponding to each candidate module includes: at least one of a number of lines of code change and a code change ratio; the second determining module is specifically configured to:
determining a candidate module meeting a preset condition in the at least one candidate module as the target module; wherein the preset conditions include at least one of the following:
the code change proportion is larger than or equal to a first preset threshold value;
The code change proportion is the largest;
the number of the code change lines is larger than or equal to a second preset threshold value.
According to one or more embodiments of the present disclosure, each question in the target questionnaire corresponds to a plurality of answers to be selected; the third determining module is specifically configured to:
analyzing the first questionnaire result to obtain at least one question and answer information provided by the code submitting user for each question; wherein the answer information of each question comprises at least one target answer in the plurality of answers to be selected;
and determining a code quality detection result corresponding to the target module according to the at least one question and the answer information corresponding to each question.
According to one or more embodiments of the present disclosure, the third determining module is specifically configured to:
generating current quality investigation result information corresponding to the target module according to the at least one question and the answer information corresponding to each question, wherein the current quality investigation result information comprises the at least one question and the answer information corresponding to each question;
determining the current quality score corresponding to the target module according to the weight information corresponding to the at least one question and the answer information corresponding to each question;
And determining a code quality detection result corresponding to the target module according to the current quality investigation result information and the current quality score.
According to one or more embodiments of the present disclosure, the third determining module is specifically configured to:
acquiring at least one historical quality score corresponding to the target module, and determining an average quality score corresponding to the target module according to the current quality score and the at least one historical quality score; wherein the historical quality score is obtained based on a historical questionnaire result corresponding to the target questionnaire;
acquiring at least one piece of historical quality survey result information corresponding to the target module, wherein the historical quality survey result information is obtained based on a historical questionnaire result corresponding to the target questionnaire;
and determining a code quality detection result corresponding to the target module according to the current quality investigation result information, the at least one historical quality investigation result information and the average quality score.
In accordance with one or more embodiments of the present disclosure, the transceiver module is further to:
determining a quality maintenance user corresponding to the target module;
And sending a code quality detection result corresponding to the target module to second terminal equipment corresponding to the quality maintenance user.
In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device comprising: a processor and a memory;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions to implement the method as described in the first aspect or any one of the designs of the first aspect.
In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement a method as set forth in the first aspect or any one of the designs of the first aspect.
In a fifth aspect, according to one or more embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method as described above in the first aspect or any of the designs of the first aspect.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (13)

1. A code quality detection method, comprising:
when the code submitting operation is monitored, determining a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation;
Determining a target questionnaire according to the target code data, wherein the target questionnaire comprises: at least one question for querying code quality of the object code data;
the target questionnaire is sent to first terminal equipment corresponding to the code submitting user, and first questionnaire results corresponding to the target questionnaire are received from the first terminal equipment, wherein the first questionnaire results comprise: the code submitting answer information provided by the user for the at least one question;
and determining a code quality detection result corresponding to the target code data according to the first questionnaire result.
2. The method of claim 1, wherein the object code data comprises sub-object code data corresponding to a plurality of preset modules; determining a target questionnaire according to the target code data, comprising:
determining a target module in the plurality of preset modules according to sub-target code data corresponding to the plurality of preset modules;
determining a questionnaire corresponding to the target module in a questionnaire database as the target questionnaire; the questionnaire database is used for storing questionnaires corresponding to different modules;
According to the first questionnaire result, determining a code quality detection result corresponding to the target code data, including:
and determining a code quality detection result corresponding to the target module according to the first questionnaire result.
3. The method of claim 2, wherein determining the target module among the plurality of preset modules according to the sub-target code data corresponding to the plurality of preset modules comprises:
determining quality maintenance users corresponding to the preset modules respectively;
determining at least one candidate module in the plurality of preset modules according to quality maintenance users corresponding to the plurality of preset modules respectively, wherein the quality maintenance users corresponding to the candidate modules are different from the code submitting users;
and determining the target module in the at least one candidate module according to the subcode data corresponding to the at least one candidate module.
4. The method of claim 3, wherein determining the target module among the at least one candidate module based on the sub-code data corresponding to the at least one candidate module comprises:
for each candidate module, sub-original code data corresponding to the candidate module is obtained from a code warehouse, and code change information corresponding to the candidate module is determined according to the sub-original code data corresponding to the candidate module and the sub-target code data corresponding to the candidate module;
And determining the target module in the at least one candidate module according to the code change information corresponding to each of the at least one candidate module.
5. The method of claim 4, wherein the code change information corresponding to each candidate block comprises: at least one of a number of lines of code change and a code change ratio; determining the target module in the at least one candidate module according to the code change information corresponding to the at least one candidate module, wherein the method comprises the following steps:
determining a candidate module meeting a preset condition in the at least one candidate module as the target module; wherein the preset conditions include at least one of the following:
the code change proportion is larger than or equal to a first preset threshold value;
the code change proportion is the largest;
the number of the code change lines is larger than or equal to a second preset threshold value.
6. The method of any one of claims 2 to 5, wherein each question in the target questionnaire corresponds to a plurality of answers to be selected; according to the first questionnaire result, determining a code quality detection result corresponding to the target module, including:
analyzing the first questionnaire result to obtain at least one question and answer information provided by the code submitting user for each question; wherein the answer information of each question comprises at least one target answer in the plurality of answers to be selected;
And determining a code quality detection result corresponding to the target module according to the at least one question and the answer information corresponding to each question.
7. The method of claim 6, wherein determining the code quality detection result corresponding to the target module according to the at least one question and the answer information corresponding to each question comprises:
generating current quality investigation result information corresponding to the target module according to the at least one question and the answer information corresponding to each question, wherein the current quality investigation result information comprises the at least one question and the answer information corresponding to each question;
determining the current quality score corresponding to the target module according to the weight information corresponding to the at least one question and the answer information corresponding to each question;
and determining a code quality detection result corresponding to the target module according to the current quality investigation result information and the current quality score.
8. The method of claim 7, wherein determining a code quality detection result corresponding to the target module according to the current quality survey result information and the current quality score comprises:
Acquiring at least one historical quality score corresponding to the target module, and determining an average quality score corresponding to the target module according to the current quality score and the at least one historical quality score; wherein the historical quality score is obtained based on a historical questionnaire result corresponding to the target questionnaire;
acquiring at least one piece of historical quality survey result information corresponding to the target module, wherein the historical quality survey result information is obtained based on a historical questionnaire result corresponding to the target questionnaire;
and determining a code quality detection result corresponding to the target module according to the current quality investigation result information, the at least one historical quality investigation result information and the average quality score.
9. The method according to any one of claims 2 to 8, further comprising, after determining a code quality detection result corresponding to the target module according to the first questionnaire result:
determining a quality maintenance user corresponding to the target module;
and sending a code quality detection result corresponding to the target module to second terminal equipment corresponding to the quality maintenance user.
10. A code quality detection apparatus, comprising:
the first determining module is used for determining a code submitting user corresponding to the code submitting operation and target code data indicated to be submitted by the code submitting operation when the code submitting operation is monitored;
the second determining module is configured to determine a target questionnaire according to the target code data, where the target questionnaire includes: at least one question for querying code quality of the object code data;
the receiving and transmitting module is used for sending the target questionnaire to first terminal equipment corresponding to the code submitting user and receiving first questionnaire results corresponding to the target questionnaire from the first terminal equipment, wherein the first questionnaire results comprise: the code submitting answer information provided by the user for the at least one question;
and a third determining module, configured to determine a code quality detection result corresponding to the target code data according to the first questionnaire result.
11. An electronic device, comprising: a processor and a memory;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions to implement the method of any one of claims 1 to 9.
12. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor implement the method of any one of claims 1 to 9.
13. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 9.
CN202210882478.6A 2022-07-26 2022-07-26 Code quality detection method, apparatus, device, storage medium, and program Pending CN117539740A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210882478.6A CN117539740A (en) 2022-07-26 2022-07-26 Code quality detection method, apparatus, device, storage medium, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210882478.6A CN117539740A (en) 2022-07-26 2022-07-26 Code quality detection method, apparatus, device, storage medium, and program

Publications (1)

Publication Number Publication Date
CN117539740A true CN117539740A (en) 2024-02-09

Family

ID=89786646

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210882478.6A Pending CN117539740A (en) 2022-07-26 2022-07-26 Code quality detection method, apparatus, device, storage medium, and program

Country Status (1)

Country Link
CN (1) CN117539740A (en)

Similar Documents

Publication Publication Date Title
CN110213614B (en) Method and device for extracting key frame from video file
CN109376419B (en) Data model generation method and device, electronic equipment and readable medium
CN112016284B (en) Electronic form processing method and device
CN110781658A (en) Resume analysis method and device, electronic equipment and storage medium
CN111327913B (en) Message processing method and device and electronic equipment
CN109902726B (en) Resume information processing method and device
CN112954056B (en) Method and device for processing monitoring data, electronic equipment and storage medium
CN112884376A (en) Work order processing method and device, electronic equipment and computer readable storage medium
CN109542743B (en) Log checking method and device, electronic equipment and computer readable storage medium
CN110727558A (en) Information prompting method and device, storage medium and electronic equipment
CN116072108A (en) Model generation method, voice recognition method, device, medium and equipment
CN113807056B (en) Document name sequence error correction method, device and equipment
CN117539740A (en) Code quality detection method, apparatus, device, storage medium, and program
CN112286808B (en) Application program testing method and device, electronic equipment and medium
CN111414161B (en) Method, device, medium and electronic equipment for generating IDL file
CN114185805A (en) Embedded point verification method, device, equipment and storage medium
CN110189000B (en) Grading unification method and device and storage medium
CN114116480A (en) Method, device, medium and equipment for determining application program test coverage rate
CN112036821B (en) Quantization method, quantization device, quantization medium and quantization electronic equipment based on grid map planning private line
CN115840016B (en) Backup reduction method, device, equipment and computer medium of chromatographic analysis system
CN116467178B (en) Database detection method, apparatus, electronic device and computer readable medium
US20240086850A1 (en) Method, apparatus, device and storage medium for data processing
CN112668194B (en) Automatic driving scene library information display method, device and equipment based on page
CN117493149A (en) Code security detection method, device, apparatus, storage medium, and program
CN111291199B (en) Information query method and device

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