Skip to content
Nick Thapen edited this page Apr 17, 2021 · 2 revisions

Installation

Installation

You can install the Sourcery GitHub app directly using this link:

https://github.com/apps/sourcery-ai/installations/new

Getting Started

Sourcery automatically reviews any new PRs made to your repo and will give suggestions on how you can improve your code. Sourcery will only review the changes made in the PR, not your full code base.

To have Sourcery review your whole repository:

  • Open up your Sourcery Dashboard
  • Select your repo (or add new repos)
  • Click the Refactor button

How To

Accept a Suggestion

In GitHub you can accept all of Sourcery's suggestions by merging the PR

Add new repos

To add Sourcery to new repos:

  • Open up your Sourcery Dashboard
  • Click the Add Repo button
  • Select the repo you want to add

Disable Sourcery on a File or Path

We know there might be files or paths you don't want Sourcery to refactor - especially things like third party libraries. If you want Sourcery to ignore these you can add a file or a path to the ignore section in the .sourcery.yaml file in your project directory like this:

    ```
    ignore:
      - data/*
      - .venv/*
      - '*_test.py'  # Note that any strings beginning with * must be quoted
    ```

See Quality Metrics

Sourcery provides quality metrics on every Sourcery PR. Scroll to the bottom of the pull request to see Sourcery's metrics across four different areas:

  • Complexity
  • Method Length
  • Working Memory
  • Overall Quality

Sourcery will comment on each pull request scanned with a Quality Report. This details whether the pull request has increased or decreased code quality in the affected files, and gives a breakdown per file. It also shows up to five functions in these files that have a low quality score, and our recommendations for improving them. Please see the Quality Report page for more details on the metrics used and how we calculate the quality score.