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

Spyder gives wrong information about PEP8 with annotations #4314

Closed
Martmists-GH opened this issue Mar 31, 2017 · 7 comments
Closed

Spyder gives wrong information about PEP8 with annotations #4314

Martmists-GH opened this issue Mar 31, 2017 · 7 comments

Comments

@Martmists-GH
Copy link

Description of your problem

Spyder recommends no whitespace around kwargs when there are type annotations, but according to PEP 8 there should be:

When combining an argument annotation with a default value, use spaces around the = sign (but only for those arguments that have both an annotation and a default).

Yes:

def munge(sep: AnyStr = None): ...
def munge(input: AnyStr, sep: AnyStr = None, limit=1000): ...

No:

def munge(input: AnyStr=None): ...
def munge(input: AnyStr, limit = 1000): ...

What steps will reproduce the problem?

def func(arg, kwarg: str=None):  # Good according to spyder
    return "This is bad according to PEP 8"

def func(arg, kwarg: str = None):  # Shows an exclamation mark
    return "This is good according to PEP 8"

Versions and main components

  • Spyder Version: 3.1.3
  • Python Version: 3.6.0
  • Qt Version: Unknown
  • PyQt Version: 5.8.1
  • Operating system: Windows 10 Home build 14393.rs1_release_inmarket.170303-1614
@ccordoba12
Copy link
Member

ccordoba12 commented Mar 31, 2017

This is not under Spyder control, i.e. Spyder only parses and reports warnings generated by the pep8, and once 3.2 is released, pycodestyle packages.

So I think you should report this issue in the pycodestyle repository.

@Martmists-GH
Copy link
Author

After checking the file with pycodestyle file.py, it seems nor pycodestyle, nor flake8 nor pylint cause that error in that file, despite that error still being there in Spyder.

@rlaverde
Copy link
Member

If you put the mouse over the exclamation marker what is the message?

Maybe It was generated for pyflakes (the example that you mention will cause a warning for the redefiinition of func)

@Martmists-GH
Copy link
Author

E251 Unexpected spaces around keyword / parameter equals

@Martmists-GH
Copy link
Author

Just did a quick check, the error is thrown by the pep8 module. I'm assuming this issue is deprecated then and I'll just have to wait for pep8 to be replaced by pycodestyle as soon as possible.

@rlaverde
Copy link
Member

rlaverde commented Jun 13, 2017

Ohh I see, so this error is related to #3197, that has already been fixed, and will be part of Spyder 3.2

@Martmists-GH
Copy link
Author

The 3.2 milestone was planned for the day after tomorrow? I somehow feel like they're not going to reach it ;) Until then I'll just ignore this error and use pycodestyle manually I guess

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

3 participants