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 false positive #619

Closed
mlococo opened this issue Jan 30, 2017 · 12 comments · Fixed by #620
Closed

E306 false positive #619

mlococo opened this issue Jan 30, 2017 · 12 comments · Fixed by #620

Comments

@mlococo
Copy link

mlococo commented Jan 30, 2017

If I create demo.py with the following contents:

def the_funk():
    1 + 1
    definitely_not_a_function = 1
    return definitely_not_a_function + 1

And run pycodestyle demo.py, I get: bug.py:3:5: E306 expected 1 blank line before a nested definition, found 0. I believe E306 is intended to apply to nested function definitions, but this does not contain a nested function definition.

@sigmavirus24
Copy link
Member

What version of pycodstyle are you running? What version of Python? How did you install pycodestyle?

@mlococo
Copy link
Author

mlococo commented Jan 30, 2017

  • Installed via virtualenv.
  • venv/bin/pycodestyle --version -> 2.3.0
  • venv/bin/python --version -> Python 2.7.12+

@mlococo
Copy link
Author

mlococo commented Jan 30, 2017

But it also happens when installed globally via pip:

  • sudo pip install --upgrade pycodestyle
  • which pycodestyle -> /usr/local/bin/pycodestyle
  • pycodestyle --version -> 2.3.0
  • pycodestyle demo.py -> E306 output.

@tomhamiltonstubber
Copy link

Also with python3.5

@samuelcolvin
Copy link

Same with python 3.5. Kind of amazing this got as far as being released. 😕.

@sigmavirus24
Copy link
Member

Kind of amazing this got as far as being released.

@samuelcolvin if you want better quality, why not pay for it? No one is paid to work on this tool and it's entirely made during people's free time.

@samuelcolvin
Copy link

samuelcolvin commented Jan 30, 2017

These things happen I know. Not complaining, just commenting. Thanks a lot for pycodestyle @sigmavirus24.

@sigmavirus24
Copy link
Member

Not complaining, just commenting.

Those kinds of comments are demoralizing and not welcome on this project.

sigmavirus24 added a commit to sigmavirus24/pep8 that referenced this issue Jan 30, 2017
This was another case of a sloppy regular expression that wasn't made to
catch only *keywords* in the language.

Closes PyCQAgh-619
sigmavirus24 added a commit to sigmavirus24/pep8 that referenced this issue Jan 30, 2017
The bug was already fixed since it also affected E302 but this adds a
test to ensure it doesn't regress for nested definitions either.

Closes PyCQAgh-619
@sigmavirus24
Copy link
Member

This has already been fixed on master. I've added extra tests in #620. master will be released later today.

@mlococo
Copy link
Author

mlococo commented Jan 30, 2017

For my part, I'm neither surprised nor bothered that bugs happen. I reported because I know enough about this project to get that far in triage, but wasn't able to quickly get as far as a patch with test. Thanks for your work maintaining this project, I know it's a huge commitment compared to the kind of drive-by bug reports I'm doing here.

@sigmavirus24
Copy link
Member

No worries @mlococo. Cheers! 🎉

@sigmavirus24
Copy link
Member

And 2.3.1 was released with this bug fix.

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

Successfully merging a pull request may close this issue.

4 participants