-
Notifications
You must be signed in to change notification settings - Fork 21
Use ruff linter and formatter #3424
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
Conversation
This reverts commit bf192b631e1d73ea9e2c58a15bd1574ff324b480.
I'm up for enabling docstring formatting! |
|
I tried out the pyupgrade fixes. There are some useful ones that we should probably do. But we'd have to run it again when we drop python 3.9. Since that happens soon, I'd just leave it for now and run pyupgrade later. |
| # those files have an increased risk of relying on import order | ||
| "__init__.py" = ["I"] | ||
| # asserts are fine because this code is meant to be used with pytest | ||
| "src/scipp/testing/*" = ["S101"] | ||
| "tests/*" = [ | ||
| "S101", # asserts are fine in tests | ||
| "B018", # 'useless expressions' are ok because some tests just check for exceptions | ||
| ] | ||
| "tools/*" = [ | ||
| "S101", # asserts are fine, we do not run tools with optimizations | ||
| "T201", # printing is ok for internal tools | ||
| ] | ||
| "*.ipynb" = [ | ||
| "E501", # longer lines are sometimes more readable | ||
| "I", # we don't collect imports at the top | ||
| "S101", # asserts are used for demonstration and are safe in notebooks | ||
| "T201", # printing is ok for demonstration purposes | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for putting detailed reasons!
|
Shouldn't https://github.com/scipp/scipp/blob/main/setup.cfg also be removed? All the config now is in pyproject.toml |
nvaytet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go ahead with this 👍
|
I added the remaining rules from scipp/esssans#127. Some required a lot of fixes, esp I found a broken test thanks to |
First step for scipp/copier_template#70
I adapted the setup from Scitacean because I'm happy with it. But please check whether the selected rules are a good choice.
I did not enable
Dbecause there are too many violations. But it allows us to enforce a docstring format and can help avoid rst pitfalls. I'm in favour of enabling it, but please comment!