The Sourcery Pre-Commit Hook¶
With the Sourcery pre-commit hook, you can:
- set up automated code quality checks for every commit
- review your code before you send it to a human reviewer
- set up the same quality gates as in your CI system
The recommended setup for a pre-commit hook:
{# x-release-please-start-version #}
repos:
- repo: https://github.com/sourcery-ai/sourcery
rev: v1.10.0
hooks:
- id: sourcery
# The best way to use Sourcery in a pre-commit hook:
# * review only changed lines:
# * omit the summary
args: [--diff=git diff HEAD, --no-summary]
{# x-release-please-end #}
For more details and configuration options, check out the Getting Started with pre-commit guide.