Tag rules and CLI improvements
Rule tags
Rules can now be tagged by adding a tags key. Then you can include these tags from the CLI to choose a subset of rules to run.
This makes it easy to specify which rules you want to run in CI. First add a tag to the rules you want:
rules:
- id: important-rule
tags:
- ci
pattern: "..."
Then run the ci
tag with sourcery review --include ci .
Set up Sourcery in pre-commit and CI
It is now much easier to configure Sourcery to run in pre-commit or CI. Run:
sourcery init pre-commit
sourcery init ci
Full changelog
Added
- Docs: custom rule recipe: Enforce Naming Conventions Rules: You can now add
tags to rules,
and include or exclude them with the
include
andexclude
/skip
config and CLI options. Sourcery’s built-in rules carry thebuilt-in
tag. - IDE: LSP command to login through browser
Changed
- CLI: make rule ids clickable links in non-verbose mode
- CLI: Enhanced
sourcery init
command in CLI - you can now use it to addpre-commit
config, as well as view instructions to add Sourcery to CI. - CLI: review: do not print a summary in a pre-commit environment