Skip to content
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

Apply Ruff to popmon #259

Closed
sbrugman opened this issue Jan 31, 2023 · 1 comment · Fixed by #260
Closed

Apply Ruff to popmon #259

sbrugman opened this issue Jan 31, 2023 · 1 comment · Fixed by #260

Comments

@sbrugman
Copy link
Collaborator

sbrugman commented Jan 31, 2023

Run ruff and resolve any issues found

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.

@charliermarsh
Copy link

(Thank you @sbrugman for all your contributions!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants