Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Pull Request Size is a measure of the size of pull requests including the number of lines changed within each filepull request submitted for review.

Why does Pull Request Size matter?

Code reviews are an important part of the software development lifecycle because they provide the ability for code written by team members to be peer reviewed and assured for quality before the code is merged from branch into master. Reviewing pull requests can also be one of the most time consuming activities of a team’s software development process.

Making smaller pull requests is the best way to speed up time spent reviewing your peer’s work. By applying the discipline to break down pull requests into smaller, manageable batches of code, it’s much quicker for reviewers to understand the context and , reason with the logic and detect defects that need remediation.

...

Small pull requests are easier to review, making also make it more likely for code to be thoroughly reviewed before approval. It helps to speed up the review, reduces risk of introducing bugs into the codebase, helps not to block other developments developers and speeds up the process to finalise and ship the product development process.team’s product to customers for feedback.

Large pull requests tend to be glazed over and rubber stamped, limiting the effectiveness of defect detection.

What does ‘good’ Pull Request Size looks like?

Common practice suggest developers should review Pull Requests no more than 200-400 lines of code (LOC) at a time. The This is because the brain can only process so much information at a time. Beyond 400 LOC, the ability to find defects diminishes.

Research also indicates that a review of 200-400 LOC over 660-90 minutes should yield70yield a 70-90% defect discovery rate.

Large pull requests tend to be glazed over and rubber stamped, limiting the effectiveness of defect detection.

How Umano measures Pull Request Size

...

Practices that influence Pull Request Size

...

  • Number of lines added in a PR

  • Number of lines removed in a PR

  • Number of issues addressed in a PR

  • Number of comments made by reviewers

  • Number of tasks created by reviewers

What’s included?

Each model looks and at specific activities within the tools. Below a list of activities that contribute to Balance of Communication Pull Request Size and activities that do not have an impact on this metric.

Included

Not included

All Pull Requests in selected repositories

xNumber of files per Pull Request

Tips for improving Pull Request Size

Tip

Review fewer than 400 lines of code at a time for effective defect detection

Tip

Code reviews in reasonable quantity, at a slower pace for a limited amount of time results in , done frequently throughout the sprint is the most effective code review practice

Tip

Shout out for Acknowledge Pull Requests that are deleting delete lines of code in your code base as this usually indicates a good cleanauthors are cleaning-up of the code base, removal of removing technical debt and improves improving maintainability of the your code base

Tip

Review fewer than 400 lines of code at a time for effective defect detection

Resources

  1. Dias, H., The anatomy of a perfect pull request, 2018, <https://medium.com/@hugooodias/the-anatomy-of-a-perfect-pull-request-567382bb6067 >

  2. Osepchuk, B., Optimal pull request size, 2017, <https://smallbusinessprogramming.com/optimal-pull-request-size/>

  3. Riosa, B. The (written) unwritten guide to pull requests, 2016, <https://www.atlassian.com/blog/git/written-unwritten-guide-pull-requests

  4. Dias, H., The anatomy of a perfect pull request, 2018, <https://opensource.com/article/18/6/anatomy-perfect-pull-request

  5. Hewa, G., How Big is Your Pull Request?, 2017, <https://hackernoon.com/how-big-is-your-pr-32c4d67ad76c

  6. Yu, Y., Wang, H., Filkov, V., Devanbu, P. and Vasilescu, B., 2015, May. Wait for it: Determinants of pull request evaluation latency on GitHub. In Mining software repositories (MSR), 2015 IEEE/ACM 12th working conference on (pp. 367-371). IEEE.

...