How to use Sourcery custom rules to complete common tasks
We’ve focused on improving our documentation for custom rules. Check out these how-to guides:
- How to use Sourcery custom rules to get rid of deprecated code
- How to use Sourcery custom rules to remove debugging statements from your code
Added
- Create Sourcery Rule command to VS Code. This creates a new stub rule in your project-level Sourcery configuration (creating that config if it doesn’t exist). You can access this command from the Command Palette, or by selecting the code that you want to be the base pattern for your rule, right clicking and choosing Sourcery: Create Rule.
- Support for captures in custom rules descriptions
- CLI option
--exclude
to exclude some rules for the commandsreview
andrefactor
- Documentation: How to use Sourcery custom rules to get rid of deprecated code
- Documentation: How to use Sourcery custom rules to remove debugging statements from your code from your code?
- Reference Documentation about Sourcery custom rules
Changed
- hoist-similar-statement-from-if has been split out from hoist-statement-from-if. This may mean some skip comments need to be applied.
- The
--include
option has now been sped up, as it now runs only the proposers necessary for the included proposals.
Fixed
- Class-level refactorings will now appear again.
- Issue with hoist-repeated-if-condition that caused if-statements to appear with empty tests if the hoisted expression was a boolop
- Improve responsiveness of CLI to keyboard interrupts
- Fall back to locally saved authentication if Sourcery auth server throws an error
- Show
explanation
in VSCode, PyCharm and the CLI for Sourcery custom rules