-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ruff check --fix --unsafe-fixes #1997
ruff check --fix --unsafe-fixes #1997
Conversation
e604d18
to
2854ab6
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1997 +/- ##
=====================================
- Coverage 93% 93% -0%
=====================================
Files 370 370
Lines 28312 28313 +1
=====================================
- Hits 26133 26118 -15
- Misses 2179 2195 +16 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
This looks good @cclauss. When you rebase, can you also replace
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
Thanks |
c6e6dd1
to
1e4ed43
Compare
I never have much luck with Poetry so perhaps I made |
Ah yeah you have to do |
Autofixes are made with
ruff
, a radical superset of flake8.Most of these transformations were documented 23 years ago in the Python style guide PEP8.
%
ruff check --statistics | grep "\[\*\]" | sort -k2
%
ruff check --fix --unsafe-fixes
%
ruff rule E711
none-comparison (E711)
Derived from the pycodestyle linter.
Fix is always available.
What it does
Checks for comparisons to
None
which are not using theis
operator.Why is this bad?
According to PEP 8, "Comparisons to singletons like None should always be done with
is
oris not
, never the equality operators."Example
Use instead:
Fix safety
This rule's fix is marked as unsafe, as it may alter runtime behavior when
used with libraries that override the
==
/__eq__
or!=
/__ne__
operators.In these cases,
is
/is not
may not be equivalent to==
/!=
. For moreinformation, see this issue.