-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Standardise ruff config #15558
base: main
Are you sure you want to change the base?
Standardise ruff config #15558
Conversation
The test failure appears to be from the
I would appreciate some guidance on how best to approach a fix. |
This is what we've done in the past whenever we've updated the pyproject.toml settings :-) it's a bit silly but it's easy |
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.
Thank you!
@@ -58,23 +58,44 @@ include = [ | |||
] | |||
|
|||
[tool.ruff] | |||
target-version = "py39" |
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.
Some of our scripts require newer Python versions than this, but this seems fine
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.
Most scripts do; however, https://github.com/astral-sh/ruff/blob/main/python/ruff/__main__.py#L17 assumes that less than 3.10 may be used, so I went for the lowest currently supported Python version.
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.
This should be Py38 then.
target-version = "py39" | |
target-version = "py38" |
4bc1471
to
04c99dd
Compare
|
@@ -72,10 +71,156 @@ file_resolver.project_root = "[BASEPATH]" | |||
linter.exclude = [] | |||
linter.project_root = "[BASEPATH]" | |||
linter.rules.enabled = [ | |||
unary-prefix-increment-decrement (B002), |
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 think we have to fix this test to be isolated from our own pyproject.toml
. It otherwise becomes very annoying because it requires updating whenever we add or remove a rule from any enabled category.
f"{group.owned_enum_ty}::{node.variant}(node) => " | ||
"node.visit_source_order(visitor)," |
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.
Splitting this over multiple line decreases readability. I suggest disabling E501 and keep it as regular string.
extend-exclude = [ | ||
"crates/red_knot_vendored/vendor/", | ||
"crates/ruff/resources/", | ||
"crates/ruff_linter/resources/", | ||
"crates/ruff_python_formatter/resources/", | ||
"crates/ruff_python_parser/resources/" | ||
] | ||
line-length = 88 |
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.
line-length = 88 |
This is the default
Summary
Follow up to #15544 and #15544 (review) to move the Ruff config used in scripts into the
pyproject.toml
in the root directory now that Python scripts are being added outwith the scripts directory.Only changes required relate to line length. I have updated to split at 88 characters; however, if a
noqa
would be better in this instance, please let me know, and I can update.Test Plan