-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Development: introduce Ruff as linter/formatter #3039
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
345ad47
add: ignore `.python-version` created by pyenv
xLinkOut d734c7d
add(dep): Ruff as dependency
xLinkOut 687b695
new(ruff): Ruff configuration file
xLinkOut 86ab7de
chg(ruff): assume python 3.10 as minimum supported version
xLinkOut 31733ab
new: pre-commit hook that use Ruff to lint and format
xLinkOut 9423af7
chg(actions): use ruff for linting
xLinkOut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ dist/ | |
| .env | ||
| .venv/ | ||
| venv/ | ||
| .python-version | ||
|
|
||
| # IDEs | ||
| .idea | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Assume Python 3.11 | ||
| target-version = "py311" | ||
|
|
||
| # Formatting options | ||
| line-length = 100 | ||
| indent-width = 4 | ||
|
|
||
| exclude = [ | ||
| "__pycache__", | ||
| ".eggs", | ||
| ".git", | ||
| ".tox", | ||
| ".venv", | ||
| "*.egg-info", | ||
| "*.pyc", | ||
| ] | ||
|
|
||
| [lint] | ||
| # https://docs.astral.sh/ruff/rules/ | ||
| select = [ | ||
| "B", # flake8-bugbear | ||
| "B9", | ||
| "C", | ||
| "E", # pycodestyle | ||
| "F", # Pyflakes | ||
| "I", # isort | ||
| "N", # pep8-naming | ||
| "UP", # pyupgrade | ||
| "W", # pycodestyle | ||
| ] | ||
| ignore = [ | ||
| "B007", # unused-loop-control-variable | ||
| "B909", # loop-iterator-mutation | ||
| "E203", # whitespace-before-punctuation | ||
| "E266", # multiple-leading-hashes-for-block-comment | ||
| "E501", # redundant-backslash | ||
| "F403", # undefined-local-with-import-star | ||
| "N802", # invalid-function-name | ||
| "N806", # non-lowercase-variable-in-function | ||
| "N815", # mixed-case-variable-in-class-scope | ||
| ] | ||
|
|
||
| [lint.mccabe] | ||
| max-complexity = 12 | ||
|
|
||
| [format] | ||
| indent-style = "space" | ||
| quote-style = "preserve" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
we actually test and support 3.10/3.11 and 3.12, so that needs to be taken into account (so the github build workflow, maybe it can be integrated there somehow?)
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.
I assumed that the lower supported version was 3.11. I'll change that config to
py310, so Ruff know which upgrade suggestions can be safely applied.