# US 10,768,925 B2 · Performing partial analysis of a source code base

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

- Number: US 10,768,925 B2
- Document ID: US10768925B2
- Status: Granted
- Kind: B2
- Application number: 14/727,675
- Filed: 2015-06-01
- Published: 2020-07-16
- Granted: 2020-09-08
- Earliest claimed: 2015-06-01
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Pavel Avgustinov
- Web page: https://patentgrep.com/patent/US10768925B2

## CPC

- G06F 8/70: Software maintenance or management
- G06F 8/71: Version control (security arrangements therefor G06F21/57); Configuration management
- G06F 8/75: Structural analysis for program understanding
- G06F 9/44526: {Plug-ins; Add-ons}
- G06F 11/3624: {by performing operations on the source code, e.g. via a compiler}
- G06F 16/148: {File search processing}
- G06F 11/3604: Analysis of software for verifying properties of programs (testing of software G06F11/3668)
- G06F 11/362: Debugging of software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods, systems, and apparatus, including computer programs encoded on computer storage media, for performing partial analysis of source code files in a code base. One of the methods includes receiving a request for analysis results for a subset of source code files in a project. A set of primary source code files is generated according to the request, wherein the set of primary source code files includes fewer than all source code files in the project. A set of secondary source code files is generated, the set comprising source code files upon which at least one of the primary source code files depends directly or transitively. A partial analysis of the code base is performed using all files included in the set of primary source code files or the set of secondary source code files. Analysis results for the files included in the set of primary source code files is provided in response to the request.

## Claims

### Claim 1

A computer-implemented method comprising:
receiving, from a user, a request for partial analysis results to identify source code violations introduced by the user in changes made by the user to one or more source code files in a first snapshot of a project;
generating an initial set of primary source code files comprising only one or more source code files changed by the user relative to source code files in the first snapshot of the project;
obtaining data representing a dependency graph of source code files in the project, wherein the dependency graph has a directed link from a first node representing a first source code file to a second node representing a second source code file whenever the first source code file imports the second source code file or uses one or more definitions in the second source code file;
generating an augmented set of primary source code files, including adding, to the initial set of primary source code files, one or more additional source code files represented by nodes in the dependency graph having a link to any node representing any of the files in the initial set of primary source code files;
generating a set of secondary source code files including identifying source code files represented by nodes to which a link in the dependency graph exists from any node representing any of the files in the augmented set of primary source code files;
performing a partial analysis of the project using done or more files included in the augmented set of primary source code files and the set of secondary source code files to identify unmatched violations occurring in the augmented set of primary source code files but not occurring in the first snapshot, the unmatched violations being violations introduced by the user in changes made by the user to the one or more source code files in the initial set of primary source code files; and
providing partial analysis results for the files included in the augmented set of primary source code files, wherein the partial analysis results identify locations of the violations introduced by the user in the one or more source code files.

### Claim 2 (depends on 1)

The method of claim 1,
wherein generating the set of secondary source code files comprises identifying all source code files reachable along a path of at most N steps in the dependency graph from at least one of the source code files in the augmented set of primary source code files.

### Claim 3 (depends on 1)

The method of claim 1, wherein a change made by the user to one of the source code files in the initial set of primary source code files introduced a violation in a first source code file in the augmented set of primary source code files, and wherein performing the partial analysis comprises determining that the violation in the first source code file is an unmatched violation that does not occur in the first snapshot of the project.

### Claim 4 (depends on 2)

The method of claim 2, further comprising:
obtaining a system setting specifying a value for N representing a maximum number of steps in the dependency graph by which to identify the set of secondary source code files;
identifying the set of secondary source code files including identifying all source code files reachable along a path having at most N steps in the dependency graph from at least one of the files in the augmented set of primary source code files; and
adding the identified source code files to the set of secondary source code files.

### Claim 5 (depends on 4)

The method of claim 4, further comprising:
identifying a programming language of the project; and
obtaining a programming-language-specific setting for the value of N for the identified programming language of the project.

### Claim 6 (depends on 5)

The method of claim 5, further comprising:
determining that the programming-language-specific setting is an unlimited number of steps; and
in response, adding, to the set of secondary source code files, all files represented by nodes that are reachable in the dependency graph from any nodes representing files in the augmented set of primary source code files.

### Claim 7 (depends on 4)

The method of claim 4, further comprising:
obtaining an application-specific setting for the value of N based on an application type of the request.

### Claim 8 (depends on 1)

The method of claim 1, wherein generating the augmented set of primary source code files comprises identifying all source code files from which at least one of the primary source code files are reachable along a path of at most N steps in the dependency graph; and
adding the identified source code files to the augmented set of primary source code files.

### Claim 9 (depends on 8)

The method of claim 8, further comprising:
obtaining a system setting specifying a number of steps in a dependency graph of source code files in the project by which to supplement the initial set of primary source code files, wherein generating the augmented set of primary source code files comprises identifying all source code files from which at least one of the primary source code files are reachable along a path having a length that is no more than N steps; and
adding the identified source code files to the augmented set of primary source code files.

### Claim 10 (depends on 9)

The method of claim 9, further comprising:
identifying a programming language of the project; and
obtaining a programming-language-specific setting for a value of N for the identified programming language.

### Claim 11 (depends on 9)

The method of claim 9, further comprising:
obtaining an application-specific setting for the value of N based on an application type of the request.

### Claim 12 (depends on 1)

The method of claim 1, wherein the first snapshot is a most recent revision of the project.

### Claim 13 (depends on 1)

The method of claim 1, wherein generating the initial set of primary source code files comprises adding to the initial set of primary source code files all source code files that have been changed by the user relative to the first snapshot of the project.

### Claim 14 (depends on 1)

The method of claim 1, wherein generating the initial set of primary source code files comprises adding to the initial set of primary source code files one or more source code files currently being presented in an integrated development environment.

### Claim 15

A system comprising:
one or more computers and one or more storage devices storing instructions that are operable, when executed by the one or more computers, to cause the one or more computers to perform operations comprising:
receiving, from a user, a request for partial analysis results to identify source code violations introduced by the user in changes made by the user to one or more source code files in a first snapshot of a project;
generating an initial set of primary source code files comprising only one or more source code files changed by the user relative to source code files in the first snapshot of the project;
obtaining data representing a dependency graph of source code files in the project, wherein the dependency graph has a directed link from a first node representing a first source code file to a second node representing a second source code file whenever the first source code file imports the second source code file or uses one or more definitions in the second source code file;
generating an augmented set of primary source code file, including adding, to the initial set of primary source code files, one or more additional source code files represented by nodes in the dependency graph having a link to any node representing any of the files in the initial set of primary source code files;
generating a set of secondary source code files including identifying source code files represented by nodes to which a link in the dependency graph exists from any node representing any of the files in the augmented set of primary source code files;
performing a partial analysis of the project using one or more files included in the augmented set of primary source code files and the set of secondary source code files to identify unmatched violations occurring in the augmented set of primary source code files but not occurring in the first snapshot, the unmatched violations being violations introduced by the user in changes made by the user to the one or more source code files in the initial set of primary source code files; and
providing partial analysis results for the files included in the augmented set of primary source code files, wherein the partial analysis results identify locations of the violations introduced by the user in the one or more source code files.

### Claim 16 (depends on 15)

The system of claim 15,
wherein generating the set of secondary source code files comprises identifying all source code files reachable along a path of at most N steps in the dependency graph from at least one of the source code files in the augmented set of primary source code files.

### Claim 17 (depends on 15)

The system of claim 15, wherein a change made by the user to one of the source code files in the initial set of primary source code files introduced a violation in a first source code file in the augmented set of primary source code files, and wherein performing the partial analysis comprises determining that the violation in the first source code file is an unmatched violation that does not occur in the first snapshot of the project.

### Claim 18 (depends on 16)

The system of claim 16, wherein the operations further comprise:
obtaining a system setting specifying a value for N representing a maximum number of steps in the dependency graph by which to identify the set of secondary source code files;
identifying the set of secondary source code files including identifying all source code files reachable along a path having at most N steps in the dependency graph from at least one of the files in the augmented set of primary source code files; and
adding the identified source code files to the set of secondary source code files.

### Claim 19 (depends on 18)

The system of claim 18, wherein the operations further comprise:
identifying a programming language of the project; and
obtaining a programming-language-specific setting for the value of N for the identified programming language of the project.

### Claim 20 (depends on 19)

The system of claim 19, wherein the operations further comprise:
determining that the programming-language-specific setting is an unlimited number of steps; and
in response, adding, to the set of secondary source code files, all files represented by nodes that are reachable in the dependency graph from any nodes representing files in the augmented set of primary source code files.

### Claim 21 (depends on 18)

The system of claim 18, wherein the operations further comprise:
obtaining an application-specific setting for the value of N based on an application type of the request.

### Claim 22 (depends on 15)

The system of claim 15, wherein generating the augmented set of primary source code files comprises identifying all source code files from which at least one of the primary source code files are reachable along a path of at most N steps in the dependency graph; and
adding the identified source code files to the augmented set of primary source code files.

### Claim 23 (depends on 22)

The system of claim 22, wherein the operations further comprise:
obtaining a system setting specifying a number of steps in a dependency graph of source code files in the project by which to supplement the initial set of primary source code files, wherein generating the augmented set of primary source code files comprises identifying all source code files from which at least one of the primary source code files are reachable along a path having a length that is no more than N steps; and
adding the identified source code files to the augmented set of primary source code files.

### Claim 24 (depends on 23)

The system of claim 23, wherein the operations further comprise:
identifying a programming language of the project; and
obtaining a programming-language-specific setting for a value of N for the identified programming language.

### Claim 25 (depends on 23)

The system of claim 23, wherein the operations further comprise:
obtaining an application-specific setting for the value of N based on an application type of the request.

### Claim 26 (depends on 15)

The system of claim 15, wherein the first snapshot is a most recent revision of the project.

### Claim 27 (depends on 15)

The system of claim 15, wherein generating the initial set of primary source code files comprises adding to the initial set of primary source code files all source code files that have been changed by the user relative to the first snapshot of the project.

### Claim 28 (depends on 15)

The system of claim 15, wherein generating the initial set of primary source code files comprises adding to the initial set of primary source code files one or more source code files currently being presented in an integrated development environment.

### Claim 29

A computer program product, encoded on one or more computer-readable hardware storage devices, comprising instructions that when executed by one or more computers cause the one or more computers to perform operations comprising:
receiving, from a user, a request for partial analysis results to identify source code violations introduced by the user in changes made by the user to one or more source code files in a first snapshot of a project;
generating an initial set of primary source code files comprising only one or more source code files changed by the user relative to source code files in the first snapshot of the project;
obtaining data representing a dependency graph of source code files in the project, wherein the dependency graph has a directed link from a first node representing a first source code file to a second node representing a second source code file whenever the first source code file imports the second source code file or uses one or more definitions in the second source code file;
generating an augmented set of primary source code file, including adding, to the initial set of primary source code files, one or more additional source code files represented by nodes in the dependency graph having a link to any node representing any of the files in the initial set of primary source code files;
generating a set of secondary source code files including identifying source code files represented by nodes to which a link in the dependency graph exists from any node representing any of the files in the augmented set of primary source code files;
performing a partial analysis of the project using all one or more files included in the augmented set of primary source code files and the set of secondary source code files to identify unmatched violations occurring in the augmented set of primary source code files but not occurring in the first snapshot, the unmatched violations being violations introduced by the user in changes made by the user to the one or more source code files in the initial set of primary source code files; and
providing partial analysis results for the files included in the augmented set of primary source code files, wherein the partial analysis results identify locations of the violations introduced by the user in the one or more source code files.
