IP Library Granted Patent US 8,984,485
Granted Patent B2
US 8,984,485 · App. 13/874,534 · Granted Mar 17, 2015

Analysis of source code changes

Inventors: Hisham E. Elshishiny (Cairo, EG); Sherif Sabry (Cairo, EG); Ghada H. Selim (Giza, EG); Ossama Shokry (Giza, EG)
Assignee: International Business Machines Corporation
G06F11/3676
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,984,485
App. No.
13/874,534
Granted
Mar 17, 2015
Kind
B2
Abstract

Use of an Abstract Syntax Tree (AST) to select portions of source code when analyzing the affect of changes in that source code from one version to another. In this way, it is possible to better focus on how changes in the source code, especially changes which only impact limited portion(s) of the source code, affect code quality with respect to measures like code complexity, performance and so on.

Claims (55)

1. A method for analyzing source code, the method comprising:

receiving first and second versions of source code;

making an Abstract Syntax Tree (AST) for at least the second version;

determining, by one or more computer processors, an impacted code parent of the AST for at least the second version based upon differences between code artifacts in the first and second versions of the source code; and

generating an indexed table representing the impacted code parent of the AST for at least the second version, wherein the table is indexed based at least on the code artifacts in the first and second versions of the source code, and the table includes a type of each code artifact, pointers to the code artifacts in the AST, and pointers to the location of the code artifacts in the second version of the source code.

2. The method of claim 1 , wherein the location of the code artifacts in the second version of the source code comprises line numbers of the second version of the source code.

3. The method of claim 1 , wherein making the AST for at least the second version uses a source code parser to make the AST.

4. The method of claim 1 , the method further comprising:

analyzing source code exclusively on portions of the second version defined by a scope of the impacted code parent.

5. The method of claim 4 , the method further comprising:

responsive to analyzing the source code, creating a report reflecting results of analyzing the source code.

6. The method of claim 4 , the method further comprising:

selecting test cases based, at least in part, upon the impacted code parent;

wherein:

analyzing the source code exclusively on the portions of the second version defined by the scope of the impacted code parent comprises running the selected test cases.

7. The method of claim 1 , further comprising:

generating, by one or more computer processors, a complexity report for the impacted code parent comprising at least one of a number of source code statements included, a number of selection statements included, and a number of loops included.

8. A computer program product for analyzing source code, the computer program product comprising software stored on a software storage memory, the software comprising:

first program instructions programmed to receive first and second versions of source code;

second program instruction programmed to make an Abstract Syntax Tree (AST) for the second version;

third program instructions programmed to determine impacted code parent of the AST for the second version based upon differences in code artifacts between the first and second versions of source code; and

fourth program instructions programmed to generate an indexed table representing the impacted code parent of the AST for at least the second version of the source code, wherein the table is indexed based at least on the code artifacts in the first and second versions of the source code, and the table includes a type of each code artifact, pointers to the code artifacts in the AST, and pointers to the location of the code artifacts in the second version of the source code.

9. The product of claim 8 , wherein the location of the code artifacts in the second version of the source code comprises line numbers of the second version of the source code.

10. The product of claim 8 , wherein the second program instructions use a source code parser to make the AST for at least the second version.

11. The product of claim 8 , wherein the software further comprises:

fifth program instructions programmed to analyze source code exclusively on portions of the second version defined by a scope of the impacted code parent.

12. The product of claim 11 , wherein the software further comprises:

sixth program instructions programmed to create a report, reflecting results of analyzing the source code.

13. The product of claim 11 , wherein the software further comprises:

sixth program instructions programmed to select test cases based, at least in part, upon the impacted code parent;

wherein:

the fifth program instructions programmed to analyze source code exclusively on portions of the second version defined by a scope of the impacted code parent comprises running the selected test cases.

14. The product of claim 8 , wherein the software further comprises:

fifth program instructions to generate a complexity report for the impacted code parent comprising at least one of a number of source code statements included, a number of selection statements included, and a number of loops included.

15. A computer system for analyzing source code, the computer system comprising:

a processor set; and

a software storage memory;

wherein:

the processor set is structured and/or connected in data communication to execute machine readable instructions stored in the software storage memory; and

the machine readable instructions comprises:

first program instructions programmed to receive first and second versions of source code;

second program instruction programmed to make an Abstract Syntax Tree (AST) for at least the second version; and

third program instructions programmed to determine an impacted code parent of the AST for at least the second version based upon differences between code artifacts in the first and second versions of the source code; and

fourth program instructions programmed to generate an indexed table representing the impacted code parent of the AST for at least the second version of the source code, wherein the table is indexed based at least on the code artifacts in the first and second versions of the source code, and the table includes a type of each code artifact, pointers to the code artifacts in the AST, and pointers to the location of the code artifacts in the second version of the source code.

16. The system of claim 15 , wherein the location of the code artifacts in the second version of the source code comprises line numbers of the second version of the source code.

17. The system of claim 15 , wherein the machine readable instructions further comprise:

fifth program instructions programmed to analyze source code exclusively on portions of the second version defined by a scope of the impacted code parent.

18. The system of claim 17 , wherein the machine readable instructions further comprise:

sixth program instructions programmed to create a report, in human understandable form and format, reflecting results of analysis performed at the analyzing step.

19. The system of claim 17 , wherein the machine readable instructions further comprise:

sixth program instructions programmed to select test cases based, at least in part, upon the impacted code parent;

wherein:

the fifth program instructions programmed to analyze source code exclusively on portions of the second version defined by a scope of the impacted code parent comprises running the selected test cases.

20. The system of claim 15 , wherein the machine readable instructions further comprise:

fifth program instructions to generate a complexity report for the impacted code parent comprising at least one of a number of source code statements included, a number of selection statements included, and a number of loops included.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 18, 2019
From: INTERNATIONAL BUSINESS MACHINES CORPORATION
To: WRP IP MANAGEMENT, LLC
Reel/Frame 048059/0064 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 1, 2013
From: ELSHISHINY, HISHAM E.; SABRY, SHERIF; SELIM, GHADA H.; SHOKRY, OSSAMA
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 030324/0793 →
Continuity (1)
Related Publication 20140331203A1 · Nov 6, 2014