PyCQA / pycodestyle

Simple Python style checker in one Python file

Home Page:https://pycodestyle.pycqa.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

E306 clarification

hoel-bagard opened this issue · comments

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.

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

the rule is implemented correctly as is