Skip to main content

Issues and PRs > Lines changed

Tom Williams avatar
Written by Tom Williams
Updated over 2 weeks ago

Dataset: Issues & Pull Requests

Entity: Pull Requests

Field ID: lines_changed

Type: Integer

Description: The number of lines of code added or deleted in the pull request (additions + deletions). For issues, the value is calculated from resolving pull requests.

Source: Calculated

Transformation logic:

  • Pull Requests: use the native diff data from the source application to sum additions and deletions.

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

From:

Github (PRs, Issues)

Calculated

Gitlab (PRs, Issues)

Calculated

Bitbucket (PRs)

Calculated

Azure DevOps (PRs, Issues)

Calculated

Jira (Issues)

Inferred from resolving PRs

ClickUp (Issues)

Inferred from resolving PRs

Trello (Issues)

Inferred from resolving PRs

Reporting Use Cases

The Lines Changed field is the primary indicator of the size or magnitude of a pull request, representing the total number of lines added and deleted. It is one of the most important metrics for understanding your team's development habits and enforcing code review best practices.

  • Filtering by Pull Request Size: You can easily scope your reports to focus on pull requests of a certain size, which is essential for managing review workload.

    • Identify Large Pull Requests: Isolate PRs that may be difficult and time-consuming to review by using a filter like Lines Changed > 1000. This helps in enforcing policies to break down large tasks into smaller, more manageable chunks.

    • Analyze a "Sweet Spot": Focus on pull requests within your team's ideal size range, for example, by filtering where Lines Changed is between 100 and 400.

  • Measuring Average PR Size: The most critical KPI derived from this field is the average size of your team's pull requests.

    • You can create a KPI or a line chart to track this trend over time using the custom formula AVG(lines_changed). A stable or decreasing average suggests your team is successfully keeping pull requests small and focused, which leads to faster and more effective reviews. A rising average can be an early warning sign of process breakdown.

  • Custom Formulas for Size Categorization: You can use custom formulas to group pull requests into size-based categories, which is perfect for high-level reporting.

    • PR Size Distribution: Create a dimension that buckets PRs into categories like "Small", "Medium", and "Large" using a formula such as IF(lines_changed > 1000, "Large", IF(lines_changed > 250, "Medium", "Small")). A stacked bar chart using this dimension can visualize the distribution of PR sizes each month, helping you understand if your team is trending toward larger or smaller changes.

Did this answer your question?