Comments: Sourcery will now spot issues in your code that don't have an
automated code fix. Instead we will give a detailed explanation of the issue
along with a guide on how to fix them. Just hover for more info. The first
comment that we have introduced is
raise-specific-error
- here we can identify that a base Exception
is being raised (and explain
how it is better to raise a specific exception), but we can't automatically
detect which exception should be raised in this case.
There is now a new config option to specify which rule types to display in the plugins - you can choose to any combination of refactorings, suggestions and comments.
Sourcery refactorings can now add imports where necessary. This means that we
can suggest using standard library functions such as contextlib.suppress
.
aware-datetime-for-utc
suggestion
remove-unnecessary-cast
refactoring
replace-interpolation-with-fstring
refactoring
swap-if-expression
refactoring
use-contextlib-suppress
refactoring
use-fstring-for-formatting
refactoring
use-itertools-product
refactoring
use-or-for-fallback
refactoring
avoid-builtin-shadow
comment
unwrap-iterable-construction
refactoring
path-read
will now
suggest importing pathlib
if it is not already imported.raise-from-previous-error
where raise e from e
was suggested.path-read
and
aware-datetime-for-utc
that caused them to never be triggeredremove-redundant-fstring
:
Do not trigger if the f-string contains escaped curly braces