| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
If this is your first time using Sourcery you'll need to set up a Sourcery account. You can create an account with your GitHub account, Google account, or your email address.

Sourcery needs a token to run in VS Code. To get your token, just log into your Sourcery account and copy the token on the page.
Then:

Sourcery will run in the background whenever you're working on a Python file. When Sourcery detects a refactoring opportunity it will underline the first line of code it recommends that you change. Hover over the underlined line to get an explanation of the change along with a diff of the proposed changes to your code.
To accept a suggestion you can:

To accept a suggestion you can:

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
```
Sourcery gives every one of your functions a quality score on 4 different metrics:
To see the metrics for any function, simply hover your mouse of the line defining the function and the Sourcery metrics will pop up. Each metric will have a numeric score, along with a quick qualitative guide ranging from bad to excellent.

Sourcery will also automatically flag functions with too low of an overall quality score. By default this is set for functions with a quality score under 25%, but you [can configure this](Sourcery Configuration).
Sometimes you might see a Sourcery suggestion you don't want to accept. You can ignore these suggestions in one of three ways:

You can also configure Sourcery to never suggest a particular refactoring. For details see the Sourcery Configuration page.
There are more advanced ways you can improve your code with a Sourcery Pro or Sourcery Team subscription:
You can have Sourcery review multiple files, a folder, or an entire project at once:

Sourcery will automatically detect opportunities for repeated or nearly repeated sections of code within a function to be extracted out into their own methods. When these refactorings are suggested the new methods will be given a generic name based on the function it was extracted from and you can easily rename it.

Sourcery can help you find duplicate sections of code across your project.

Please visit our newer docs at https://docs.sourcery.ai
| Back | FazBrowse Home | New Git URL |