Read Anthropic’s case study about Graphite Reviewer

Gerrit Review Score Cards: A Unique Approach to Code Quality

Greg Foster
Greg Foster
Graphite software engineer

Gerrit's review score cards are a customizable scoring system used during code reviews. They allow reviewers to provide quantitative feedback on changes submitted to the codebase, reflecting the quality and readiness of the code for integration.

Screenshot of Gerrit's scoring

  • Standardizing Review Feedback: Score cards provide a standardized way for reviewers to rate changes, leading to consistent and objective feedback.

  • Facilitating Decision Making: Quantitative scores help maintainers quickly gauge the consensus on a change and make informed decisions about its integration.

Score cards in Gerrit consist of labels that can be configured per project. These labels can represent different criteria such as code quality, validation, and verification.

  • Code-Review Label: This is a standard label used to assess the overall quality of the code change. It can range from -2 (rejecting the change) to +2 (endorsing the change for merging).

  • Verified Label: Often tied to automated testing, this label can reflect whether the change has passed CI checks.

  • Custom Labels: Teams can define additional labels to capture other aspects of the code review process, such as performance or documentation quality.

  • Negative Scores: Negative scores typically indicate a veto or a requirement for changes before proceeding. A -1 or -2 can block a change from being submitted.

  • Positive Scores: A positive score like +1 or +2 signals approval, with higher scores generally reflecting a higher level of confidence in the change.

  • Zero Score: A score of 0 can denote neutrality or an abstention from voting on a particular aspect of the change.

Gerrit administrators set up score cards by configuring the project's project.config file to define what labels are available and their respective ranges.

  • Code Review Workflow: Reviewers assign scores to each label based on their assessment of the change.

  • Iteration: Authors may update the change and seek new scores if initial reviews are not satisfactory.

  • Aggregation of Scores: Gerrit aggregates the scores from all reviewers to provide an overall status for the change.

To make the most of Gerrit's review score cards, certain best practices are encouraged:

  • Clear Documentation: Clearly document what each label and score signifies to ensure reviewers use them consistently.

  • Training Reviewers: Train reviewers on the importance of objective and thorough evaluations when assigning scores.

  • Balanced Use of Scores: Encourage reviewers to use the full range of scores to provide nuanced feedback, rather than defaulting to extremes.

Gerrit's review score cards are a powerful mechanism for ensuring that changes meet the project's standards before integration. By providing a structured and quantifiable way to assess code, Gerrit fosters a rigorous review culture that upholds code quality and supports collaborative decision-making. This system underscores the commitment to excellence in software development, positioning Gerrit as an essential tool for teams prioritizing quality and precision in their code 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