Code processing methods, apparatus, devices, storage media, and program products

CN122570362APending Publication Date: 2026-08-14湖南长银五八消费金融股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-10
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0004]但是,不同项目在业务定位、影响范围、交付节奏上存在显著差异,若设置严苛的质量阈值,则会对非核心项目的代码进行过度拦截,拖慢非核心项目的交付速度,降低开发效率

Benefits of technology

[0037]上述代码处理方法、装置、设备、存储介质和程序产品,首先,在目标产品的开发过程中,响应于代码提交操作,获取目标产品所包含的子项目的项目代码,通过代码提交操作精准触发代码质检流程,自动抓取待校验代码,能够提升研发流程自动化程度;其次,基于代码扫描工具,对项目代码进行扫描,得到每一扫描维度下的扫描结果,实现了对项目代码的全面、精确检测;然后,基于子项目在每一扫描维度对应的维度阈值和扫描结果,确定项目代码的综合评估结果,通过针对不同子项目配置差异化的维度阈值,实现代码质量的个性化判定,能够适配不同子项目的管控标准;最后,在综合评估结果表征通过的情况下,将项目代码合并至目标产品的主代码,有效规避缺陷代码扩散,保障目标产品的整体代码质量与运行稳定性。基于上述方式,能够针对不同子项目灵活设置扫描维度的维度阈值,既满足核心子项目的严格质量管控,又适配非核心子项目的快速迭代需求,有效提升开发效率,并保证代码质量,减少后期故障排查、缺陷修复的成本,保证目标产品的运行稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122570362A_ABST
    Figure CN122570362A_ABST
Patent Text Reader

Abstract

This application relates to a code processing method, apparatus, device, storage medium, and program product. The method includes: during the development of a target product, in response to a code submission operation, obtaining project code for sub-projects included in the target product; scanning the project code using a code scanning tool to obtain scanning results for each scanning dimension; determining a comprehensive evaluation result for the project code based on the dimension threshold and scanning results corresponding to each scanning dimension for the sub-projects; and merging the project code into the main code of the target product if the comprehensive evaluation result indicates that the sub-projects have passed the evaluation. This method can improve the development efficiency of the target product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software development technology, and in particular to a code processing method, apparatus, device, storage medium, and program product. Background Technology

[0002] With the deep implementation of the development and operations (D&O) concept in the software development field, continuous integration and continuous delivery have become the mainstream development model, and collaborative development of multiple projects within the same product has become the norm in the development system.

[0003] During development, intercepting code that does not meet quality standards allows for control over code quality from the source, reducing the risk of failures in subsequent testing and maintenance phases and ensuring the stable progress of the overall development work. Currently, to ensure code quality, quality thresholds are typically set based on product dimensions, and code quality is evaluated based on these thresholds.

[0004] However, different projects have significant differences in business positioning, scope of impact, and delivery schedule. If strict quality thresholds are set, the code of non-core projects will be excessively intercepted, which will slow down the delivery speed of non-core projects and reduce development efficiency. Summary of the Invention

[0005] Therefore, it is necessary to provide a code processing method, apparatus, device, storage medium, and program product that can improve development efficiency in response to the above-mentioned technical problems.

[0006] Firstly, this application provides a code processing method, including:

[0007] During the development of the target product, in response to a code submission operation, the project code of the sub-projects contained in the target product is obtained;

[0008] The project code was scanned using a code scanning tool to obtain the scan results for each scanning dimension.

[0009] Based on the dimension threshold and scanning results corresponding to each scanning dimension of the sub-project, the comprehensive evaluation result of the project code is determined;

[0010] If the comprehensive evaluation results are satisfactory, the project code will be merged into the main code of the target product.

[0011] In one embodiment, the method further includes:

[0012] Based on the project priority of the sub-projects, determine the basic threshold for each scanning dimension;

[0013] Based on the project attribute information of the sub-project, the threshold adjustment amount is determined; the project attribute information includes at least one of the following: project complexity, historical defect status, and project iteration status of the sub-project.

[0014] Using the threshold adjustment amount, the basic threshold of each scanning dimension is adjusted to obtain the dimension threshold of the corresponding scanning dimension.

[0015] In one embodiment, determining the threshold adjustment amount based on the project attribute information of the sub-project includes:

[0016] Based on the project complexity, determine the first adjustment amount;

[0017] Based on the aforementioned historical defects, a second adjustment amount is determined;

[0018] Based on the project iterations, a third adjustment amount is determined;

[0019] The threshold adjustment amount is determined based on the first adjustment amount, the second adjustment amount, and the third adjustment amount.

[0020] In one embodiment, the method further includes:

[0021] Obtain defect detection data for each sub-project under the project priority; wherein, the defect detection data includes defect escape status and defect detection status; the defect escape status is used to describe the defect detection status after merging the project code of the corresponding sub-project into the main code, and the defect detection status is used to describe the defect detection status before merging the project code of the corresponding sub-project into the main code;

[0022] Based on the defect escape situation and the defect detection situation, the basic threshold of each scanning dimension is adjusted to obtain the adjusted basic threshold of each scanning dimension.

[0023] In one embodiment, determining the comprehensive evaluation result of the project code based on the dimension threshold and scan result corresponding to each scan dimension of the sub-project includes:

[0024] For each scanning dimension, the scanning result under the scanning dimension is evaluated based on the dimension threshold corresponding to the sub-item in the scanning dimension to obtain a sub-evaluation result;

[0025] Based on the results of each sub-evaluation, the overall evaluation result of the project code is determined.

[0026] In one embodiment, the method further includes:

[0027] If the comprehensive evaluation result fails, a notification message is sent to the management of the sub-project; wherein the notification message carries the comprehensive evaluation result.

[0028] Upon receiving the application information sent by the management based on the prompt information, if the project priority of the sub-project is higher than the specified priority, the project code will be merged into the main code of the target product; wherein, the application information is used to instruct the merging operation to be performed on the project code.

[0029] Secondly, this application also provides a code processing apparatus, comprising:

[0030] The response module is used to obtain the project code of the sub-projects contained in the target product in response to the code submission operation during the development process of the target product.

[0031] The scanning module is used to scan the project code based on a code scanning tool to obtain the scanning results for each scanning dimension.

[0032] The determination module is used to determine the comprehensive evaluation result of the project code based on the dimension threshold and scanning result corresponding to each scanning dimension of the sub-project;

[0033] The merging module is used to merge the project code into the main code of the target product if the comprehensive evaluation result characterization is passed.

[0034] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the various method embodiments provided in the first aspect above.

[0035] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the various method embodiments provided in the first aspect above.

[0036] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the various method embodiments provided in the first aspect above.

[0037] The aforementioned code processing methods, devices, equipment, storage media, and program products, firstly, during the development of the target product, respond to code submission operations to obtain the project code of the sub-projects included in the target product. The code submission operation precisely triggers the code quality inspection process, automatically capturing the code to be verified, thus improving the automation level of the R&D process. Secondly, based on code scanning tools, the project code is scanned to obtain the scanning results for each scanning dimension, achieving comprehensive and accurate detection of the project code. Then, based on the dimension thresholds and scanning results corresponding to each scanning dimension for the sub-projects, a comprehensive evaluation result of the project code is determined. By configuring differentiated dimension thresholds for different sub-projects, personalized judgment of code quality is achieved, adapting to the control standards of different sub-projects. Finally, if the comprehensive evaluation result indicates that the code passes, the project code is merged into the main code of the target product, effectively preventing the spread of defective code and ensuring the overall code quality and operational stability of the target product. Based on the above approach, the dimensional thresholds for scanning dimensions can be flexibly set for different sub-projects. This satisfies the strict quality control requirements of core sub-projects while adapting to the rapid iteration needs of non-core sub-projects, effectively improving development efficiency, ensuring code quality, reducing the cost of later troubleshooting and defect repair, and ensuring the operational stability of the target product. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1 This is a diagram illustrating the application environment of a code processing method in one embodiment.

[0040] Figure 2 This is a flowchart illustrating a code processing method in one embodiment;

[0041] Figure 3 This is a flowchart illustrating a dimension thresholding method in one embodiment;

[0042] Figure 4 This is a flowchart illustrating the steps for determining the comprehensive evaluation results in one embodiment;

[0043] Figure 5 This is a flowchart illustrating the code merging method in one embodiment;

[0044] Figure 6 This is a flowchart illustrating the code processing method in another embodiment;

[0045] Figure 7 This is a structural block diagram of a code processing device in one embodiment;

[0046] Figure 8 This is an internal structural diagram of a computer device in one embodiment;

[0047] Figure 9 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0049] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0050] With the deep implementation of the Development and Operations (DevOps) concept in the software development field, continuous integration and continuous delivery have become the mainstream development model, and collaborative development of multiple projects within the same product has become the norm in the development system.

[0051] During development, intercepting code that does not meet quality standards allows for control over code quality from the source, reducing the risk of failures in subsequent testing and maintenance phases and ensuring the stable progress of the overall development work. Currently, to ensure code quality, quality thresholds are typically set based on product dimensions, and code quality is evaluated based on these thresholds.

[0052] However, different projects have significant differences in business positioning, scope of impact, and delivery schedule. If strict quality thresholds are set, the code of non-core projects will be excessively intercepted, which will slow down the delivery speed of non-core projects and reduce development efficiency.

[0053] In view of this, a code processing method, apparatus, device, storage medium, and program product are proposed. First, during the development of the target product, in response to code submission operations, the project code of the sub-projects included in the target product is obtained. The code submission operation precisely triggers the code quality inspection process, automatically capturing the code to be verified, which can improve the automation level of the R&D process. Second, based on a code scanning tool, the project code is scanned to obtain the scan results under each scanning dimension, realizing comprehensive and accurate detection of the project code. Then, based on the dimension thresholds and scan results corresponding to each scanning dimension of the sub-project, the comprehensive evaluation result of the project code is determined. By configuring differentiated dimension thresholds for different sub-projects, personalized judgment of code quality can be achieved, which can adapt to the control standards of different sub-projects. Finally, if the comprehensive evaluation result indicates that the code passes, the project code is merged into the main code of the target product, effectively avoiding the spread of defective code and ensuring the overall code quality and operational stability of the target product. Based on the above approach, the dimensional thresholds for scanning dimensions can be flexibly set for different sub-projects. This satisfies the strict quality control requirements of core sub-projects while adapting to the rapid iteration needs of non-core sub-projects, effectively improving development efficiency, ensuring code quality, reducing the cost of later troubleshooting and defect repair, and ensuring the operational stability of the target product.

[0054] The code processing method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Optionally, during the development of the target product, terminal 102 submits the project code of the sub-projects included in the target product. Server 104 responds to the code submission operation, obtains the project code, scans the project code using a code scanning tool, obtains the scan results for each scan dimension, determines the comprehensive evaluation result of the project code based on the dimension threshold and scan results corresponding to each scan dimension of the sub-project, and merges the project code into the main code of the target product if the comprehensive evaluation result is satisfactory.

[0055] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, etc. The server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0056] In one exemplary embodiment, such as Figure 2 As shown, a code processing method is provided, which is applied to... Figure 1 Taking server 104 as an example, the explanation includes:

[0057] S201, during the development of the target product, in response to the code submission operation, obtain the project code of the sub-projects contained in the target product.

[0058] The target product is developed in a multi-project collaborative R&D scenario. In other words, the target product contains multiple sub-projects, and each sub-project contains some of the functions of the target product. By dividing the target product into multiple sub-projects for collaborative development, different sub-projects can be developed based on different management parties, thereby improving development efficiency. After the project code of any sub-project is submitted and approved, it can be merged into the main code of the target product.

[0059] Code submission can be triggered by the developer of a sub-project (i.e., the developer). Alternatively, the developer can submit project code to the target branch through a code review tool. In this case, server 104 can be the backend server of the code review tool. The target branch can be the main branch, development branch, feature branch, bug fix branch, release branch, etc.

[0060] S202, based on a code scanning tool, scans the project code and obtains the scan results for each scanning dimension.

[0061] The code scanning tool can scan the project code under each scanning dimension, and different scanning dimensions can be set according to actual needs. Optionally, scanning dimensions can include code formatting compliance, used to review the project code's coding style, format, and naming conventions; scanning dimensions can include code quality, used to review vulnerabilities, defects, and security risks in the project code; and scanning dimensions can include code test coverage, used to review the project code's unit test coverage. It should be noted that the scanning dimensions listed above are only illustrative examples, and specific settings should be made according to actual circumstances.

[0062] The specific content included in the scan results under different scanning dimensions usually varies. For example, when the scanning dimension is code format compliance, the scan results may include code compliance rate; when the scanning dimension is code quality, the scan results may include the number of defects; when the scanning dimension is code test coverage, the scan results may include unit test coverage, and so on.

[0063] S203, based on the dimension threshold and scan results corresponding to each scan dimension of the sub-project, determine the comprehensive evaluation result of the project code.

[0064] It is understandable that different sub-projects may have differences in business positioning, scope of influence, and delivery schedule. The dimension thresholds corresponding to the same scanning dimension for different sub-projects should also be different, so as to flexibly adopt different evaluation standards for different sub-projects and improve the accuracy of evaluation.

[0065] Since different scanning dimensions scan different content of sub-projects, the dimension thresholds used to evaluate the scan results are usually different. For example, if the scan results include the number of defects, the dimension threshold can be a quantity threshold; if the scan results include unit test coverage, the dimension threshold can be a coverage threshold.

[0066] The overall evaluation result is determined based on the scan results under each scan dimension and is used to comprehensively represent the evaluation results of the project code.

[0067] S204, if the comprehensive evaluation results are satisfactory, the project code will be merged into the main code of the target product.

[0068] Understandably, if the comprehensive evaluation results indicate that the project code has passed the review, then the project code can be merged.

[0069] Optionally, if the comprehensive evaluation results are deemed satisfactory, a merged license instruction is sent to the code review tool, and the evaluation log (including dimensional thresholds and comprehensive evaluation results) is synchronously recorded to the data storage node.

[0070] In the above method, firstly, during the development of the target product, in response to code submission operations, the project code of the sub-projects included in the target product is obtained. The code submission operation precisely triggers the code quality inspection process, automatically capturing the code to be verified, thus improving the automation level of the R&D process. Secondly, based on code scanning tools, the project code is scanned, obtaining the scan results for each scanning dimension, achieving comprehensive and accurate detection of the project code. Then, based on the dimension thresholds and scan results corresponding to each scanning dimension for the sub-projects, the comprehensive evaluation result of the project code is determined. By configuring differentiated dimension thresholds for different sub-projects, personalized judgment of code quality is achieved, adapting to the control standards of different sub-projects. Finally, if the comprehensive evaluation result indicates that the code passes, the project code is merged into the main code of the target product, effectively preventing the spread of defective code and ensuring the overall code quality and operational stability of the target product. Based on this approach, dimension thresholds for scanning dimensions can be flexibly set for different sub-projects, satisfying both the strict quality control of core sub-projects and the rapid iteration needs of non-core sub-projects, effectively improving development efficiency, ensuring code quality, reducing the cost of later troubleshooting and defect repair, and ensuring the operational stability of the target product.

[0071] In one exemplary embodiment, such as Figure 3 As shown, the dimensional thresholds for each scanning dimension are determined as follows:

[0072] S301 determines the basic threshold for each scan dimension based on the project priority of the sub-project.

[0073] The project priorities of different sub-projects can be set according to actual needs. For example, a standardized three-level priority system can be constructed, including three priorities: P0, P1, and P2. Among them, P0 (core and urgent) priority sub-projects directly affect core business, have a user base of ≥10 million, and have a failure loss of ≥100,000 yuan / hour; P1 (important but not urgent) priority sub-projects support non-critical links of core business, with a user base of 1-10 million; P2 (generally important) priority sub-projects are usually internal tools and auxiliary systems, with a user base of <1 million.

[0074] Based on project priority, basic thresholds for each scanning dimension can be pre-set. For example, with project priority P0, the basic threshold for unit test coverage is 90%, the basic threshold for fatal / critical defects is 0, the basic threshold for general defects is 2, and the basic threshold for code style compliance rate is 99%. With project priority P1, the basic threshold for unit test coverage is 80%, the basic threshold for fatal defects is 0, the basic threshold for critical defects is 3, the basic threshold for general defects is 5, and the basic threshold for code style compliance rate is 95%. With project priority P2, the basic threshold for unit test coverage is 60%, the basic threshold for fatal defects is 0, the basic threshold for critical defects is 5, and the basic threshold for code style compliance rate is 90%.

[0075] If the project priority of a sub-project changes during the evaluation and review process of the project code, the corresponding basic thresholds will also be updated. In this case, the current evaluation will be immediately interrupted, the dimensional thresholds for each scanned dimension will be recalculated, and a new round of review will be initiated. Based on the above method, the new thresholds can be quickly synchronized after a priority change without manual adjustment. The response latency has been reduced from hours to seconds, reducing operational costs and human error.

[0076] S302, Determine the threshold adjustment amount based on the project attribute information of the sub-project.

[0077] Since the base threshold is determined based on the project priority of the sub-projects, the base threshold is the same for projects with the same priority. Therefore, to make the dimensional threshold of each scan dimension more consistent with the actual situation of the sub-projects, the threshold adjustment amount of the base threshold can be determined based on the project attribute information. The project attribute information includes at least one of the following: project complexity, historical defect status, and project iteration status. Among them, project complexity can be determined based on at least one of the following: number of lines of code, number of interfaces, and number of dependent modules; historical defect status can be determined based on the project defect rate within a specified period, which can be set according to actual needs, such as the past 3 months, the past 1 month, etc.; project iteration status can be determined based on whether the sub-project is in an urgent iteration period. If the sub-project is in an urgent iteration period, it indicates that the sub-project has unstable operation issues and needs to be rapidly iterated in a short period of time.

[0078] S303 uses a threshold adjustment amount to adjust the basic threshold of each scanning dimension to obtain the dimension threshold of the corresponding scanning dimension.

[0079] Optionally, for each scan dimension, the sum of the threshold adjustment amount and the base threshold of the scan dimension is used as the dimension threshold of the scan dimension. For example, if the threshold adjustment amount is 0.1 and the base threshold of the scan dimension is 0.7, then the dimension threshold of the scan dimension is 0.8.

[0080] In the above embodiments, based on the project priority and threshold adjustment amount of the sub-project, the dimension threshold of different sub-projects under the same scanning dimension is managed differently. This makes the dimension threshold more consistent with the actual situation of the sub-project, thereby enabling a more accurate evaluation of the project code of the sub-project and balancing code development efficiency and code quality.

[0081] In one embodiment, step S302, determining the threshold adjustment amount, can be implemented as follows:

[0082] Based on project complexity, determine the first adjustment amount; based on historical defects, determine the second adjustment amount; based on project iterations, determine the third adjustment amount; based on the first, second, and third adjustment amounts, determine the threshold adjustment amount.

[0083] Optionally, project complexity is positively correlated with the first adjustment amount; that is, the higher the project complexity, the larger the first adjustment amount. Optionally, when historical defect data includes the project defect rate, the project defect rate is compared with the average defect rate of each sub-project. If the project defect rate is greater than the average defect rate, the second adjustment amount is positive; if the project defect rate is less than the average defect rate, the second adjustment amount is negative; if the project defect rate equals the average defect rate, the second adjustment amount can be 0. Optionally, if a sub-project is in an urgent iteration period, indicating that the sub-project has an unstable operation problem, and in order to solve the unstable operation problem, the project code needs to be strictly reviewed. In this case, the third adjustment amount is positive, that is, the base threshold is increased through the third adjustment amount. If the sub-project is not in an urgent iteration period, the third adjustment amount can be negative, or the third adjustment amount is equal to 0.

[0084] In one embodiment, the sum of the first adjustment amount, the second adjustment amount, and the third adjustment amount is used only as the threshold adjustment amount.

[0085] In the above embodiments, the adjustment amount is determined by the project complexity, historical defects, and project iteration, and the threshold adjustment amount is determined by combining the adjustment amounts. This makes the dimensional threshold more consistent with the actual situation of the sub-project, thereby enabling a more accurate evaluation of the sub-project's code and balancing code development efficiency and code quality.

[0086] In one embodiment, defect detection data of each sub-project under the project priority is obtained; based on the defect escape situation and defect detection situation, the basic threshold of each scanning dimension is adjusted to obtain the adjusted basic threshold of each scanning dimension.

[0087] For each project priority, defect detection data can be collected to determine the appropriateness of the basic threshold for that priority. This defect detection data includes defect escape and defect detection data. Defect escape data describes the defect detection situation after merging the code of the corresponding sub-project into the main code. For example, defect escape data can include a defect escape rate, determined by the ratio of unblocked defects discovered during the deployment phase to the total number of defects. Defect detection data describes the defect detection situation before merging the code of the corresponding sub-project into the main code. For example, defect detection data can include an audit blocking rate, determined by the ratio of the number of project codes that failed the comprehensive evaluation to the total number of submitted project codes.

[0088] Understandably, a high defect escape rate indicates a need to strengthen the review of project code, and therefore the basic threshold can be raised; conversely, a high review blockage rate indicates a large number of project codes that fail the comprehensive evaluation, hindering code merging, and therefore the basic threshold can be lowered.

[0089] For example, if the defect escape rate under project priority 1 is >5%, the corresponding basic threshold will be automatically increased by 5%~10%; if the review blocking rate is >30%, the basic threshold will be automatically decreased by 3%~5%; the optimized threshold parameters will be verified in pilot projects first, and will be fully implemented after verification, while retaining historical parameter versions for rollback.

[0090] In the above embodiments, the basic threshold is dynamically adjusted based on defect detection data, thereby adjusting the dimensional threshold in real time. This allows the dimensional threshold to continuously adapt to the R&D scenario, improve the rationality of the threshold, and reduce the frequency of manual intervention.

[0091] In one exemplary embodiment, such as Figure 4 As shown, the steps in S203 to determine the comprehensive evaluation results of the project code can be implemented as follows:

[0092] S401, for each scanning dimension, based on the dimension threshold corresponding to the sub-item in the scanning dimension, evaluate the scanning results in the scanning dimension to obtain the sub-evaluation results.

[0093] Specifically, the dimensional threshold and scan results under the same scan dimension are compared to obtain the sub-evaluation result. The sub-evaluation result is used to characterize whether the sub-item has passed the scan under the scan dimension. For example, if the scan result includes unit test coverage, and the unit test coverage of the sub-item is greater than the dimensional threshold, then the sub-evaluation result is passed.

[0094] S402, based on the results of each sub-evaluation, determine the comprehensive evaluation result of the project code.

[0095] Optionally, if all sub-evaluation results are deemed passed, the overall evaluation result of the project code is deemed passed; if any sub-evaluation result is deemed failed, the overall evaluation result of the project code is deemed failed.

[0096] In the above embodiments, the comprehensive evaluation results are obtained by combining the sub-evaluation results under each scanning dimension. This comprehensive and accurate evaluation of the project code can improve the accuracy of the comprehensive evaluation results and thus ensure code quality.

[0097] In one exemplary embodiment, such as Figure 5 As shown, if the comprehensive evaluation results fail to meet the requirements, the following steps shall be performed:

[0098] S501, send a notification message to the management of the sub-project.

[0099] The notification message carries the comprehensive evaluation results and is used to notify the management that the sub-project evaluation failed.

[0100] Optionally, if the comprehensive evaluation results fail to meet the requirements, rectification suggestions can be pushed to the developers of the sub-project to help them quickly correct the project code. The rectification suggestions may include the scanning dimensions that fail to meet the requirements of the sub-evaluation results, the gap between the sub-evaluation results and the dimension thresholds, etc.

[0101] S502: After receiving the application information sent by the management based on the prompt message, if the project priority of the sub-project is higher than the specified priority, the project code will be merged into the main code of the target product.

[0102] Understandably, after receiving the prompt message, the administrator can send an application message to instruct the project code to be merged. Correspondingly, the server does not execute the merge operation immediately upon receiving the application message, but rather determines whether to perform the merge operation based on the project priority. If the project priority is higher than the specified priority, the merge operation can be executed. The specified priority can be set according to experience and actual needs. For example, if the specified priority is P1, then the merge operation can be executed if the project priority is P0.

[0103] Optionally, after performing the merge operation, the merge operation and the subsequent rectification of the project code are recorded and included in historical data for threshold self-optimization.

[0104] In the above embodiments, if the comprehensive evaluation result fails, the mechanism based on prompt information and application information can flexibly determine whether to perform a merge operation for project code with high project priority, thereby improving code development efficiency.

[0105] In one embodiment, a code processing system is proposed, comprising a data access layer, a core computing layer, an audit execution layer, and a result output layer. Each layer is deployed based on existing DevOps server resources, and the entire control process is automated without manual intervention. Specifically, the data access layer automatically synchronizes project priority and project attribute information from the DevOps project management module via an interface, supporting manual adjustment of project priorities by the operations team (the adjustment operation is fully traceable and synchronized to the core computing module and data storage nodes). The threshold calculation submodule of the core computing layer calls the basic threshold table and, combined with the project attribute information synchronized from the data access module, calculates the threshold adjustment amount for the basic threshold, ultimately generating the dimensional thresholds for each scanning dimension. Developers submit project code to the target branch through a code review tool. The data access module captures the code submission trigger signal, synchronizes the submission information to the core computing module, and initiates the code scanning process. The audit execution layer receives the dimensional thresholds (also known as dynamic thresholds) for each scanning dimension from the core computing module, calls various code scanning algorithms to perform targeted verification on the project code, collects the sub-evaluation results output by each code scanning algorithm in real time, synchronizes them to the core computing module, and performs comparative analysis based on the dimensional thresholds for each scanning dimension. If all sub-assessment results are deemed satisfactory, the core calculation module determines that the assessment is passed, sends a merge permission instruction to the code review tool through the result processing module, and simultaneously records the review log (including dimension thresholds, assessment results, and project priority) to the data storage node. If some sub-assessment results are deemed unsatisfactory, the core calculation module determines that the assessment is blocked, the result processing module triggers an alarm, pushes rectification suggestions to the developers, and synchronizes the blocking status with the project manager. The project manager of a P0-level sub-project can submit application information through the operations and maintenance terminal, and the code merge will be temporarily allowed after the application is approved. In addition, it supports adding new scanning dimensions such as security scans, expanding priority levels, and is compatible with DevOps systems of different sizes. Hardware modules can be flexibly replaced, and the software interface supports multi-protocol adaptation.

[0106] Based on the above embodiments, in an exemplary embodiment, such as Figure 6 As shown, the code processing method in this application embodiment may include the following steps:

[0107] S601: During the development of the target product, the basic threshold for each scanning dimension is determined based on the project priority of the sub-projects included in the target product.

[0108] S602: Determine the first adjustment amount based on project complexity; determine the second adjustment amount based on historical defect data; determine the third adjustment amount based on project iteration data; and determine the threshold adjustment amount based on the first, second, and third adjustment amounts.

[0109] S603: Using threshold adjustment, the basic threshold of each scanning dimension is adjusted to obtain the dimension threshold of the corresponding scanning dimension.

[0110] S604: Retrieves the project code of a subproject in response to a code commit operation.

[0111] S605: Based on code scanning tools, it scans the project code and obtains the scan results for each scanning dimension.

[0112] S606: For each scanning dimension, based on the dimension threshold corresponding to the sub-item in the scanning dimension, evaluate the scanning results in the scanning dimension to obtain the sub-evaluation results.

[0113] S607: Based on the results of each sub-evaluation, determine the comprehensive evaluation result of the project code.

[0114] S608: If the comprehensive evaluation results fail to meet the requirements, a notification message will be sent to the management of the sub-project.

[0115] The notification message includes the comprehensive evaluation results.

[0116] S609: After receiving the application information sent by the management based on the prompt message, if the project priority of the sub-project is higher than the specified priority, merge the project code into the main code of the target product.

[0117] The application information is used to instruct the merging operation to be performed on the project code.

[0118] The specific implementation methods of S601-S609 are the same as those in the above method embodiments, and will not be repeated here.

[0119] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0120] Based on the same inventive concept, this application also provides a code processing apparatus for implementing the code processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more code processing apparatus embodiments provided below can be found in the limitations of the code processing method described above, and will not be repeated here.

[0121] In one exemplary embodiment, such as Figure 7 As shown, a code processing apparatus is provided, including: a response module 701, a scanning module 702, a determination module 703, and a merging module 704, wherein:

[0122] Response module 701 is used to obtain the project code of the sub-projects contained in the target product in response to the code submission operation during the development process of the target product.

[0123] The scanning module 702 is used to scan the project code based on a code scanning tool and obtain the scanning results for each scanning dimension.

[0124] The determination module 703 is used to determine the comprehensive evaluation result of the project code based on the dimension threshold and scan result corresponding to each scan dimension of the sub-project;

[0125] The merging module 704 is used to merge the project code into the main code of the target product if the comprehensive evaluation results are satisfactory.

[0126] In one embodiment, the device further includes an adjustment module, comprising:

[0127] The first determining unit is used to determine the basic threshold for each scanning dimension based on the project priority of the sub-project.

[0128] The second determining unit is used to determine the threshold adjustment amount based on the project attribute information of the sub-project; the project attribute information includes at least one of the following: project complexity, historical defect status, and project iteration status of the sub-project.

[0129] The threshold adjustment unit is used to adjust the basic threshold of each scanning dimension by using a threshold adjustment amount to obtain the dimension threshold of the corresponding scanning dimension.

[0130] In one embodiment, the second determining unit is specifically used for:

[0131] Determine the first adjustment amount based on the project's complexity;

[0132] Based on historical defects, the second adjustment amount is determined;

[0133] Based on the project iterations, determine the third adjustment amount;

[0134] The threshold adjustment amount is determined based on the first adjustment amount, the second adjustment amount, and the third adjustment amount.

[0135] In one embodiment, the adjustment module is further configured to:

[0136] Obtain defect detection data for each sub-project under the project priority; the defect detection data includes defect escape status and defect detection status; the defect escape status is used to describe the defect detection status after merging the project code of the corresponding sub-project into the main code, and the defect detection status is used to describe the defect detection status before merging the project code of the corresponding sub-project into the main code;

[0137] Based on the defect escape and defect detection, the base threshold for each scanning dimension is adjusted to obtain the adjusted base threshold for each scanning dimension.

[0138] In one embodiment, the determining module 703 is specifically used for:

[0139] For each scanning dimension, the scanning results under the scanning dimension are evaluated based on the dimension threshold corresponding to the sub-item in the scanning dimension, and a sub-evaluation result is obtained.

[0140] Based on the results of each sub-evaluation, the overall evaluation result of the project code is determined.

[0141] In one embodiment, the merging module 704 is further configured to:

[0142] If the overall evaluation result fails to meet the requirements, a notification message will be sent to the management of the sub-project; the notification message will include the overall evaluation result.

[0143] Upon receiving the application information sent by the management based on the prompt message, if the project priority of the sub-project is higher than the specified priority, the project code will be merged into the main code of the target product; the application information is used to instruct the merging operation to be performed on the project code.

[0144] Each module in the aforementioned code processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0145] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores code data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a code processing method.

[0146] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a code processing method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0147] Those skilled in the art will understand that Figure 8The structure shown in Figure 9 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0148] In one exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor, when executing the computer program, performs the following: during the development of a target product, in response to a code submission operation, obtains the project code of sub-projects included in the target product; scans the project code using a code scanning tool to obtain scan results for each scan dimension; determines a comprehensive evaluation result of the project code based on the dimension threshold and scan results corresponding to each scan dimension of the sub-project; and merges the project code into the main code of the target product if the comprehensive evaluation result is satisfactory.

[0149] In one embodiment, when the processor executes the computer program, it further implements: determining a basic threshold for each scan dimension based on the project priority of the sub-project; determining a threshold adjustment amount based on the project attribute information of the sub-project; the project attribute information includes at least one of the sub-project's project complexity, historical defect status, and project iteration status; and adjusting the basic threshold for each scan dimension using the threshold adjustment amount to obtain the dimension threshold for the corresponding scan dimension.

[0150] In one embodiment, when the processor executes the computer program, it specifically implements: determining a first adjustment amount based on project complexity; determining a second adjustment amount based on historical defect data; determining a third adjustment amount based on project iteration data; and determining a threshold adjustment amount based on the first, second, and third adjustment amounts.

[0151] In one embodiment, when the processor executes the computer program, it further implements: acquiring defect detection data for each sub-project under the project priority; wherein the defect detection data includes defect escape status and defect detection status; the defect escape status is used to describe the defect detection status after merging the project code of the corresponding sub-project into the main code, and the defect detection status is used to describe the defect detection status before merging the project code of the corresponding sub-project into the main code; based on the defect escape status and defect detection status, adjusting the basic threshold of each scanning dimension to obtain the adjusted basic threshold of each scanning dimension.

[0152] In one embodiment, when the processor executes the computer program, it specifically implements the following: for each scanning dimension, based on the dimension threshold corresponding to the sub-item in the scanning dimension, the scanning result under the scanning dimension is evaluated to obtain a sub-evaluation result; based on each sub-evaluation result, the comprehensive evaluation result of the project code is determined.

[0153] In one embodiment, when the processor executes the computer program, it further implements: sending a prompt message to the management of the sub-project if the comprehensive evaluation result fails; wherein the prompt message carries the comprehensive evaluation result; after receiving the application information sent by the management based on the prompt message, merging the project code into the main code of the target product if the project priority of the sub-project is higher than the specified priority; wherein the application information is used to instruct the merging operation to be performed on the project code.

[0154] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the following: during the development of a target product, in response to a code submission operation, obtaining the project code of the sub-projects included in the target product; scanning the project code using a code scanning tool to obtain the scan results for each scan dimension; determining the comprehensive evaluation result of the project code based on the dimension threshold and scan results corresponding to each scan dimension of the sub-projects; and merging the project code into the main code of the target product if the comprehensive evaluation result is satisfactory.

[0155] In one embodiment, when the computer program is executed by the processor, it further implements: determining a basic threshold for each scan dimension based on the project priority of the sub-project; determining a threshold adjustment amount based on the project attribute information of the sub-project; the project attribute information includes at least one of the project complexity, historical defect status, and project iteration status of the sub-project; and adjusting the basic threshold for each scan dimension using the threshold adjustment amount to obtain the dimension threshold for the corresponding scan dimension.

[0156] In one embodiment, when the computer program is executed by the processor, it specifically implements: determining a first adjustment amount based on project complexity; determining a second adjustment amount based on historical defect data; determining a third adjustment amount based on project iteration data; and determining a threshold adjustment amount based on the first, second, and third adjustment amounts.

[0157] In one embodiment, when the computer program is executed by the processor, it further implements: acquiring defect detection data for each sub-project under the project priority; wherein the defect detection data includes defect escape status and defect detection status; the defect escape status is used to describe the defect detection status after merging the project code of the corresponding sub-project into the main code, and the defect detection status is used to describe the defect detection status before merging the project code of the corresponding sub-project into the main code; based on the defect escape status and defect detection status, adjusting the basic threshold of each scanning dimension to obtain the adjusted basic threshold of each scanning dimension.

[0158] In one embodiment, when the computer program is executed by the processor, it specifically implements the following: for each scanning dimension, based on the dimension threshold corresponding to the sub-item in the scanning dimension, the scanning result under the scanning dimension is evaluated to obtain a sub-evaluation result; based on each sub-evaluation result, the comprehensive evaluation result of the project code is determined.

[0159] In one embodiment, when the computer program is executed by the processor, it further implements: sending a prompt message to the management of the sub-project if the comprehensive evaluation result fails; wherein the prompt message carries the comprehensive evaluation result; and after receiving the application information sent by the management based on the prompt message, merging the project code into the main code of the target product if the project priority of the sub-project is higher than the specified priority; wherein the application information is used to instruct the merging operation to be performed on the project code.

[0160] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the following: during the development of a target product, in response to a code submission operation, obtaining project code for sub-projects included in the target product; scanning the project code using a code scanning tool to obtain scanning results for each scanning dimension; determining a comprehensive evaluation result for the project code based on the dimension threshold and scanning results corresponding to each sub-project in each scanning dimension; and merging the project code into the main code of the target product if the comprehensive evaluation result is satisfactory.

[0161] In one embodiment, when the computer program is executed by the processor, it further implements: determining a basic threshold for each scan dimension based on the project priority of the sub-project; determining a threshold adjustment amount based on the project attribute information of the sub-project; the project attribute information includes at least one of the project complexity, historical defect status, and project iteration status of the sub-project; and adjusting the basic threshold for each scan dimension using the threshold adjustment amount to obtain the dimension threshold for the corresponding scan dimension.

[0162] In one embodiment, when the computer program is executed by the processor, it specifically implements: determining a first adjustment amount based on project complexity; determining a second adjustment amount based on historical defect data; determining a third adjustment amount based on project iteration data; and determining a threshold adjustment amount based on the first, second, and third adjustment amounts.

[0163] In one embodiment, when the computer program is executed by the processor, it further implements: acquiring defect detection data for each sub-project under the project priority; wherein the defect detection data includes defect escape status and defect detection status; the defect escape status is used to describe the defect detection status after merging the project code of the corresponding sub-project into the main code, and the defect detection status is used to describe the defect detection status before merging the project code of the corresponding sub-project into the main code; based on the defect escape status and defect detection status, adjusting the basic threshold of each scanning dimension to obtain the adjusted basic threshold of each scanning dimension.

[0164] In one embodiment, when the computer program is executed by the processor, it specifically implements the following: for each scanning dimension, based on the dimension threshold corresponding to the sub-item in the scanning dimension, the scanning result under the scanning dimension is evaluated to obtain a sub-evaluation result; based on each sub-evaluation result, the comprehensive evaluation result of the project code is determined.

[0165] In one embodiment, when the computer program is executed by the processor, it further implements: sending a prompt message to the management of the sub-project if the comprehensive evaluation result fails; wherein the prompt message carries the comprehensive evaluation result; and after receiving the application information sent by the management based on the prompt message, merging the project code into the main code of the target product if the project priority of the sub-project is higher than the specified priority; wherein the application information is used to instruct the merging operation to be performed on the project code.

[0166] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0167] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0168] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0169] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A code processing method, characterized in that, The method includes: During the development of the target product, in response to a code submission operation, the project code of the sub-projects contained in the target product is obtained; The project code was scanned using a code scanning tool to obtain the scan results for each scanning dimension. Based on the dimension threshold and scanning results corresponding to each scanning dimension of the sub-project, the comprehensive evaluation result of the project code is determined; If the comprehensive evaluation results are satisfactory, the project code will be merged into the main code of the target product.

2. The method according to claim 1, characterized in that, The method further includes: Based on the project priority of the sub-projects, determine the basic threshold for each scanning dimension; Based on the project attribute information of the sub-project, the threshold adjustment amount is determined; the project attribute information includes at least one of the following: project complexity, historical defect status, and project iteration status of the sub-project. Using the threshold adjustment amount, the basic threshold of each scanning dimension is adjusted to obtain the dimension threshold of the corresponding scanning dimension.

3. The method according to claim 2, characterized in that, The process of determining the threshold adjustment amount based on the project attribute information of the sub-project includes: Based on the project complexity, determine the first adjustment amount; Based on the aforementioned historical defects, a second adjustment amount is determined; Based on the project iterations, a third adjustment amount is determined; The threshold adjustment amount is determined based on the first adjustment amount, the second adjustment amount, and the third adjustment amount.

4. The method according to claim 2, characterized in that, The method further includes: Obtain defect detection data for each sub-project under the project priority; wherein, the defect detection data includes defect escape status and defect detection status; the defect escape status is used to describe the defect detection status after merging the project code of the corresponding sub-project into the main code, and the defect detection status is used to describe the defect detection status before merging the project code of the corresponding sub-project into the main code; Based on the defect escape situation and the defect detection situation, the basic threshold of each scanning dimension is adjusted to obtain the adjusted basic threshold of each scanning dimension.

5. The method according to any one of claims 1 to 4, characterized in that, The determination of the comprehensive evaluation result of the project code based on the dimension threshold and scan result corresponding to each scan dimension of the sub-project includes: For each scanning dimension, the scanning result under the scanning dimension is evaluated based on the dimension threshold corresponding to the sub-item in the scanning dimension to obtain a sub-evaluation result; Based on the results of each sub-evaluation, the overall evaluation result of the project code is determined.

6. The method according to any one of claims 1 to 4, characterized in that, The method further includes: If the comprehensive evaluation result fails, a notification message is sent to the management of the sub-project; wherein the notification message carries the comprehensive evaluation result. Upon receiving the application information sent by the management based on the prompt information, if the project priority of the sub-project is higher than the specified priority, the project code will be merged into the main code of the target product; wherein, the application information is used to instruct the merging operation to be performed on the project code.

7. A code processing device, characterized in that, The device includes: The response module is used to obtain the project code of the sub-projects contained in the target product in response to the code submission operation during the development process of the target product. The scanning module is used to scan the project code based on a code scanning tool to obtain the scanning results for each scanning dimension. The determination module is used to determine the comprehensive evaluation result of the project code based on the dimension threshold and scanning result corresponding to each scanning dimension of the sub-project; The merging module is used to merge the project code into the main code of the target product if the comprehensive evaluation result characterization is passed.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.