Code management method and device, storage medium, computing equipment and program product
By receiving the user-side code submission request and using the pre-trained code optimization model to optimize and automatically submit the initial code, the problem that the development team is difficult to ensure the consistency of multiple version branches and code specifications in the code repository is solved, and the code style consistency and development efficiency are improved.
Patent Information
- Application Number
- CN202510092931.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-04-22
AI Technical Summary
In modern software development, the development team faces conflicts caused by multiple version branches in the code repository, frequent branch switching and merge operations, and difficult to ensure consistency of code specifications, which affects development efficiency and code quality.
By receiving the user-side code submission request, the initial code is optimized using the pre-trained code optimization model, and automatically submit the optimized code to the target branch in the code repository based on the code branch identification.
Reduces manual operations, ensures consistent code style, reduces the risk of merge conflicts, improves development efficiency and code quality, and supports teams to collaborate more efficiently and continuously deliver.
Smart Images

Figure CN119861963A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a code management method, apparatus, storage medium, computing device, and program product. Background Art
[0002] In modern software development, version control systems have become an indispensable tool for collaborative development. Not only do they support team members working in parallel and ensure the integrity and traceability of the code base, they also greatly improve development efficiency and flexibility through functions such as branch management and merge operations. With the popularization of development and operation integration, continuous integration / continuous deployment pipelines have further enhanced the automation process, making the process from code submission to production deployment smoother.
[0003] However, in actual operation, the development team faces many challenges. There are multiple version branches in the code repository. As the number of development team members increases, developers' frequent branch switching and branch merging operations are prone to cause conflicts, increasing maintenance costs and time consumption. Secondly, the consistency of code standards is difficult to ensure, especially in large projects or distributed teams. The working habits of different developers may lead to inconsistent code styles, affecting code quality and readability, and reducing overall development efficiency.
[0004] Therefore, there is an urgent need for a code management method that improves the consistency of code development. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a code management method. One or more embodiments of the present invention also relate to a code management device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0006] According to a first aspect of an embodiment of the present invention, there is provided a code management method, comprising: Receiving a code submission request sent by a user terminal, wherein the code submission request includes an initial code and a code branch identifier interactively input by a front-end user; Input the initial code into a pre-trained code optimization model to obtain an optimized code; Based on the code branch identifier, the optimized code is submitted to the target branch in the code repository.
[0007] According to a second aspect of an embodiment of the present invention, there is provided a code management device, including: The receiving module is configured to receive a code submission request sent by a user terminal, wherein the code submission request includes an initial code and a code branch identifier interactively input by a front-end user; An optimization module, configured to input the initial code into a pre-trained code optimization model to obtain an optimized code; The submission module is configured to submit the optimized code to a target branch in the code repository based on the code branch identifier.
[0008] According to a third aspect of an embodiment of the present invention, there is provided a computing device, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned code management method are implemented.
[0009] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program / instruction, and the computer program / instruction implements the steps of the above-mentioned code management method when executed by a processor.
[0010] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, comprising a computer program / instruction, which implements the steps of the above-mentioned code management method when executed by a processor.
[0011] An embodiment of the present invention implements receiving a code submission request sent by a user end, wherein the code submission request includes an initial code and a code branch identifier interactively input by a front-end user; inputting the initial code into a pre-trained code optimization model to obtain an optimized code; and submitting the optimized code to a target branch in a code repository based on the code branch identifier. By integrating multiple pre-trained model-driven code management platforms, code submission requests are automatically processed, and performance is improved through code optimization models. Based on the code branch identifier, the optimized code is automatically submitted to the target branch, and a submission prompt message is returned. This method reduces manual operations, ensures consistent code style, and submits to the corresponding branch based on branch identifiers, reducing the risk of conflicts caused by complex manual merge operations, improving development efficiency and code quality, and supporting more efficient team collaboration and continuous delivery. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 It is a schematic diagram of the structural interaction of a code management platform provided by an embodiment of the present invention; Figure 2 is a flow chart of a code management method provided by an embodiment of the present invention; Figure 3 is a process flow chart of a code management method provided by an embodiment of the present invention; Figure 4 is a schematic diagram of the structure of a code management device provided by an embodiment of the present invention; Figure 5 It is a structural block diagram of a computing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0013] Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited to the specific implementation disclosed below.
[0014] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.
[0015] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0016] In addition, 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, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0017] In modern software development projects, teamwork plays a vital role. The introduction of version control systems (such as Git) has greatly promoted parallel development, code base integrity and traceability, while improving development efficiency and flexibility through functions such as branch management and merge operations. With the popularization of the DevOps (Development and Operations) concept, the continuous integration / continuous deployment (CI / CD) pipeline has further enhanced the automation process, making the process from code submission to production deployment smoother. The application of AI and automation tools provides strong support for code quality inspection, automatic correction and intelligent recommendation, and promotes the overall optimization of the software development life cycle.
[0018] Despite these advanced tools and technologies, there are still many challenges in the code submission process, which have a significant impact on development efficiency and product quality. First, merge conflicts are a common problem. When multiple developers modify the same file or functional module at the same time, manually resolving these conflicts is not only time-consuming and error-prone, but also slows down development progress. Secondly, due to the different coding styles of different developers, the lack of unified code standards makes the code base appear messy, increasing the difficulty of maintenance and the accumulation of technical debt. Poor communication also seriously affects the progress of the project. The lack of an effective communication mechanism can easily lead to duplication of work or improper handling of functional dependencies. In addition, improper version control can cause confusion. Failure to follow a good branch management strategy can easily lead to out-of-control versions and increase the risk of production environments. The uneven frequency of submissions also affects the clarity of the commit history and the complexity of debugging, while the lack of continuous integration hinders the improvement of efficiency. Manual inspection and deployment are required after each submission, increasing the workload and the chance of human error. Insufficient documentation makes it difficult to trace problems. Detailed submission logs and change records help track problems and understand code evolution, but many teams are insufficient in this regard. Performance bottlenecks and security vulnerabilities also stem from neglecting audits, and the complexity of dependency management has caused more trouble for the team. In order to deal with these problems, the team needs to implement unified coding standards, clarify branch management processes, strengthen audit processes, and strictly control access rights to ensure smooth progress and high-quality delivery of the project.
[0019] In response to the above problems, a code management method is provided in the present invention. The present invention also relates to a code management platform, a code management device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0020] join Figure 1 , Figure 1It is a structural interaction diagram of a code management platform provided by an embodiment of the present invention. The code management platform includes a user end, a server end and a code repository. The user end is used to generate a code submission request in response to the user's interactive input and send it to the server end; the server end is used to receive the code submission request sent by the user end, wherein the code submission request includes the initial code and code branch identifier interactively input by the front-end user; the initial code is input into a pre-trained code optimization model to obtain an optimized code; based on the code branch identifier, the optimized code is submitted to the target branch in the code repository, and submission prompt information is returned to the user end.
[0021] When building a code management platform, tool integration and AI integration are two key links to ensure code quality and development efficiency. To achieve this goal, the system not only conducts in-depth research and selects static analysis tools that best match the programming language used in the project, but also fully integrates advanced AI services to provide intelligent code management and optimization functions.
[0022] The system conducts in-depth research and selects the static analysis tools that best match the programming language used in the project, taking into full account factors such as language compatibility, tool features, and community support. The system carefully selects the most suitable static analysis tools for different programming languages: for example, ESLint or JSHint is used for JavaScript / TypeScript projects; Pylint or Flake8 is used for Python projects; Checkstyle or PMD is used for Java projects; and Cppcheck or Clang-Tidy is used for C / C++ projects. The system not only focuses on the selection of tools, but also conducts a comprehensive evaluation of all aspects of the selected tools, including error detection capabilities, operating efficiency, degree of customizability, and community support. Through this rigorous evaluation process, the system ensures that the selected tools can effectively detect syntax errors, inconsistent styles, and potential security vulnerabilities, thereby improving code quality.
[0023] After the static analysis tools are selected, the system seamlessly integrates them into the development environment, such as through IDE plug-ins (such as the ESLint plug-in for VS Code) or CI / CD pipelines, to ensure that detection can be automatically performed during the development process and when the code is submitted. This automated integration not only reduces the need for manual operations, but also ensures that each code change can undergo rigorous static analysis, timely discover and solve problems, and promote efficient collaboration and continuous delivery among team members.
[0024] Developers can make a comprehensive comparison of different AI service providers, such as OpenAI's GPT series, Google Cloud AI, and Microsoft Azure AI, focusing on factors such as API feature richness, response time, and cost-effectiveness. Based on the comparison results, choose the service that best suits the project needs, complete account registration, obtain access keys, and ensure secure communication with the API.
[0025] Choose a suitable programming language (such as Python, Node.js) to develop middle-tier applications to process API requests and responses, and realize the interconnection and interoperability of code bases, analysis tools, and AI models. At the same time, ensure that the code snippets can be accurately converted to JSON or other applicable formats so that they can be smoothly passed to AI and its return results can be correctly parsed.
[0026] Implement version control hooks (such as Git's pre-commit hook) to ensure that AI can fully analyze the code before it is submitted. In addition, integrate plug-ins or extensions in IDE (such as JetBrains plug-ins or VS Code extensions) to present AI guidance in real time, so that developers can get instant feedback during the coding process.
[0027] Establish rules to prioritize AI suggestions based on the severity and scope of the problem, ensure that high-priority issues are resolved first, and clearly marked in the interface. Provide easy-to-understand and directly implementable correction suggestions, and attach a brief description or document link to help developers quickly understand the problem.
[0028] Incorporate clear and concise ways into the user interface design so that users can easily evaluate or correct AI suggestions. Embed a feedback module to provide users with a convenient way to enter evaluations, likes, or comments to ensure that the system's suggestions can be continuously improved.
[0029] Design a reasonable database architecture to store user feedback data to ensure data traceability and privacy protection. Use data analysis tools (such as Tableau or Power BI) to regularly review feedback data, generate trend reports, and continuously improve the quality of AI service recommendations.
[0030] Identify error patterns from feedback data, understand which types of errors are easily overlooked or misreported, and guide model adjustment strategies. Share feedback data with AI providers or train and fine-tune models on your own to enhance accuracy in specific scenarios.
[0031] Based on user feedback, we continuously optimize the user interface and workflow of the tool to reduce redundant operations and improve work efficiency. Static analysis tools and AI models are included in the scope of regular updates, and the latest algorithm improvement results and vulnerability repair measures are adopted.
[0032] The TLS (Transport Layer Security) protocol is enabled within the system to ensure that code snippets and related data are encrypted during transmission to AI services to prevent the risk of data being intercepted or stolen during network transmission. Follow the principle of data minimization and only transmit necessary code snippets and information to reduce the risk of unnecessary data exposure. Implement measures that comply with laws and regulations such as GDPR to ensure that users fully understand and agree to the use of data. Conduct compliance reviews regularly and update privacy policies and data processing agreements.
[0033] Configure refined permission control policies to strictly limit access to AI services and static analysis tools to ensure that only authorized personnel can view and modify system settings. Enable multi-factor authentication (MFA) for all accounts involved in sensitive operations to add a layer of security to prevent unauthorized access. Implement comprehensive logging capabilities to track and record all access and change activities to ensure detailed audit analysis of any potential security incidents.
[0034] Applied to the code management platform, the code management platform integrates AI model-driven technology to generate code submission requests from user-side interactive input, and the server receives and automatically processes these requests: improve performance through code optimization models. Based on code branch identification, the optimized code is automatically submitted to the target branch. This process reduces manual operations, reduces the risk of merge conflicts, improves development efficiency and code quality, and supports more efficient team collaboration and continuous delivery.
[0035] See also Figure 2 , Figure 2 It is a flowchart of a code management method provided by an embodiment of the present invention, which specifically includes the following steps.
[0036] Step 202: receiving a code submission request sent by a user terminal, wherein the code submission request includes an initial code and a code branch identifier interactively input by a front-end user.
[0037] The code submission request is a data packet sent by the user to the code management system, which contains the initial code entered by the developer through the front-end interface and the code branch identifier that identifies the branch to which the current code belongs. The code branch identifier is used to specify which specific development branch the code should be submitted to, such as a feature branch or a master branch.
[0038] In actual applications, the system first receives a connection request from the user. When the user tries to submit code, the user initiates a connection request containing the user's identification information to the system. The system verifies the user's permission level based on this user's identification. If the user's permission level meets the preset security standard, the system allows the user to continue the code submission operation. Next, the user formally sends a code submission request, which not only contains the initial code entered by the user through the front-end interface and the code branch identifier that clearly indicates the target branch, but also comes with detailed metadata (such as the timestamp of the submission, the identity of the submitter, etc.) for subsequent auditing and version control.
[0039] After receiving this information, the system will initially parse and verify it to ensure that the submitted content is complete and meets the format requirements. In order to improve code quality and development efficiency, the system further uses AI-assisted submission functions, including intelligent splitting strategies and change complexity analysis. Specific methods may include: Abstract syntax tree (AST) parsing: The system uses AST to parse the code to clarify different modules, functional boundaries, and cross-module dependencies. This helps understand the code structure and guides the splitting of the code into logically related parts.
[0040] Complexity index evaluation: Use quantitative indicators such as cyclomatic complexity, number of lines of code, and function call depth to evaluate the complexity of changes. These indicators provide a basis for the reasonable classification of changes.
[0041] Logical grouping: With the help of natural language processing (NLP) technology, the system analyzes code comments and variable names to automatically identify and classify changes belonging to the same function or task; at the same time, it uses clustering algorithms to detect similarities between code snippets to ensure that related changes are packaged reasonably.
[0042] Splitting algorithm: The system uses evolutionary methods such as genetic algorithms to seek the optimal solution among many possible splitting schemes, which is especially suitable for large and complex projects; and dynamically determines the appropriate splitting granularity based on the current status of the project, such as version release deadlines, team member workloads and other factors.
[0043] After completing the above analysis, the system generates optimized split suggestions and provides them to users through an interactive interface. The interface allows developers to adjust the proposed submission plan through drag-and-drop operations and view its impact in real time. During this process, the system provides potential risks and conflicts information in real time to help users optimize their decisions.
[0044] For some complex application scenarios, one implementation method is that the system can start the automated testing process immediately after receiving the code submission request to detect potential problems in advance; another implementation method is that the system can temporarily store the submission request in a queue and process each request in sequence to ensure efficient and stable processing of a large number of concurrent submissions.
[0045] In a specific embodiment of the present invention, it is assumed that a developer is working on a feature branch called "feature-branch" and has completed the coding of a new function. The developer prepares to submit this code through a graphical user interface (GUI). After the developer clicks the submit button, the user end generates and sends a code submission request containing the newly written initial code and "feature-branch" as the code branch identifier to the system. After receiving this request, the system first verifies whether the developer has the authority to submit code to "feature-branch". After confirming the authority, the system receives the complete code submission request and prepares for further processing. The system not only records metadata such as the timestamp of the submission and the identity of the submitter, but also performs intelligent splitting and complexity analysis of the code through the AI-assisted submission function to ensure that each submission is a small and independent change unit, which is easy to track and review.
[0046] Finally, based on the code branch identification, the system submits the optimized code to the target branch in the code repository. This process reduces manual operations, ensures consistency in code style, reduces the risk of conflicts caused by complex merge operations, significantly improves development efficiency and code quality, and supports more efficient team collaboration and continuous delivery. In addition, the system automatically generates adaptive test suites based on the risk scoring model to improve the test coverage of high-risk submissions, and notifies relevant responsible persons or teams when necessary so that timely measures can be taken. By collecting user feedback and actual project results, the system continuously updates model parameters, reduces false positives and false negatives, and provides detailed explanatory reports to explain the reasons and logic behind the scoring.
[0047] Furthermore, receiving a code submission request sent by a user terminal includes: obtaining a user terminal identifier of the user terminal in response to a connection request of the user terminal; determining an authority level of the user terminal based on the user terminal identifier; and receiving a code submission request sent by the user terminal when the authority level reaches a preset level.
[0048] Among them, the user-side identification is an identifier used to uniquely identify the user-side device or user; the authority level refers to the access level granted by the system based on the user's identity and role; the code submission request is a data packet sent from the user to the system containing the initial code and other necessary information.
[0049] In actual applications, the system first responds to the connection request from the user side and obtains the user side's user side identifier. This process involves an authentication integration mechanism to ensure the authenticity and legitimacy of the user's identity. The system supports multiple authentication methods, including modern authentication modes such as LDAP (Lightweight Directory Access Protocol) and OAuth2. For internal network environments, the system can use LDAP servers (such as OpenLDAP, Active Directory) to achieve unified management of user information and authentication, which is suitable for internal enterprise environments. For Web applications and mobile applications, OAuth2 can be used to cooperate with third-party authentication providers to achieve single sign-on and build a flexible user authentication mechanism. The choice of authentication method depends on the specific application scenario: LDAP has high requirements for security and control and is suitable for internal use; OAuth2 emphasizes user experience and flexibility and is more suitable for the Internet environment. In order to meet the needs of different applications and user groups, the system can be designed to support a hybrid mode of both LDAP and OAuth2.
[0050] Based on the user-side identification, the system determines the permission level of the user-side. To this end, the system combines the two permission management modes of ACL (Access Control List) and RBAC (Role-Based Access Control). ACL allows the system to explicitly list the users or groups that are allowed or denied access for each resource, achieving fine-grained control of permissions, which is particularly suitable for scenarios where individual user permissions need to be flexibly adjusted. RBAC simplifies permission management by associating permissions with roles and assigning these roles to users, which is particularly suitable for organizations with a large number of users and a stable permission structure. In addition, RBAC also supports the creation of a role system with inheritance relationships to improve the reusability and extensibility of role definitions. In many cases, RBAC is used in combination with ACL, using RBAC to manage general permissions, while using ACL to perform more detailed permission control on special resources or operations.
[0051] When the user's permission level reaches the preset security standard, the system receives the code submission request sent by the user. During this process, the system not only verifies whether the user has the right to submit the code to the specified branch, but also checks whether the submitted content is complete and meets the format requirements. For some steps that have multiple implementation methods, one implementation method is that the system can start the automated testing process immediately after receiving the code submission request to detect potential problems in advance; another implementation method is that the system can temporarily store the submission request in a queue and process each request in sequence to ensure efficient and stable processing of a large number of concurrent submissions. After completing these verifications, the system records metadata such as the timestamp of the submission and the identity of the submitter for subsequent auditing and version control.
[0052] In a specific embodiment of the present invention, it is assumed that a developer is preparing to submit new function code to a feature branch named "feature-branch". The developer initiates a connection request through a graphical user interface (GUI). After the system receives the request, it first verifies the identity of the developer through the LDAP server. After the verification is passed, the system checks the developer's role and associated permissions based on the RBAC model to confirm that he has the authority to submit code to "feature-branch". Since the developer's permission level has reached the preset standard, the system allows the submission process to continue. After the developer clicks the submit button, the user end generates and sends a code submission request containing the newly written initial code and "feature-branch" as the code branch identifier to the system. The system performs a preliminary analysis and verification of the received code to ensure that the code content is complete and meets the format requirements. Once the verification is successful, the system temporarily stores the code in a queue, waiting for further processing, and notifies the developer that the submission has been accepted.
[0053] Based on this, the system has achieved full process optimization from user authentication to permission verification to code submission. By integrating multiple authentication methods and permission management modes, the system can accurately control the access rights of each user to ensure that only authorized users can submit code. This not only improves the security of the system, but also enhances the work efficiency of the development team, promotes collaboration and continuous delivery among members. The system can accurately manage the code submission process, ensure that each code change is correctly recorded and tracked, and provide a solid guarantee for the smooth progress of the project.
[0054] Step 204: Input the initial code into a pre-trained code optimization model to obtain an optimized code.
[0055] Furthermore, the initial code is input into a pre-trained code optimization model to obtain an optimized code, including: inputting the initial code into a pre-trained format specification model, performing format specification processing on the initial code to obtain a target code; inputting the target code into a pre-trained structure optimization model to obtain an optimized code.
[0056] The format specification model is a pre-trained machine learning or rule engine model that is designed to automatically format the code according to predefined coding standards and best practices. The initial code refers to the unformatted original code that the developer enters and submits to the system through the front-end interface. The target code refers to the code that has been formatted and conforms to the team's coding standards and has a unified style.
[0057] In actual applications, after the system receives a code submission request containing the initial code, it immediately starts a series of automated processing steps to ensure that the code complies with the team's coding standards and improves its readability and maintainability. First, the system uses mature natural language processing libraries (such as spaCy, NLTK, or Hugging Face's Transformers) to parse the code text, combined with pre-trained models (such as GPT-3 or CodeBERT) to deeply understand the code context and its programming patterns and styles. Next, the system converts the code into a vector representation through word embedding technology to facilitate semantic comparison, and constructs a semantic network between code elements by analyzing function definitions and call relationships to accurately grasp their meaning and purpose.
[0058] In order to generate compliant suggestions, the system maintains a best practice database that includes industry standard naming and annotation practices, and combines rule engines (such as Drools) to set specific naming rules and annotation formats, and generates or verifies AI suggestions based on these rules. At the same time, the system uses Python's ast module or Java's javaparser library to parse the code and convert it into a structured abstract syntax tree (AST) to accurately locate the parts that need to be renamed or refactored. For some steps that have multiple implementation methods, one implementation method is to directly apply a series of fixed formatting rules; another implementation method is to use a machine learning model to learn the optimal formatting mode by analyzing a large number of historical code samples to provide smarter formatting suggestions.
[0059] After completing the above analysis, the system matches the AI-generated suggestions with the AST nodes to ensure that these suggestions are reasonable and feasible in the current code context, for example, variable names do not conflict with built-in names. In order to achieve automatic modification, the system uses a refactoring tool library (such as Rope for Python or Refactoring Miner for Java) to write custom scripts to operate AST and automate the addition, deletion and modification of the code. In addition, the system integrates version control systems (such as Git Hooks) to run refactoring scripts when the code is submitted to ensure that all submissions comply with the latest naming and annotation standards, and use pre-commit hooks to provide change previews and manual approval links before submission.
[0060] To enhance user interaction, the system is equipped with difference display tools (such as Git diff) to intuitively display the specific differences between the code before and after modification, and develops visual interface plug-ins to the development environment (such as VS Code extension function) to display code changes in a graphical way and prompt users to confirm. Finally, the system collects developers' ratings or feedback on AI suggestions, gradually improves the output quality of the AI model, and incorporates the collected feedback into the training data to gradually improve the accuracy and practicality of AI. This process not only reduces the workload of developers to manually adjust the code, but also supports efficient collaboration and continuous delivery among team members, ensuring that each code change is correctly recorded and tracked, providing a solid guarantee for the smooth progress of the project.
[0061] In a specific embodiment of the present invention, it is assumed that a developer submits a piece of JavaScript code, which does not follow the team's coding standards, such as lack of necessary comments, inconsistent indentation, and variable names that do not use camelCase. When this initial code is sent to the system, the system immediately inputs it into a pre-trained format specification model. The model first detects indentation problems in the code and unifies all indentations to two spaces. Next, it identifies situations where variable names do not conform to camelCase, such as my_variable, and automatically converts them to myVariable. The model then checks the code logic and finds that there are several key logics that lack comments, so it automatically generates concise comments to help other developers understand the intent of the code. Finally, the system outputs target code that fully complies with the team's coding standards, and the code now has a unified style and higher readability.
[0062] Furthermore, after the initial code is input into a pre-trained format specification model and the initial code is format-standardized to obtain the target code, it also includes: generating a code change report based on the initial code and the target code; and returning the code change report to the user end.
[0063] Among them, the format specification model is a pre-trained machine learning or rule engine model that is designed to automatically format the code according to predefined coding standards and best practices. The initial code refers to the unformatted original code that the developer enters and submits to the system through the front-end interface. The target code refers to the code that has been formatted and conforms to the team's coding standards and has a unified style. The code change report is a document generated by the system after comparing the initial code with the target code, which records in detail all changes in the code, including but not limited to syntax adjustments, naming conventions, and comment additions.
[0064] In actual applications, after receiving a code submission request containing the initial code, the system immediately passes the initial code to a pre-trained format specification model. The model comprehensively checks and adjusts the initial code according to preset coding standards (such as indentation, naming rules, comment requirements, etc.) to ensure that it complies with the coding standards within the team and improves the overall readability and maintainability of the code. After completing the formatting process, the system generates a code change report based on the initial code and the target code. This process involves the implementation of differential analysis. The system uses tools similar to Git to perform differential analysis and compare the code changes between two versions. For example, the git diff command is suitable for comparing branches, submissions, or files in the working directory. The system can configure Git Hooks (such as post-commit or post-receive hooks) to automatically trigger differential analysis after each submission and save the analysis results. In addition, the system can also add steps in the CI / CD pipeline to automatically perform differential analysis and generate differential reports for review on each pull request.
[0065] For the storage and management of difference data, the system can save the difference analysis results as a structured log file (such as JSON or text format), organize the storage by date or version number, or design a reasonable database table structure to store difference information, including submission hash, difference content and generation time. In order to facilitate users to browse historical changes, the system builds a front-end user interface, using frameworks such as React.js, Vue.js or Angular.js to create a dynamic user interface, display the submission history list, and support viewing the details of a single submission, including author, date, comments, etc. The system also implements a file-level difference highlighting function, using a code highlighting library (such as Highlight.js) to display code changes on the front end, intuitively presenting the addition and deletion of parts. At the same time, the back-end service provides a data access interface through a RESTful API, supporting the query of submission history and difference information.
[0066] In a specific embodiment of the present invention, it is assumed that a developer submits a piece of JavaScript code, which does not follow the team's coding standards, such as lack of necessary comments, inconsistent indentation, and variable names not using camel case naming. When this initial code is sent to the system, the system first inputs it into a pre-trained format specification model. The model detects indentation problems in the code and unifies all indentation to two spaces; identifies situations where variable names do not conform to camel case naming and automatically converts them to a form that complies with the regulations; and then automatically generates concise comments to help other developers understand the intent of the code. In the end, the system outputs the target code that fully complies with the team's coding standards. This code now has a unified style and higher readability. Next, the system generates a detailed code change report based on the initial code and the target code. The report not only shows the specific location of each modification, but also provides a comparison view before and after the modification, which is convenient for developers to quickly understand and review.
[0067] Based on this, the system has achieved full process optimization from code formatting to change report generation. By automatically generating difference reports, the system can accurately record the details of each code change to ensure that each code change is correctly recorded and tracked. This not only improves development efficiency, but also supports efficient collaboration and continuous delivery among team members. The system can accurately manage the code submission process, ensure the consistency of code quality, and provide a solid guarantee for the smooth progress of the project. In addition, the visual report and analysis dashboard construction solution provided by the system enables users to intuitively view the historical change trends of the project, further improving the user experience and project transparency.
[0068] Furthermore, the initial code is input into a pre-trained code optimization model to obtain an optimized code, and the method also includes: inputting the target code into a pre-trained structure optimization model to obtain an optimized code.
[0069] Among them, the structural optimization model is a pre-trained machine learning or rule engine model that aims to automatically improve the target code according to predefined performance optimization standards and best practices. The target code refers to the code that meets the team's coding standards and has a unified style after being processed by the format specification. The optimized code refers to the code that has been further improved in terms of performance, readability, and maintainability after being processed by the structural optimization model.
[0070] In actual applications, the system passes the target code after formatting to a pre-trained structural optimization model. The model performs a series of optimization operations to improve the running efficiency of the code, reduce resource consumption, and enhance the maintainability of the code. For example, the model can identify redundant calculations in a loop and extract them outside the loop; it can simplify complex logical expressions and reduce unnecessary conditional judgments; it can also recommend more efficient data structures or algorithms to replace the current implementation. In addition, the model will check whether there are potential performance bottlenecks in the code and make specific optimization suggestions. For some steps that have multiple implementation methods, one implementation method is to use a rule-based engine to directly apply a series of fixed optimization rules; another implementation method is to use a machine learning model to learn the optimal optimization mode by analyzing a large number of historical code samples, thereby providing a more intelligent and personalized optimization solution.
[0071] In a specific embodiment of the present invention, it is assumed that a developer submits a piece of Python code, which has been processed through format specifications to ensure a unified coding style. However, the code contains a nested loop for traversing two lists and performing comparison operations. When this target code is input into a pre-trained structural optimization model, the model first detects performance issues that may be caused by nested loops. It recommends converting one of the lists into a set because the time complexity of the search operation of the set is lower. Then, the model recognizes that there is a repeated calculation operation inside the loop, so this part of the calculation is moved outside the loop, reducing unnecessary computational overhead. In addition, the model also found some lengthy conditional statements, and by simplifying these logical expressions, the code becomes more concise and easy to read. Finally, the system outputs the optimized code, which not only runs faster, but is also easier to understand and maintain.
[0072] Furthermore, the target code is input into a pre-trained structural optimization model to obtain an optimized code, including: inputting the target code into the structural optimization model to obtain an optimization path for the target code; performing a logical analysis on the target code to generate code refactoring suggestions; generating optimization suggestions based on the optimization path and the refactoring suggestions and returning them to the user end; upon receiving the optimization suggestions from the user end, modifying the target code based on the confirmation instructions to obtain the optimized code.
[0073] Among them, the structural optimization model is a pre-trained machine learning or rule engine model designed to intelligently optimize the code according to predefined best practices and performance optimization criteria. The target code refers to the code that has been formatted and standardized to meet the team's coding standards and has a unified style. The optimization path refers to the specific steps planned by the system to improve code performance, readability, and maintainability. Refactoring suggestions are suggestions on how to reorganize the code structure to improve efficiency or clarity based on the logical analysis of the target code. Optimization suggestions are a series of specific guidance generated by the system to help developers understand and implement optimization paths and refactoring suggestions. Optimized code refers to the final version of the code after these optimization measures.
[0074] In actual applications, the system first inputs the target code into a pre-trained structural optimization model to obtain the optimization path of the target code. This process involves in-depth analysis of the target code, including but not limited to the application of static code analysis tools such as SonarQube, Checkstyle, or ESLint, to extract features such as code complexity, modularity, and design patterns. The system builds detailed code feature engineering through text content analysis (such as LDA topic model) and code feature extraction to ensure that the model can fully understand the current status of the code. For some steps that have multiple implementation methods, one implementation method is to use a collaborative filtering algorithm to recommend optimization strategies based on user behavior or project similarity; another implementation method is to use a content-based recommendation method, combined with TF-IDF / NLP analysis technology and context-aware recommendation technology, to provide optimization suggestions that are more suitable for the current project.
[0075] Next, the system performs a logical analysis of the target code and generates code refactoring suggestions. This step involves an in-depth understanding of the code logic, identifying redundant or inefficient code segments, and proposing corresponding refactoring solutions. The system can use graph neural networks (GNNs) to learn a wider range of co-occurrence patterns based on the project's dependency graph to discover potential optimization opportunities. At the same time, the system can also combine dynamic adjustment mechanisms to adjust recommendation strategies in real time based on user feedback to optimize model performance. For the generated refactoring suggestions, the system will consider the actual application scenarios of the code and the preferences of developers to ensure that the suggestions are both scientific and practical.
[0076] Based on the optimization path and refactoring suggestions, the system generates optimization suggestions and returns them to the user. The optimization suggestions not only include specific modification points and explanations of the reasons, but may also be accompanied by relevant document links or sample code snippets to help developers better understand and implement optimization measures. When receiving the user's confirmation instructions for the optimization suggestions, the system automatically or semi-automatically modifies the target code based on the confirmation instructions to obtain the final optimized code. This process can be implemented through IDE plug-ins or web interfaces, allowing developers to directly receive and apply optimization suggestions in the working environment.
[0077] In a specific embodiment of the present invention, it is assumed that a developer submits a piece of Python code. Although this piece of code complies with the coding standards of the team, there is still room for improvement in terms of performance and readability. When this piece of target code is sent to the system, the system first inputs it into a pre-trained structural optimization model. The model detects potential performance bottlenecks in the code through static analysis tools and proposes several optimization paths, such as reducing unnecessary loop nesting, simplifying conditional judgment logic, etc. Then, the system performs a logical analysis of the code and generates refactoring suggestions, such as merging duplicate functions, introducing auxiliary functions to improve code reusability, etc. Based on these optimization paths and refactoring suggestions, the system generates a detailed optimization suggestion document and returns it directly to the developer through the IDE plug-in. The developer reviewed this document and decided to adopt some of the suggestions. According to the developer's confirmation instructions, the system automatically modifies the target code and obtains the final optimized code. This code now not only has improved performance, but is also easier to understand and maintain.
[0078] Based on this, the system realizes the automation of the entire process from code optimization path planning to optimization suggestion generation to final code modification. Through the combination of intelligent recommendation and open source solutions, the system not only improves the quality and performance of the code, but also supports efficient collaboration and continuous delivery among team members. The system can accurately manage the code optimization process, ensure that each code change is correctly recorded and tracked, and provide a solid guarantee for the smooth progress of the project. In addition, the system's personalized customization scheme and continuous learning mechanism enable it to continuously adapt to new needs and technology trends, and maintain the accuracy and practicality of its recommendations.
[0079] Step 206: Based on the code branch identifier, submit the optimized code to the target branch in the code repository.
[0080] The code branch ID is a unique identifier used to specify the specific development branch to which the code should be submitted. Optimized code refers to code that has been improved in terms of style and performance after format specification and performance optimization. The target branch refers to the specific branch in the code repository that receives the optimized code, such as a feature branch, master branch, or release branch. The submission prompt message is the message that the system returns to the user after the code is successfully submitted, including submission status, submission number, and other information.
[0081] In actual applications, the system submits the optimized code to the target branch in the code repository based on the code branch identifier, and returns the submission prompt information to the user. This process not only involves direct code submission operations, but also integrates advanced technologies such as AI-assisted submission, intelligent splitting strategy, and change complexity analysis to ensure that each submission is a small and independent change unit, which is easy to track and review.
[0082] First, after the system receives the code submission request containing the initial code, it immediately starts a series of automated processing steps, including using the abstract syntax tree (AST) to parse the code and clarify the boundaries of different modules and functions and cross-module dependencies. This helps to understand the code structure and guide the splitting of the code into logically related parts. The system uses quantitative indicators such as cyclomatic complexity, number of lines of code, and function call depth to evaluate the complexity of the changes, providing a basis for the reasonable division of changes. On this basis, with the help of natural language processing (NLP) technology, the system automatically identifies and classifies changes belonging to the same function or task, and uses clustering algorithms to detect the similarities between code snippets to ensure that related changes are packaged reasonably.
[0083] For some steps that have multiple implementation methods, one implementation method is to use evolutionary methods such as genetic algorithms to seek the optimal solution among many possible splitting schemes, which is especially suitable for large and complex projects; another implementation method is to dynamically determine the appropriate split granularity through a context-aware model and adjust the splitting strategy according to the current status of the project (such as version release deadlines, team member workloads). To enhance the user experience, the system provides an interactive interface that allows developers to adjust the recommended submission plan through drag-and-drop operations and view its impact in real time. At the same time, potential risks and conflicts are provided in real time during the adjustment process to help optimize decision-making.
[0084] Next, the system extracts features for risk scoring from multiple dimensions such as code static features, team behavior, and external environment through multi-level feature extraction. The adaptive learning mechanism enables the model to automatically update weights after introducing new data (such as new bug reports), improving prediction accuracy and practicality. The scoring mechanism flexibly adjusts the weight of each feature according to the project stage and context, and sets different action suggestions based on the risk level. Low-risk submissions can be directly approved, while high-risk submissions require strict review or additional testing.
[0085] When preparing for submission, the system automatically generates an adaptive test suite based on the risk score, improves the test coverage of high-risk submissions, and automatically notifies the relevant responsible person or team when the submission is marked as high risk so that timely measures can be taken. In addition, the system continuously updates model parameters by collecting user feedback and actual project results, reduces false positives and false negatives, and provides detailed analysis reports to explain the reasons and logic behind the scoring.
[0086] To ensure that each submission is thoroughly recorded, the system uses natural language processing (NLP) models and static analysis tools to compare the old and new versions of the code, locate specific modified areas, and generate a concise summary of the changes. Semantic modeling further analyzes the semantics of the code segment, infers its role and impact in the project, and combines historical data comparison and dependency analysis to evaluate the potential impact of code changes on other modules or components. The system also uses existing annotation information and document cross-references to find descriptive content that matches the current changes, ensuring that the submission record is both detailed and easy to understand.
[0087] Finally, based on the code branch identifier, the system submits the optimized code to the target branch in the code repository and returns detailed submission prompt information to the user. This process reduces the need for manual operations, ensures the consistency of code style, reduces the risk of conflicts caused by complex merge operations, significantly improves development efficiency and code quality, and supports more efficient team collaboration and continuous delivery. The system can also build an intuitive user interface through front-end development specifications, provide a centralized dashboard view to display current code changes, submission record overviews, and other related information, ensure the usability of the interface on different devices, and enhance the user's interactive experience through drag and drop and filtering functions. Through these measures, the system has achieved full process optimization from code submission to review to warehousing, providing a solid guarantee for the smooth progress of the project.
[0088] In a specific embodiment of the present invention, it is assumed that the developer is working on a feature branch named "feature-login" and has completed the optimization of the login function. The developer submitted the optimized code through the front-end interface and specified "feature-login" as the code branch identifier. After the system receives the code submission request, it first parses the code branch identifier and confirms that the target branch is "feature-login". Next, the system performs a pre-submission check, including running unit tests and static code analysis to ensure the quality of the optimized code. After the check passes, the system uses the Git command to push the optimized code to the "feature-login" branch of the remote warehouse. After the submission is completed, the system automatically generates a submission prompt message: "Submission successful, submission number: 123456, affected files: login.js, auth.service.js", and sends this message back to the user end to inform the developer of the submission result. In addition, the system also uses AI-assisted tools to intelligently split this submission to ensure that each submission is a small and independent change unit for easy tracking and review. The system evaluates changes based on complexity indicators, automatically identifies and classifies changes belonging to the same function or task, and uses clustering algorithms to detect similarities between code snippets to ensure that related changes are packaged reasonably. To enhance the user experience, the system provides an interactive interface that allows developers to adjust the proposed submission plan through drag-and-drop operations and view its impact in real time. At the same time, it provides potential risks and conflict information in real time during the adjustment process to help optimize decision-making.
[0089] Furthermore, based on the code branch identifier, the optimized code is submitted to the target branch in the code repository, including: based on the code branch identifier, determining the target branch and related branches in the code repository; submitting the optimized code to the target branch in the code repository; and modifying the code of the related branches based on the optimization suggestions.
[0090] The code branch identifier is a unique identifier used to specify the specific development branch to which the code should be submitted. Optimized code refers to code that has been improved in terms of style and performance after formatting and performance optimization. The target branch refers to the specific branch in the code repository that receives the optimized code, while the related branches refer to other branches that may be affected by the optimized code or need to be modified synchronously.
[0091] In actual applications, the system first determines the target branch and related branches in the code repository based on the code branch identifier. This process involves the integration of environment switching and configuration management to ensure consistency and stability in different environments. Specifically, the system uses Docker container technology to achieve a standardized deployment environment, integrates applications and their dependencies into portable containers, ensures the consistency of development / test environments in development teams and CI / CD processes, and effectively reduces "local operation is normal" type problems. By building different Docker Compose files or using environment variables, the system can easily switch between development, testing, and production environments, simplify the configuration management process, and promote a smooth transition between environments. Use Docker image tags to manage and distribute application versions to ensure that each deployment can reproduce the same operating environment.
[0092] Next, the system submits the optimized code to the target branch in the code repository. In order to ensure the cleanliness of the code base and the traceability of changes, the system adopts a multi-environment configuration management solution to externalize environment-related configurations (such as database connection information, API keys, etc.), and may use .env files or configuration management tools (such as Consul, Vault) for unified management. During the deployment phase, the CI / CD tool dynamically injects environmental parameters to ensure that the correct configuration is used when each environment is running. In addition, the system also integrates an automated merge tool, expands the Git merge function, uses a three-way merge algorithm to automatically resolve common merge conflicts, and provides detailed change information prompts for complex conflicts to assist manual processing. For complex conflicts that cannot be resolved automatically, the system generates clear prompts, including the conflicting file context and historical change information, to facilitate developers to quickly understand and resolve conflicts.
[0093] Finally, based on the optimization suggestions, the system modifies the code of the relevant branches. This step not only includes pushing the optimized code directly to the target branch, but also requires checking and adjusting other related branches that may be affected. To this end, the system can develop or integrate additional Git plug-ins or scripts to enhance conflict detection capabilities, such as identifying logical conflicts through semantic analysis, which goes beyond the scope of text conflict detection. At the same time, the system provides a graphical or command line interface so that developers can intuitively view the details of the conflict during the merge process. In order to ensure the rigor of the review process, the system incorporates the merge tool into the continuous integration (CI) pipeline as a key link in the pull request (Pull Request) or merge request (Merge Request) review process. If a conflict that requires manual processing is encountered during the merge process, the system will promptly notify the relevant developers through channels such as email and Slack to ensure timely processing.
[0094] In a specific embodiment of the present invention, it is assumed that a developer has completed the structural optimization on a feature branch and is ready to submit it to the main branch. The developer initiates a connection request through the front-end interface. After receiving the request, the system first parses the code branch identifier and confirms that the target branch is "main" and other branches related to this feature, such as "feature-payment". The system uses Docker container technology to create a consistent development environment to ensure that all tests are performed under the same conditions. Next, the system performs a series of pre-submission checks, including running unit tests and static code analysis, to ensure the quality of the optimized code. After the check passes, the system pushes the optimized code to the "main" branch and checks whether the "feature-payment" branch needs to be adjusted accordingly based on the optimization suggestions. If necessary, the system automatically generates detailed code modification suggestions and displays them to the developer through a graphical interface. After the developer reviews and confirms the modifications, the system automatically applies these changes to the relevant branches to ensure that all related codes remain synchronized and consistent.
[0095] Based on this, the system realizes the automation of the whole process from code branch identification parsing to optimized code submission and then to the synchronization of related branch codes. Through the integration of environment switching and configuration management, the system not only improves the code quality and performance, but also supports efficient collaboration and continuous delivery among team members. The system can accurately manage the code submission process, ensure that each code change is correctly recorded and tracked, and provide a solid guarantee for the smooth progress of the project. In addition, the system's multi-environment configuration management and intelligent merge tool deployment enable it to flexibly respond to the needs of different environments and ensure the stability and reliability of the code base.
[0096] Furthermore, submission prompt information is returned to the user end, including: inputting the optimized code into a pre-trained document generation model, performing semantic analysis and logical analysis on the optimized code, and obtaining a natural language description text corresponding to the optimized code; generating prompt information based on the natural language description text, and returning the prompt information to the user end.
[0097] The document generation model is a pre-trained machine learning model that is designed to automatically generate natural language description text based on the content of the code. Optimized code refers to code that has been improved in terms of style and performance after formatting and performance optimization. The submission prompt is a message returned to the user after the code is successfully submitted. It contains a natural language description of the code changes to help developers quickly understand the optimization content.
[0098] In actual applications, the system first inputs the optimized code into a pre-trained document generation model, performs semantic analysis and logical analysis on the optimized code, and obtains the natural language description text corresponding to the optimized code. This process involves multiple steps, including using the GPT model to parse code snippets, identify code structures such as functions, classes, and modules, and automatically extract key elements in the code, such as variable names, parameters, return values, etc., to generate functional descriptions. In order to better understand the interactions within the code, the system analyzes the calling relationships and data flows between modules or functions in the code, generates a natural language description of the interactions between modules, and assists in understanding the system architecture and logical flow. In addition, the system combines code comments with existing documents to enhance the understanding of business logic and usage scenarios, and uses contextual information to generate more accurate code explanations.
[0099] Based on the natural language description text, the system generates prompt information and returns the prompt information to the user. This step not only includes providing detailed natural language descriptions, but may also involve code structure diagrams and navigation indexes to help developers quickly locate and understand key code snippets. In order to support customized needs, the system allows developers to define document templates and customize code explanations and document formats through configuration options. In addition, the system supports multi-language generation to improve the efficiency of cross-regional team collaboration. For some steps that have multiple implementation methods, one implementation method is that the system can use structured information display, provide code structure diagrams and natural language descriptions; another implementation method is that the system can adjust the level of detail of document generation according to the developer's preferences, ranging from a brief overview to a detailed explanation.
[0100] In a specific embodiment of the present invention, it is assumed that a developer has completed the structural optimization on a feature branch and is ready to submit it to the main branch. The developer initiates a connection request through the front-end interface. After the system receives the request, it first inputs the optimized code into the pre-trained document generation model. The model parses the code snippets, identifies key functions and classes, and extracts key elements such as variable names, parameters, and return values to generate a functional description. Then, the system analyzes the calling relationship and data flow between modules or functions in the code, and generates a natural language description of the interaction between modules. At the same time, the system combines code comments and existing documents to enhance the understanding of business logic and usage scenarios, and generates a more accurate code explanation. Based on these analysis results, the system generates a detailed natural language description text that describes the main changes to the optimized code and their impact.
[0101] Then, the system generates a prompt message based on the natural language description text and returns the prompt message to the user. The prompt message not only contains detailed natural language instructions, but also provides code structure diagrams and navigation indexes to help developers quickly locate and understand key code snippets. The prompt message also includes a customized document template that allows developers to customize code explanations and document formats according to project requirements. Finally, the system supports multi-language generation to ensure that team members in different regions can easily read and understand the optimization content. After the developer reviews the prompt message and confirms that it is correct, the system pushes the optimized code to the target branch and records metadata such as the timestamp of the submission and the identity of the submitter for subsequent auditing and version control.
[0102] Based on this, the system realizes the automation of the entire process from code optimization to natural language description to submission prompt information generation. Through the application of natural language description technology for code content, the system not only improves the quality and readability of the code, but also supports efficient collaboration and continuous delivery among team members. The system can accurately manage the code submission process, ensuring that each code change is correctly recorded and tracked, providing a solid guarantee for the smooth progress of the project. In addition, the system's customized templates and support for multi-language generation enable it to flexibly respond to the needs of different teams, improving collaboration efficiency and user experience.
[0103] An embodiment of the present invention implements receiving a code submission request sent by a user end, wherein the code submission request includes an initial code and a code branch identifier interactively input by a front-end user; inputting the initial code into a pre-trained code optimization model to obtain an optimized code; and submitting the optimized code to a target branch in a code repository based on the code branch identifier. By integrating a code management platform driven by multiple pre-trained models, code submission requests are automatically processed, the initial code is first formatted and standardized, and then the performance is improved through a structural optimization model. Based on the code branch identifier, the optimized code is automatically submitted to the target branch, and a submission prompt message is returned. This method reduces manual operations, ensures consistent code style, reduces the risk of conflicts caused by complex merge operations, improves development efficiency and code quality, and supports more efficient team collaboration and continuous delivery.
[0104] The following combination Figure 3 , taking the application of the code management method provided by the present invention in the version control system Git as an example, the code management method is further described. Figure 3 It is a process flow chart of a code management method provided by an embodiment of the present invention, which specifically includes the following steps.
[0105] Step 302: The user submits the code through the intelligent submission system.
[0106] Specifically, the user end provides an intelligent submission system that allows developers to generate code submission requests in response to user interactive input through an intuitive graphical interface or command line tool. The system not only supports regular code submission operations, but also integrates preliminary verification functions to ensure that the submitted code and metadata (such as code branch identifiers) are complete and correct. This step simplifies the submission process, reduces the possibility of human error, and lays the foundation for subsequent automated processing. The platform supports segmented code submission, that is, gradually submitting code in small steps. Each submission is an independent change unit, ensuring that the content of each submission is relatively small and fully tested.
[0107] Step 304: The system checks and ensures that the code complies with the specification according to the preset template.
[0108] Specifically, after receiving the code submission request, the server first uses the preset template function configuration to check the format of the initial code. These templates define the team's coding standards, including naming rules, indentation style, maximum line length, etc. The AI model will automatically verify whether the code meets these standards, ensuring that all submitted code remains consistent and readable before entering the code base, thereby improving the overall code quality.
[0109] Step 306: The user can quickly switch between different development branches.
[0110] Specifically, the platform supports users to quickly switch between different development branches to meet the needs of multi-task parallel development. Through simple commands or operations on the interface, developers can easily switch to the required feature branch, fix branch or main branch and continue working without affecting other tasks. This flexibility significantly improves development efficiency and enables team members to collaborate more efficiently.
[0111] Step 308: Automatically perform format verification, performance bottleneck identification, security vulnerability scanning and other checks on the submitted code.
[0112] Specifically, the AI-driven inspection function can conduct a comprehensive analysis of the submitted code, covering code format, merge conflicts, performance bottlenecks, security vulnerabilities and other aspects. This process not only ensures that the code meets the team's standards, but also detects potential problems in advance, such as inefficient code segments or possible security risks. With early warning, the team can solve the problem in time before it becomes complicated, thereby reducing the time and cost of later debugging.
[0113] Step 310: Automatically correct the problems found, such as adding comments, standardizing variable names, optimizing performance, etc.
[0114] Specifically, the platform uses AI automatic correction function to optimize the code for problems found during the inspection process. This includes but is not limited to automatically generating necessary comments, adjusting variable names to comply with naming rules, and applying performance optimization suggestions. Automatic correction not only improves the quality of the code, but also reduces the burden on developers, allowing them to focus on the implementation of business logic rather than trivial formatting and optimization work.
[0115] Step 312: Intelligently recommend relevant tools or frameworks based on project requirements and provide refactoring suggestions.
[0116] Specifically, based on the current status and needs of the project, the platform can intelligently recommend suitable open source tools or frameworks to help the team choose the most appropriate solution. In addition, it will analyze the complexity of the existing code and make refactoring suggestions to simplify the code structure and improve maintainability and scalability. These suggestions help the team to continuously improve the code base and keep it healthy and technologically advanced.
[0117] Step 314: Display the detailed changes before and after the code is modified, and save the detailed information of each submission.
[0118] Specifically, the platform records and displays the before-and-after comparison of each code modification, tracking the change history in detail. This not only helps to understand the specific changes of each submission, but also provides a basis for rollback operations. Detailed submission records are essential for auditing, troubleshooting, and team collaboration, ensuring that all members can clearly understand the process of code evolution.
[0119] Step 316: Real-time collaboration to handle merge conflicts and support team collaborative development.
[0120] Specifically, when multiple developers modify the same file or module at the same time, the platform provides real-time collaboration to handle merge conflicts. It automatically detects conflicting areas and provides solutions, and reminds developers to intervene manually when necessary. This instant feedback mechanism ensures that the team can resolve conflicts as soon as possible to avoid delays in development progress.
[0121] Step 318: Fine-grained control of access and modification permissions to ensure security and flexibility.
[0122] Specifically, the platform implements a strict permission management mechanism, and administrators can assign different levels of access and modification permissions based on roles. This fine-grained permission control not only ensures the security of the code base, but also gives the team enough flexibility to ensure that each member can only operate within their authorized scope to prevent accidental or malicious behavior.
[0123] Step 320: Automatically generate easy-to-understand code descriptions to help other developers quickly master the code.
[0124] Specifically, in order to improve the readability and maintainability of the code, the platform can automatically generate code descriptions in natural language. These descriptions cover the functions, logic and key points of the code, helping other developers to quickly understand the intent of the code, reducing the learning curve and promoting knowledge sharing within the team.
[0125] Step 322: Provide code health status and trend analysis, including quality scores and security risk assessments.
[0126] Specifically, the platform integrates visual reports and analysis dashboards to generate code health reports on a regular basis. These reports include quality scores, security risk assessments, and other content to help teams fully understand the status and development trends of the code base. Through data analysis, teams can take targeted measures to continuously improve code quality and security.
[0127] Step 324: Send a reminder notification containing the issue, submitter, and modification details to ensure that team members are aware of the changes in a timely manner.
[0128] Specifically, whenever a new submission or problem is discovered, the platform will automatically send a reminder notification to the relevant personnel, including the problem description, submitter information, and specific modification details. This instant messaging mechanism ensures that team members can respond to changes quickly, promote communication and collaboration, and reduce the impact of information lag.
[0129] Step 326: Automatically generate a submission record by briefly summarizing the submission content in natural language.
[0130] Specifically, the platform can convert each submission into a natural language description, which can clearly and concisely summarize the key points of the submission. These descriptions are saved as part of the submission record for easy reference and review in the future. This method not only improves the readability of the submission record, but also simplifies document management.
[0131] Step 328: Provide an intuitive interface to facilitate viewing of submission records, support navigation of historical versions and quick rollback operations.
[0132] Specifically, the platform provides a user-friendly GUI interface for viewing and managing submission records. This interface not only intuitively displays all submission histories, but also supports filtering queries by time, submitter, and other conditions. More importantly, it allows users to quickly roll back to the previous version, greatly facilitating version management and problem fixing.
[0133] Step 330: Continuously improve model accuracy based on user feedback and optimize code inspection and repair capabilities.
[0134] Specifically, the platform has AI self-learning capabilities and can continuously optimize its own models based on user feedback. This means that as more data is accumulated and user interaction increases, the platform's code inspection and automatic repair functions will become more and more accurate and efficient. This self-evolution capability ensures that the platform is always at the forefront of technology and meets ever-changing development needs.
[0135] Applied to the above steps 302-330, the code submission and management system achieves comprehensive optimization of the modern development process by integrating a variety of advanced tools and technologies. It can integrate tools to automatically detect and unify code styles, reduce human errors and improve maintainability, and use performance analysis tools to identify performance bottlenecks to ensure efficient operation. The system's built-in merge conflict detection function automatically identifies potential problems and provides detailed solutions, reducing the pressure of manual debugging. In terms of security, deep security scanning is performed through tools such as security scanning to promptly discover and guide the repair of vulnerabilities in code and dependencies. The automated notification function ensures that team members receive status updates in real time through channels such as communication, and the graphical interface of version control supports historical browsing and quick rollback operations, which facilitates project progress management.
[0136] The application of AI technology makes the system more intelligent. For example, AI-assisted code refactoring provides optimization suggestions, and intelligent code comments generate clear descriptions to enhance code readability. The system automatically monitors updates to dependent libraries, performs compatibility tests, and reminds developers to ensure that the latest stable version is adopted without introducing risks. Automatically generating submission records simplifies document writing, and the behavioral learning module optimizes the accuracy of AI models based on user feedback, providing accurate code inspection and repair suggestions. Visual reporting and analysis functions help teams make informed decisions through health status charts and trend analysis. Fine-grained permission management and open source technology recommendations promote flexibility and innovation, and the centralized conflict resolution platform supports online collaboration and quickly handles merge conflicts. This system combines AI and automation tools to significantly improve development efficiency, code quality, and teamwork.
[0137] Corresponding to the above method embodiment, the present invention also provides a code management device embodiment, Figure 4 FIG. 1 is a schematic diagram of a code management device provided by an embodiment of the present invention. Figure 4 As shown, the device comprises: The receiving module 402 is configured to receive a code submission request sent by a user terminal, wherein the code submission request includes an initial code and a code branch identifier interactively input by a front-end user.
[0138] Optionally, the receiving module 402 is further configured to obtain a user terminal identifier of the user terminal in response to a connection request from the user terminal; determine the authority level of the user terminal based on the user terminal identifier; and receive a code submission request sent by the user terminal when the authority level reaches a preset level. The optimization module 404 is configured to input the initial code into a pre-trained code optimization model to obtain an optimized code.
[0139] Optionally, the optimization module 404 is further configured to input the initial code into a pre-trained format specification model, perform format specification processing on the initial code to obtain a target code; and input the target code into a pre-trained structure optimization model to obtain an optimized code.
[0140] Optionally, the optimization module 404 is further configured to generate a code change report based on the initial code and the target code; and return the code change report to the user end.
[0141] Optionally, the optimization module 404 is further configured to input the target code into a code optimization model to obtain an optimization path for the target code; perform logical analysis on the target code to generate code refactoring suggestions; generate optimization suggestions based on the optimization path and the refactoring suggestions and return them to the user end; upon receiving the optimization suggestions from the user end, modify the target code based on the confirmation instructions to obtain the optimized code.
[0142] The submission module 406 is configured to submit the optimized code to a target branch in the code repository based on the code branch identifier.
[0143] Optionally, the submission module 406 is further configured to determine the target branch and related branches in the code repository based on the code branch identifier; submit the optimized code to the target branch in the code repository; and modify the code of the related branch based on the optimization suggestion.
[0144] Optionally, the submission module 406 is further configured to input the optimized code into a pre-trained document generation model, perform semantic analysis and logical analysis on the optimized code, and obtain a natural language description text corresponding to the optimized code; generate prompt information based on the natural language description text, and return the prompt information to the user end.
[0145] Applied to the code management device, first, the receiving module 402 receives the code submission request sent by the user end, which contains the initial code and code branch identifier interactively input by the front-end user, and verifies the user authority when responding to the user end connection request to ensure that only authorized users can submit the code. Subsequently, the optimization module 404 inputs the initial code into the pre-trained format specification model, formats the code to ensure consistent style, generates a code change report and feeds it back to the user end, and inputs the formatted target code into the pre-trained code optimization model to further improve code performance. Based on the code branch identifier, the optimized code is automatically submitted to the target branch. This process reduces manual operations, ensures consistency in code style, reduces the risk of merge conflicts, significantly improves development efficiency and code quality, and supports more efficient team collaboration and continuous delivery.
[0146] The above is a schematic scheme of a code management device of this embodiment. It should be noted that the technical scheme of the code management device and the technical scheme of the above code management method belong to the same concept, and the details not described in detail in the technical scheme of the code management device can be referred to the description of the technical scheme of the above code management method.
[0147] Figure 5 The block diagram of a computing device 500 provided according to an embodiment of the present invention is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0148] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0149] In one embodiment of the present invention, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present invention. Those skilled in the art may add or replace other components as needed.
[0150] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 500 may also be a mobile or stationary server.
[0151] The processor 520 is used to execute the following computer program / instruction, which implements the steps of the above-mentioned code management method when executed by the processor.
[0152] Each embodiment of the present invention is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computing device embodiment, since it is basically similar to the code management method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the code management method embodiment.
[0153] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned code management method when executed by a processor.
[0154] Each embodiment of the present invention is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computer-readable storage medium embodiment, since it is basically similar to the code management method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the code management method embodiment.
[0155] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned code management method when executed by a processor.
[0156] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned code management method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned code management method.
[0157] The above describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0158] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0159] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present invention.
[0160] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0161] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of the present invention. The present invention selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A code management method, characterized in that: The server side used in the code management platform includes: Receiving a code submission request sent by a user terminal, wherein the code submission request includes an initial code and a code branch identifier interactively input by a front-end user; Inputting the initial code into a pre-trained code optimization model to obtain an optimized code; Based on the code branch identifier, the optimized code is submitted to a target branch in a code repository.
2. The method according to claim 1, characterized in that The receiving a code submission request sent by a user terminal includes: In response to a connection request from a client, obtaining a client identifier of the client; Determining the authority level of the user terminal based on the user terminal identifier; When the authority level reaches a preset level, a code submission request sent by the user terminal is received.
3. The method according to claim 1, characterized in that The step of inputting the initial code into a pre-trained code optimization model to obtain an optimized code comprises: Inputting the initial code into a pre-trained format specification model, performing format specification processing on the initial code, and obtaining a target code; The target code is input into a pre-trained structural optimization model to obtain an optimized code.
4. The method according to claim 3, characterized in that After inputting the initial code into the pre-trained format specification model and performing format specification processing on the initial code to obtain the target code, the method further includes: Generate a code change report based on the initial code and the target code; The code change report is returned to the user end.
5. The method according to claim 3, characterized in that: The step of inputting the target code into a pre-trained structural optimization model to obtain an optimized code comprises: Inputting the target code into a structural optimization model to obtain an optimization path for the target code; Performing logic analysis on the target code and generating code refactoring suggestions; Generate an optimization suggestion based on the optimization path and the reconstruction suggestion and return it to the user terminal; When the optimization suggestion from the user terminal is received, the target code is modified based on the confirmation instruction to obtain the optimized code.
6. The method according to claim 5, characterized in that Submitting the optimized code to a target branch in a code repository based on the code branch identifier includes: Based on the code branch identifier, determining a target branch and related branches in the code repository; Submit the optimized code to a target branch in a code repository; Based on the optimization suggestion, the code of the relevant branch is modified.
7. The method according to claim 1, characterized in that After submitting the optimized code to the target branch in the code repository based on the code branch identifier, the method further includes: Inputting the optimized code into a pre-trained document generation model, performing semantic analysis and logical analysis on the optimized code, and obtaining a natural language description text corresponding to the optimized code; Prompt information is generated based on the natural language description text, and the prompt information is returned to the user terminal.
8. A code management device, characterized in that: include: A receiving module is configured to receive a code submission request sent by a user terminal, wherein the code submission request includes an initial code and a code branch identifier interactively input by a front-end user; An optimization module, configured to input the initial code into a pre-trained code optimization model to obtain an optimized code; The submission module is configured to submit the optimized code to a target branch in a code repository based on the code branch identifier, and return submission prompt information to the user terminal.
9. A computing device, characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the code management method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the code management method described in any one of claims 1 to 7.
11. A computer program product, characterized in that The invention comprises a computer program / instruction, which, when executed by a processor, implements the steps of the code management method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Code file processing method, device and equipment and storage medium
CN112486566A
Code processing method and device, storage medium and electronic equipment
CN116541001A
LLM-based code optimization system and method
CN118069111A
Bidirectional intelligent question and answer code supplementing method and system based on large language model
CN118426825A
Cited By
Code checking method and electronic equipment
CN121523728A