Blocking comments vs. nitpicks in code reviews

Sara Verdi
Sara Verdi
Graphite software engineer

When it comes to code reviews, not all feedback is created equal. There are two very common types of comments found in code reviews: blocking comments and nitpicks (or nits). Understanding the distinction between the two is particularly important for effective communication and moving forward with the code review process. In this guide, we'll take a look at what each of these comments are and how to navigate them in the code review process.

Blocking comments are critical observations made during a code review that must be addressed before the code can be merged into the main branch. These comments often highlight significant issues that could affect the functionality, performance, or even security of the code. They typically require substantial changes or clarifications before approval.

  1. Functionality issues:

    • Comment: “The calculateTotal function does not handle negative input values, which could lead to incorrect calculations.”
    • Explanation: This comment indicates that the current implementation is fundamentally flawed, and addressing this issue is necessary for the code to function correctly.
  2. Security vulnerabilities:

    • Comment: “This code exposes sensitive user data without proper encryption. We need to implement encryption before merging.”
    • Explanation: Security concerns are often non-negotiable. This comment suggests that until the vulnerability is addressed, the code should not be merged.
  3. Performance concerns:

    • Comment: “The current algorithm has a time complexity of O(n^2). We should optimize this to O(n log n) for better performance on large datasets.”
    • Explanation: Performance-related comments indicate that the code’s efficiency is inadequate, which can affect overall application performance.

Nitpicks, often referred to simply as nits, are minor comments that do not necessarily block the merging of code. They usually pertain to style, formatting, or other minor issues that can improve code readability or maintainability but are not critical for functionality. While they won't necessarily affect the functionality of the code, it's still important to consider nits for consistency across your codebase.

  1. Code style conventions:

    • Comment: “Consider renaming the variable x to totalAmount for better readability.”
    • Explanation: While this change would enhance clarity, it does not impact the code’s functionality.
  2. Formatting issues:

    • Comment: “There should be a blank line between the method definitions for improved readability.”
    • Explanation: This is a stylistic preference that can make the code easier to read but does not affect how it runs.
  3. Documentation improvements:

    • Comment: “The function processData lacks a docstring. Please add a description of its parameters and return values.”
    • Explanation: Documentation is essential for maintainability, but missing it does not prevent the code from working correctly.

Effective code reviews should focus on blocking comments over nitpicks. This means that reviewers should address critical issues first before considering stylistic or minor improvements. A common pitfall in code reviews is allowing nitpicks to overshadow significant concerns. For example, if a reviewer is overly focused on formatting while ignoring a security vulnerability, they risk compromising the code quality.

  • Prioritize blocking comments: Make sure that critical issues are addressed first before diving into nitpicks. This approach helps maintain focus on what matters most for the code's integrity.
  • Categorize comments: Clearly categorize comments as blocking or nitpicks to avoid confusion during the review process. Using a consistent terminology can aid in establishing expectations among team members.
  • Use tools to streamline feedback: Tools like Graphite or GitHub’s code review features can be configured to flag different types of comments automatically. You can tag or categorize feedback into blocking issues (e.g., security vulnerabilities or breaking changes) versus nitpicks (e.g., code style or minor improvements). This helps reviewers prioritize feedback and focus on critical issues first.

Graphite's pull request inbox enables reviewers to see the status of PRs and the severity of feedback left. By integrating Graphite into your code review workflow, reviewers can see if a PR has blocking comments that need to be addressed immediately or if there are minor issues that don’t hold up the merge process. This helps streamline the feedback loop and reduce bottlenecks.

Understanding the differences between blocking comments and nitpicks is essential for effective code reviews. By focusing on critical issues first and leveraging tools like Graphite's PR inbox, teams can enhance their code quality and maintain a productive development environment. Establishing clear guidelines for comment types will help promote better communication and ensure that all team members are aligned in their review processes.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2