# US 11,119,760 B2 · Identifying and deleting unnecessary code lines

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

- Number: US 11,119,760 B2
- Document ID: US11119760B2
- Status: Granted
- Kind: B2
- Application number: 16/656,053
- Filed: 2019-10-17
- Published: 2021-04-22
- Granted: 2021-09-14
- Earliest claimed: 2019-10-17
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Gabriele De Capoa; Emilia Amato; Crescenzo Migliaccio
- Web page: https://patentgrep.com/patent/US11119760B2

## CPC

- G06F 8/72: Code refactoring
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Provided are techniques for identifying and deleting unnecessary code lines. A plurality of global behavioral rules are stored, where each of the global behavioral rules includes a behavioral pattern code fragment, a plurality of recommendations, and a recommendation score for each of the plurality of recommendations. It is determined that a code fragment in a portion of code matches a behavioral pattern code fragment of a global behavioral rule of the plurality of global behavioral rules. A recommendation from the plurality of recommendations of the global behavioral rule is provided based on the recommendation score of that recommendation. In response to the recommendation being applied, a recommendation score of the recommendation is increased. In response to the recommendation being rejected, an action taken is identified, and the action taken is stored as a new recommendation for the behavioral pattern code fragment of the global behavioral rule.

## Claims

### Claim 1

A computer-implemented method, comprising operations for:
storing a plurality of global behavioral rules, wherein each of the global behavioral rules includes a behavioral pattern code fragment, an occurrence value for the behavioral pattern code fragment, a plurality of recommendations, and a recommendation score for each of the plurality of recommendations;
determining that a code fragment in a portion of code matches the behavioral pattern code fragment of a global behavioral rule of the plurality of global behavioral rules;
providing a recommendation from the plurality of recommendations of the global behavioral rule based on the recommendation score of the recommendation;
in response to the recommendation being applied, increasing the recommendation score of the recommendation; and
in response to the recommendation being rejected,
identifying an action taken; and
storing the action taken as a new recommendation for the behavioral pattern code fragment of the global behavioral rule.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein the global behavioral rule was generated for a portion of code from a first code file, and wherein the portion of the code is from a second code file.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein changes to the code are monitored to identify any combination of added code lines and deleted code lines, and wherein a local behavioral rule is generated based on the monitoring.

### Claim 4 (depends on 3)

The computer-implemented method of claim 3, wherein the local behavioral rule is sent for storage as a new global behavioral rule.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, comprising further operations for:
receiving a local behavioral rule;
in response to determining that the local behavioral rule is similar to the global behavioral rule, merging the local behavioral rule with the global behavioral rule; and
in response to determining that the local behavioral rule is not similar to the global behavioral rule, storing the local behavioral rule as a new global behavioral rule.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein a Software as a Service (SaaS) is configured to perform the operations of the method.

### Claim 7

A computer program product, the computer program product comprising a computer readable storage medium having program code embodied therewith, the program code executable by at least one processor to perform operations for:
storing a plurality of global behavioral rules, wherein each of the global behavioral rules includes a behavioral pattern code fragment, an occurrence value for the behavioral pattern code fragment, a plurality of recommendations, and a recommendation score for each of the plurality of recommendations;
determining that a code fragment in a portion of code matches the behavioral pattern code fragment of a global behavioral rule of the plurality of global behavioral rules;
providing a recommendation from the plurality of recommendations of the global behavioral rule based on the recommendation score of the recommendation;
in response to the recommendation being applied, increasing the recommendation score of the recommendation; and
in response to the recommendation being rejected,
identifying an action taken; and
storing the action taken as a new recommendation for the behavioral pattern code fragment of the global behavioral rule.

### Claim 8 (depends on 7)

The computer program product of claim 7, wherein the global behavioral rule was generated for a portion of code from a first code file, and wherein the portion of the code is from a second code file.

### Claim 9 (depends on 7)

The computer program product of claim 7, wherein changes to the code are monitored to identify any combination of added code lines and deleted code lines, and wherein a local behavioral rule is generated based on the monitoring.

### Claim 10 (depends on 9)

The computer program product of claim 9, wherein the local behavioral rule is sent for storage as a new global behavioral rule.

### Claim 11 (depends on 7)

The computer program product of claim 7, wherein the program code is executable by the at least one processor to perform operations for:
receiving a local behavioral rule;
in response to determining that the local behavioral rule is similar to the global behavioral rule, merging the local behavioral rule with the global behavioral rule; and
in response to determining that the local behavioral rule is not similar to the global behavioral rule, storing the local behavioral rule as a new global behavioral rule.

### Claim 12 (depends on 7)

The computer program product of claim 7, wherein a Software as a Service (SaaS) is configured to perform the operations of the computer program product.

### Claim 13

A computer system, comprising:
one or more processors, one or more computer-readable memories and one or more computer-readable, tangible storage devices; and
program instructions, stored on at least one of the one or more computer-readable, tangible storage devices for execution by at least one of the one or more processors via at least one of the one or more computer-readable memories, to perform operations comprising:
storing a plurality of global behavioral rules, wherein each of the global behavioral rules includes a behavioral pattern code fragment, an occurrence value for the behavioral pattern code fragment, a plurality of recommendations, and a recommendation score for each of the plurality of recommendations;
determining that a code fragment in a portion of code matches the behavioral pattern code fragment of a global behavioral rule of the plurality of global behavioral rules;
providing a recommendation from the plurality of recommendations of the global behavioral rule based on the recommendation score of the recommendation;
in response to the recommendation being applied, increasing the recommendation score of the recommendation; and
in response to the recommendation being rejected,
identifying an action taken; and
storing the action taken as a new recommendation for the behavioral pattern code fragment of the global behavioral rule.

### Claim 14 (depends on 13)

The computer system of claim 13, wherein the global behavioral rule was generated for a portion of code from a first code file, and wherein the portion of the code is from a second code file.

### Claim 15 (depends on 13)

The computer system of claim 13, wherein changes to the code are monitored to identify any combination of added code lines and deleted code lines, and wherein a local behavioral rule is generated based on the monitoring.

### Claim 16 (depends on 15)

The computer system of claim 15, wherein the local behavioral rule is sent for storage as a new global behavioral rule.

### Claim 17 (depends on 13)

The computer system of claim 13, wherein the operations further comprise:
receiving a local behavioral rule;
in response to determining that the local behavioral rule is similar to the global behavioral rule, merging the local behavioral rule with the global behavioral rule; and
in response to determining that the local behavioral rule is not similar to the global behavioral rule, storing the local behavioral rule as a new global behavioral rule.

### Claim 18 (depends on 13)

The computer system of claim 13, wherein a Software as a Service (SaaS) is configured to perform the operations of the computer system.
