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

E306 clarification #1216

Closed
hoel-bagard opened this issue Nov 24, 2023 · 1 comment
Closed

E306 clarification #1216

hoel-bagard opened this issue Nov 24, 2023 · 1 comment

Comments

@hoel-bagard
Copy link

Hi,
I would like to know if the following code snippet should generate an E306 error (it currently does not).
This code snippet comes from the flake8rules website, which (if my understanding is correct), is not directly associated with pycodestyle.

def outer():
    def inner():
        pass

Looking at the pycodestyle files, I found this test and definition below that suggests that the snippet above is not supposed to generate an error. However the official error definition E306: expected 1 blank line before a nested definition seems to say that there should be a blank line (unless the first nested def is an exception).

#: E704:4:5 E306:4:5
def foo():
    def bar():
        pass
    def baz(): pass
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

If the current behavior is not the desired one, I can make a PR to fix it.

@asottile
Copy link
Member

flake8rules is not associated. don't trust what they have

the rule is implemented correctly as is

hoel-bagard added a commit to hoel-bagard/ruff that referenced this issue Nov 24, 2023
hoel-bagard added a commit to hoel-bagard/ruff that referenced this issue Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants