Skip to content

Sourcery Code Reviews

Sourcery reviews every pull request or merge request you make. Each time a PR/MR is opened, Sourcery starts a code review and adds a review directly in GitHub or Gitlab.

Our goal is to give you the same type of feedback you would expect from a peer review, but much faster. If you ever find that something is mising from one of our reviews please let us know.

The Pieces of a Sourcery Review

PR Summary At the top of each PR we add in a summary of the major changes to the code.

PR Summary

Review Guide The review guide thematically groups together each of the major changes made in the PR and lests which files contribute to those changes.

Review Guide

Overall Review Each review has a primary review comment where Sourcery gives its overall impression of the changes and gives feedback on higher level issues around the code change.

Overall Review

Review Decision (disabled by default) As a piece of the overall review Sourcery can decide to approve a PR or request changes and have this update the PRs status in GitHub or GitLab. Within GitHub or GitLab this is treated the same way as if someone on your team approved a PR or requested changes.

By default review decsions are disabled, but you can enable them in the Review Settings section of your Sourcery dashboard.

Individual Review Comments Sourcery will place comments in line for individual sections of code with feedback that is specific to that code change.

Indivudal Comments

Improvement Suggestions In certain cases, Sourcery will propose a suggested code change that would address an issue it raises as an individual comment. You can commit these suggestions directly if you are happy with them.

The PR Summary, Review Guide, and Review Decision are all configurable and can be disabled.

How Sourcery Reviews Code

To review code changes Sourcery looks at the diff of the code change and uses a blend of large language model (LLM) analysis and static analysis.

We use a series of AI code reviewers eac with different specialities to review the code from a number of different angles. For example, we have a Complexity reviewer that is specifically focused on whether the changes made to the code are being made in the cleanest and simplest way possible or if they are introducing unnecessary complexity to the code.

Some of the current review reviewers are:

  • General code quality
  • Security
  • Complexity
  • Custom review instructions

On top of these reviewers we use our own static analysis engine that uses a rules based system to identify potential code quality issues that need to be flagged and fixed during a PR.

After all of the potential comments on a PR are generated we have a validation process to reduce false positives and unhelpful comments, factors to generate overall reviews and review summaries, and finally present the full review to you.

Interacting with Sourcery

You can reply to any of Sourcery's comments to start a conversation with Sourcery. This can be particularly useful if you are looking for additional information for Sourcery about a comment, would like a proposed fix to an issue Sourcery identified, or you would want to give Sourcery additional context it is missing aobut your project.

On any individual review comment you can add a thumbs up or thumbs down reaction to Sourcery's comment to provide feedback on whether or not the comment was useul and help us improve our comments over time

Requesting a new review

At any point you can ask Sourcery to review an existing PR if it hasn't previously reviewed it or to re-review a PR it has previously reviewed.

Add a comment on the PR (only in GitHub) saying "@sourcery-ai review" and Sourcery will start the review.

IDE Code Reviews

In addition to reviewing code in GitHub or GitLab, Sourcery can review code in VS Code or in any JetBrains IDEs. See our Getting Started section for more details on setting up IDE reviews.