# US 2024/0004623 A1 · Syntax subtree code strengthening

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0004623 A1
- Document ID: US20240004623A1
- Status: Published application
- Kind: A1
- Application number: 17/856,859
- Filed: 2022-07-01
- Published: 2024-01-04
- Earliest claimed: 2022-07-01
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Peter GROENEWEGEN; Jui HANAMSHET; German David OBANDO CHACON; Mark Alistair WILSON-THOMAS; Alexey SVYATKOVSKIY; David Ellis PUGH
- Web page: https://patentgrep.com/patent/US20240004623A1

## CPC

- G06F 8/33: Intelligent editors
- G06F 8/42: {Syntactic analysis}
- G06F 8/36: Software reuse
- G06F 8/72: Code refactoring
- G06F 11/3608: {using formal methods, e.g. model checking, abstract interpretation (theorem proving G06N5/013)}
- G06N 5/01: Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

During software development, embodiments find various kinds of weak spots in source code and automatically suggest fixes to strengthen the code, without requiring developers to expressly select weakness finder mechanisms or fixer mechanisms by navigating a development tool's menu system. Weakness finders may analyze code using items such as hole detection, diagnostic errors, test results, changed code matches, prospective code discrepancies, generated code confidence scores, generated suggestion competition, and artificial intelligence. Weak spots and their context are submitted to weak spot fixers, which may generate fix suggestions using functionalities such as code synthesis, refactoring, autocompletion, retesting, and artificial intelligence. Fix candidate sets may be evaluated for consistency, diagnostic errors, and discrepancies. Snippets may be dynamically filled for presentation to a user.

## Claims

### Claim 1

A computing system which is configured to help improve source code, the system comprising:
a digital memory;
a software development tool having a user interface; and
at least one processor in operable communication with the digital memory, the at least one processor configured to collectively perform syntax subtree code improvement including: finding a weak spot in the source code, selecting a syntax subtree code which corresponds to the weak spot, submitting a context of the selected syntax subtree code to an artificial intelligence service, receiving a fix candidate from the artificial intelligence service in response to the submitting, and presenting a code strengthening suggestion based on at least the fix candidate.

### Claim 2 (depends on 1)

The computing system of claim 1, wherein the system comprises a weakness finder which is configured to select the syntax subtree code by finding at least one of the following weaknesses:
a replacement parameter in a code snippet;
a predefined gap in a code template;
a match between a deleted code and a remaining code;
a match between a removed code and a remaining code;
a match between a prior version of an edited code and a portion of current code;
a discrepancy between a paste prospect and an insertion target source code;
a discrepancy between a generated code and an insertion target source code;
a diagnostic error; or
a code behavior test result.

### Claim 3 (depends on 1)

The computing system of claim 1, wherein the system comprises a weakness finder which is based on artificial intelligence.

### Claim 4 (depends on 1)

The computing system of claim 1, wherein the system comprises a weakness finder which is configured to select the syntax subtree code based on at least a comparison of an automatically generated block of code to a resident block of code.

### Claim 5

A method to improve a source code, the method comprising automatically:
proffering the source code for weak spots analysis operations which collectively use at least three of the following analytic items: predefined hole detection, diagnostic errors, code behavior test results, a match between a changed portion of the source code and a separate portion of the source code, a discrepancy between a prospective code and the source code, a generated code confidence score, competing generated suggestions, or an artificial intelligence code weakness finder functionality;
selecting a syntax subtree code which corresponds to a weak spot found by the weak spots analysis operations;
submitting a context of the syntax subtree code to a weakness fixer;
receiving a fix candidate from the weakness fixer in response to the submitting; and
presenting a code strengthening suggestion based on at least the fix candidate.

### Claim 6 (depends on 5)

The method of claim 5, wherein the weakness corresponds to a replacement parameter in a code snippet, and the context of the syntax subtree code includes at least a portion of the snippet adjacent to the replacement parameter.

### Claim 7 (depends on 5)

The method of claim 5, wherein:
the weakness corresponds to a discrepancy between an insertion prospect and an insertion target source code; and
the context of the syntax subtree code includes at least a portion of the insertion prospect, or at least a portion of the insertion target source code, or both.

### Claim 8 (depends on 5)

The method of claim 5, wherein the method comprises:
receiving a candidate set which includes multiple fix candidates;
evaluating the candidate set;
choosing a fix candidate for presentation, based on at least a result of the evaluating; and
presenting the code strengthening suggestion based on at least the fix candidate.

### Claim 9 (depends on 5)

The method of claim 5, wherein the source code is displayed in a tool, a cursor is positioned in the source code at a cursor location, and the syntax subtree code is at a syntax subtree code location which is not adjacent to the cursor location and does not include the cursor location.

### Claim 10 (depends on 5)

The method of claim 5, wherein the syntax subtree code exhibits a group of weak spots at non-adjacent locations in the syntax subtree code, and the method comprises:
submitting the context of the syntax subtree code to at least one weakness fixer;
receiving a set of fix candidates from the at least one weakness fixer in response to the submitting;
checking fix candidates of the set for consistency with one another; and
presenting the code strengthening suggestion based on at least two of the fix candidates of the set.

### Claim 11 (depends on 5)

The method of claim 5, further comprising the weak spots analysis operations, wherein analyzing the source code for weak spots uses at least a match between a changed portion of the source code and a separate portion of the source code, and the weak spot found by the analyzing exhibits a weakness in that the separate portion contains at least one of the following which is not present in the changed portion: a variable name, a routine name, an expression configured to yield a value upon evaluation, or a program statement.

### Claim 12 (depends on 5)

The method of claim 5, further comprising the weak spots analysis operations, wherein analyzing the source code for weak spots uses at least one of the following discrepancies between the prospective code and the source code: the prospective code contains an identifier which is not present in the source code, or the source code contains an identifier which is not present in the prospective code.

### Claim 13 (depends on 5)

The method of claim 5, further comprising the weak spots analysis operations, wherein analyzing the source code for weak spots uses at least competing generated suggestions.

### Claim 14 (depends on 5)

The method of claim 5, further comprising the weak spots analysis operations, wherein analyzing the source code for weak spots uses at least an artificial intelligence code weakness finder functionality.

### Claim 15 (depends on 5)

The method of claim 5, further comprising the weak spots analysis operations, wherein analyzing the source code for weak spots uses at least four of the analytic items.

### Claim 16

A computer-readable storage device configured with data and instructions which upon execution by a processor cause a computing system to perform a method to optimize a source code, the method comprising:
proffering the source code for weak spots analysis operations which collectively use at least five of the following analytic items: predefined hole detection functionality, diagnostic errors, code behavior test results, a match between a changed portion of the source code and a separate portion of the source code, a discrepancy between a prospective code and the source code, a generated code confidence score, competing generated suggestions, or an artificial intelligence code weakness finder functionality;
selecting a syntax subtree code which corresponds to a weak spot found by the weak spots analysis operations;
submitting a context of the syntax subtree code to a weakness fixer;
receiving a fix candidate from the weakness fixer in response to the submitting; and
presenting a code strengthening suggestion based on at least the fix candidate.

### Claim 17 (depends on 16)

The computer-readable storage device of claim 16, wherein the method comprises proffering the source code for weak spots analysis operations which collectively use at least six of the analytic items.

### Claim 18 (depends on 16)

The computer-readable storage device of claim 16, wherein the method further comprises the weak spots analysis operations, wherein analyzing the source code for weak spots uses at least diagnostic errors.

### Claim 19 (depends on 16)

The computer-readable storage device of claim 16, wherein the method further comprises the weak spots analysis operations, wherein analyzing the source code for weak spots uses at least predefined hole detection.

### Claim 20 (depends on 16)

The computer-readable storage device of claim 16, wherein the method further comprises the weak spots analysis operations, wherein analyzing the source code for weak spots uses at least code behavior test results.
