Skip to main content
Pull Request Size

Definition of the "PR Size" Metric

J
Written by James McGill
Updated over 4 months ago

Pull Request Size

The "PR Size" metric can be used to track trends in the size of all Pull Requests.

Definition

The number of lines that were added, changed or removed in relevant files in all pull requests.

The number of lines added, changed or removed is calculated relative to the base branch for each pull request.

In order to provide a more accurate view into coding activity within your organization, Velocity only measures changes to relevant files in each Pull Request. You can learn more about how Velocity determines Relevant Files and how to configure that behavior here.

Why it matters

Typically, pull requests that are small are easier to review and get through the software development process faster. Each pull request also poses less risk because less is being changed at any one given time. Larger pull requests are more likely to get stuck in the review process and take up a lot of time from several engineers.

How to use it

When this metric is consistently high for an individual or team, it usually represents a coaching opportunity. During a coaching session, you may encourage a mentor to take a large pull request and work through how the solution may have been implemented in more incremental changes.

It’s far easier to keep pull requests small than it is to break them down when they’re already large, so be on the lookout for any individual Pull Request that exceeds the team’s typical size, and consider helping team members merge them before they get too big.

We suggest that you use Velocity to set Decrease pull request size targets to track the percentage of PRs that are larger than a line count threshold. You might target having more than 90% of PRs with less than 400 lines, for example.

Benchmarks

The median organization averages a PR size of 197 lines of code. A quarter of organizations have PRs averaging less than 161 lines, while, at the other extreme, a quarter have PRs averaging more than 237 lines.

Did this answer your question?