Skip to content
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

Fix E301 not triggering on decorated methods. #10117

Merged

Conversation

hoel-bagard
Copy link
Contributor

Stacked on top of #10098.

Summary

This PR fixes #10114.

Test Plan

The example given in the issue has been added to the fixtures, and the results compared with pycodestyle.

@hoel-bagard hoel-bagard marked this pull request as ready for review February 25, 2024 11:01
Copy link
Contributor

github-actions bot commented Feb 25, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+14 -83 violations, +0 -0 fixes in 4 projects; 39 projects unchanged)

RasaHQ/rasa (+0 -2 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

- stubs/sanic.pyi:25:5: E301 [*] Expected 1 blank line, found 0
- stubs/sanic.pyi:30:5: E301 [*] Expected 1 blank line, found 0

apache/airflow (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

- airflow/utils/context.pyi:53:5: E301 [*] Expected 1 blank line, found 0

bokeh/bokeh (+2 -68 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ src/bokeh/util/compiler.py:127:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:10:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:11:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:12:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:13:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:14:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:15:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:16:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:17:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:18:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:19:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:20:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:21:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:22:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:23:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:24:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:25:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/common/action_chains.pyi:26:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/firefox/options.pyi:3:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webdriver.pyi:35:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:27:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:28:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:29:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:30:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:31:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:32:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:33:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:34:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:35:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:36:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:37:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:42:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/remote/webelement.pyi:51:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/support/expected_conditions.pyi:100:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/support/expected_conditions.pyi:104:5: E301 [*] Expected 1 blank line, found 0
- src/typings/selenium/webdriver/support/expected_conditions.pyi:108:5: E301 [*] Expected 1 blank line, found 0
... 34 additional changes omitted for project

pandas-dev/pandas (+12 -12 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ pandas/_libs/algos.pyi:100:5: PLR0917 Too many positional arguments (8/5)
+ pandas/_libs/algos.pyi:110:5: PLR0917 Too many positional arguments (7/5)
- pandas/_libs/algos.pyi:110:5: PLR0917 Too many positional arguments (8/5)
- pandas/_libs/algos.pyi:120:5: PLR0917 Too many positional arguments (7/5)
+ pandas/_libs/algos.pyi:17:7: PLW1641 Object does not implement `__hash__` method
- pandas/_libs/algos.pyi:22:7: PLW1641 Object does not implement `__hash__` method
+ pandas/_libs/hashtable.pyi:206:9: PLR0917 Too many positional arguments (6/5)
- pandas/_libs/hashtable.pyi:247:9: PLR0917 Too many positional arguments (6/5)
... 13 additional changes omitted for rule PLR0917
+ pandas/_libs/interval.pyi:58:1: PLR0904 Too many public methods (29 > 20)
- pandas/_libs/interval.pyi:59:1: PLR0904 Too many public methods (29 > 20)
+ pandas/_libs/tslibs/period.pyi:72:1: PLR0904 Too many public methods (24 > 20)
- pandas/_libs/tslibs/period.pyi:73:1: PLR0904 Too many public methods (24 > 20)
... 12 additional changes omitted for project

Changes by rule (4 rules affected)

code total + violation - violation + fix - fix
E301 73 2 71 0 0
PLR0917 18 9 9 0 0
PLR0904 4 2 2 0 0
PLW1641 2 1 1 0 0

@MichaReiser MichaReiser added bug Something isn't working rule Implementing or modifying a lint rule preview Related to preview mode features labels Feb 26, 2024
@MichaReiser MichaReiser changed the base branch from main to blank-lines-typing-stub February 26, 2024 08:55
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was quick! Thank you

@hoel-bagard
Copy link
Contributor Author

@MichaReiser Since it was a really small fix, should I rebase it on main so that the fix can be merged quicker ?

@MichaReiser
Copy link
Member

@hoel-bagard yeah that might be worth it. I thought the other PR's are quick wins but that's not the case :(

@hoel-bagard
Copy link
Contributor Author

@MichaReiser Ok, I'll do that.

Is there a way I can help with the other PR ?

@MichaReiser
Copy link
Member

That's very kind of you! The main struggle is finding a good way to make E301 and I001 compatible. See #10096 and @charliermarsh's comment

@hoel-bagard hoel-bagard force-pushed the hoel/fix-blank-lines-classmethods branch from 32b031f to 8854ded Compare February 27, 2024 09:43
@hoel-bagard hoel-bagard changed the base branch from blank-lines-typing-stub to main February 27, 2024 09:44
@MichaReiser MichaReiser enabled auto-merge (squash) February 27, 2024 09:45
@MichaReiser MichaReiser reopened this Feb 27, 2024
@MichaReiser MichaReiser force-pushed the hoel/fix-blank-lines-classmethods branch from 8854ded to b108cee Compare March 1, 2024 09:22
@MichaReiser MichaReiser enabled auto-merge (squash) March 1, 2024 09:24
@MichaReiser MichaReiser merged commit b82e877 into astral-sh:main Mar 1, 2024
17 checks passed
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
Co-authored-by: Micha Reiser <micha@reiser.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[E301] Failing to catch blank lines above classmethods when compared to pycodestyle
2 participants