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.
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
Replace flakeheaven and isort with ruff #2747
Replace flakeheaven and isort with ruff #2747
Changes from 4 commits
451cb61
ece0730
03e0357
a208ca8
b369811
ead3abe
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Previously with
flakeheaven
, we setmax_line_length=88
(to matchblack
). But settingline-length=88
withruff
without settingignore = ["E501"]
would raise errors on lines like these:Note that
black
doesn't format these code lines over 88 characters, butruff
complains about it. The thing is, we recently disabledpylint
's line-length checking in #2735, because we assumed that flakeheaven's pycodestyle checker would handle it, but ruff's pycodestyle checker is a little different.So what should we do in this case?
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.
Can we ignore both
E501
(for codes) andW505
(for docs) inruff
and enablepylint
's line-length checking (I assume it checks both codes and docs).For long URLs, we can either add
# pylint: disable=line-too-long
to the lines or improve the regex for theignore-long-lines
option to make it work for lines likeThere 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'm considering that we replace
pylint
withruff
eventually (see #2741 (comment)), so would prefer not to addpylint
's line-length checking back.E501 is ignored already right now. We could ignore
W505
too I suppose, assuming thatblackdoc
anddocformatter
is sufficient, and we don't plan to replace both withruff
🙂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.
docformatter
: astral-sh/ruff#1335blackdoc
: astral-sh/ruff#7146There 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.
Sounds good to me.
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.
Hmm actually, I just did some tesitng and maybe we shouldn't ignore
W505
. I just tried ignoringW505
in pyproject.toml and removed all thenoqa: W505
, and blackdoc/docformatter doesn't format things properly when I runmake format
: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.
https://docs.astral.sh/ruff/rules/doc-line-too-long/#why-is-this-bad
I think it means that we can simply remove all
noqa: W505
and don't have to ignoreW505
.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.
Tried removing all the
noqa: W505
in a208ca8. Style Checks show these errors:You're right that the long URLs from #2728 don't raise W505 errors anymore, but there are 9 others we'll need to fix.
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.
Note that
ruff
'sisort
rules is nearly-equivalent toisort
'sprofile="black"
settings (see https://docs.astral.sh/ruff/faq/#how-does-ruffs-import-sorting-compare-to-isort). Also, files that are gitignored are automatically skipped from being check (see astral-sh/ruff#1234), so no need to apply these rules anymore.