Skip to main content

Issues and PRs > Lines deleted

Tom Williams avatar
Written by Tom Williams
Updated this week

Dataset: Issues & Pull Requests

Entity: Pull Requests

Field ID: deletions

Type: Integer

Description: The number of lines of code deleted in the pull request. For issues, the value is calculated from resolving pull requests.

Source: App (Pull Requests) / Calculated (Issues)

Transformation logic:

  • Pull Requests: use the native diff data from the source application.

  • Issues: the sum of lines deleted by all resolving pull requests.

From:

Github (PRs, Issues)

deletions

Gitlab (PRs, Issues)

Calculated from PR diff (API)

Bitbucket (PRs, Issues)

diffstats.deletions

Azure DevOps (PRs, Issues)

Calculated by performing a repo git diff

JIRA (Issues)

Inferred from resolving PRs

ClickUp (Issues)

Inferred from resolving PRs

Trello (Issues)

Inferred from resolving PRs

Reporting Use Cases

The Lines Deleted field is a key metric for understanding code maintenance and refactoring efforts. While new features often involve adding code, a healthy project also involves removing obsolete code, simplifying complex logic, and replacing old systems. As a numeric field, deletions is crucial for creating advanced metrics that measure the health of your codebase.

  • Filtering for Cleanup and Refactoring: You can create reports that specifically target pull requests involving significant code removal.

    • Identify Major Refactors: Find large-scale refactoring or cleanup initiatives by using a filter like Lines Deleted > 1000.

    • Find "Removal-Only" PRs: Isolate pull requests that only remove code (e.g., deleting a deprecated feature) by using a combination of filters: Lines Deleted > 0 and Lines Added = 0.

  • Measuring Code Removal Volume: You can aggregate this field to understand the scale of cleanup activities.

    • Total Code Removed: A KPI with the custom formula SUM(deletions) can show the total number of lines removed during a specific period, which is a great way to quantify the impact of a "cleanup sprint".

  • Custom Formulas for Code Health Ratios: The most powerful use of this field is in combination with additions to calculate your team's refactoring habits.

    • Refactoring Ratio: This essential metric tracks the proportion of code being removed versus added. It is calculated with the formula ROUND(SUM(deletions) / IF_ZERO(SUM(additions), 1) * 100, 2). A healthy refactoring ratio indicates that your team is actively managing technical debt rather than just accumulating new code.

    • Code Churn: deletions is also a core component of "code churn," which measures the total volume of code being changed. This can be calculated with SUM(additions) + SUM(deletions) (same as SUM(lines_changed)).

Did this answer your question?