The popmon ruff configuration works with nbqa for notebooks, and has selected rules for tests, sphinx config and examples.
Some checks are disabled, but would benefit from manual refactoring.
There is also a set of rules that can be mechanically refactored, for violations that occur more often. Here autofix would be a great improvement over manual refactor:
# Prefer autofix
"PD011", # [1] .to_numpy() instead of values
"PD003", # [1]`.isna` is preferred to `.isnull`; functionality is equivalent
"PT018", # [2] Assertion should be broken down into multiple parts
"RET504", # [3] Unnecessary variable assignment before `return` statement
"RET506", # Unnecessary `else` after `raise` statement
"PTH123", # [4] `open("foo")` should be replaced by `Path("foo").open()`
"PTH120", # [4] similar to above
"RET505", # Unnecessary `else` after `return` statement
"SIM102", # (when comments are in the statement) Use a single `if` statement instead of nested `if` statements
"SIM114", # (when comments are in the statement) Combine `if` branches using logical `or` operator
"G004", # Logging statement uses f-string
A couple of them are already in progress. Related autofix PRs:
\cc @charliermarsh in case you are interested. Thanks a lot for all your work on ruff :) I'm considering adding the remaining autofixes too if that is appreciated.
Run
ruff
and resolve any issues foundThe popmon ruff configuration works with
nbqa
for notebooks, and has selected rules for tests, sphinx config and examples.Some checks are disabled, but would benefit from manual refactoring.
There is also a set of rules that can be mechanically refactored, for violations that occur more often. Here autofix would be a great improvement over manual refactor:
A couple of them are already in progress. Related autofix PRs:
\cc @charliermarsh in case you are interested. Thanks a lot for all your work on
ruff
:) I'm considering adding the remaining autofixes too if that is appreciated.