-
Notifications
You must be signed in to change notification settings - Fork 3.4k
ruff check --preview --select=E303 #23155
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
ruff check --preview --select=E303 #23155
Conversation
| - checkout | ||
| - pip-install | ||
| - run: ruff check | ||
| - run: ruff check --preview --select=E303 |
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.
Is there any way to have ruff check include E303 without adding these extra command line argument?
I'm just thinking for local development its nice to just run ruff check from time to time.
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.
Nope. We need to target using both --preview and --select=E303. Without --preview, E303 will not be tested. Without --select=E303 then ruff check --preview with our current ruff config in pyproject.toml returns:
Found 17355 errors.
[*] 497 fixable with the--fixoption (221 hidden fixes can be enabled with the--unsafe-fixesoption).
I chose this approach because running both commands one after the other will take a small fraction of one second.
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.
Ok that sounds like a reasonable solution for now. Can you add a comment explaining why this is needed? Is it simply that the ruff authors are still working on the E303 rule? Will it become stable at some point and we can remove this? Perhaps mention that in the 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.
Will do… https://docs.astral.sh/ruff/preview
|
8422ad3 to
69c0b34
Compare
|
I reverted to the original solution. |
69c0b34 to
6918b4b
Compare
This rule was lost in the recent switch from flake8. This change brings back that rule which is currently in preview in ruff. See emscripten-core#23139 (comment)
As requested at:
%
ruff rule E303too-many-blank-lines (E303)
Derived from the pycodestyle linter.
Fix is always available.
This rule is in preview and is not stable. The
--previewflag is required for use.What it does
Checks for extraneous blank lines.
Why is this bad?
PEP 8 recommends using blank lines as follows:
Example
Use instead:
Typing stub files (
.pyi)The rule allows at most one blank line in typing stub files in accordance to the typing style guide recommendation.
Note: The rule respects the following
isortsettings when determining the maximum number of blank lines allowed between two statements:lint.isort.lines-after-imports]: For top-level statements directly following an import statement.lint.isort.lines-between-types]: Forimportstatements directly following afrom ... import ...statement or vice versa.Options
lint.isort.lines-after-importslint.isort.lines-between-typesReferences