DamnWidget / anaconda

Anaconda turns your Sublime Text 3 in a full featured Python development IDE including autocompletion, code linting, IDE features, autopep8 formating, McCabe complexity checker Vagrant and Docker support for Sublime Text 3 using Jedi, PyFlakes, pep8, MyPy, PyLint, pep257 and McCabe that will never freeze your Sublime Text 3
http://damnwidget.github.io/anaconda/
GNU General Public License v3.0
2.21k stars 260 forks source link

PEP 8 (E226) started showing now? #471

Closed Gabriel-p closed 8 years ago

Gabriel-p commented 8 years ago

A line like the following:

[0.]*len(all)

started, I believe two days ago, to be highlighted as a a violation of PEP8 E226 (no space around operator). I'm 100% sure this wasn't the case before.

Did something change in Anaconda or did I inadvertently change something either in this or some other package?

To be clear, I never added E226 to Anaconda's pep8_ignore" setting.

DamnWidget commented 8 years ago

Hi @Gabriel-p yeah we changed some specific pep8 behavior in the last update.

Just to put you in context, the pep8 tool defines some errors as ignored by default, if you pass something in the --ignore flag, it then overrides the default ignored list in pep8 and it gives you messages about those errors (as you are not ignoring them).

That is a weird behavior if you ask me, but if you have been using pep8 you expect that behavior to be part of anaconda (in fact you didn't had any way before to make pep8 to inform you about some ignored by default errors in anaconda, no way at all).

You can follow the discussion about that change here You can read a bit more about which errors are ignored by default in pep8 here

The solution is easy, just add those errors to your ignore list.

Gabriel-p commented 8 years ago

Thanks for the explanation @DamnWidget.

One thing bothers me though. For example this line:

hypot2 = x*x + y*y

will be highlighted as a E226 violation, but in Guido's style guide that's actually the recommended use.

Who decides that this should be marked as a E226 violation? Can I change it? I definitely like Guido's style guide better.

DamnWidget commented 8 years ago

The last word to accept a Python Enhancement Proposals is as far as I know, Guido Van Rossum one but if E226 is accepted part of PEP8 and that syntax is detected as a violation, I guess it's a violation doesn't matter if is suggested by Guido or not.

Is up to you to ignore that PEP8 violation or not I guess :)

Gabriel-p commented 8 years ago

I'd like to avoid having to ignore E226, but I also don't like the current interpretation.

Where does Anaconda get its PEP8 guidelines from? I'd like to go over there and propose Guido's interpretation of E226 which I prefer. Would you be so kind to point me to the right repo?

DamnWidget commented 8 years ago

Anaconda uses the pep8 package from the Python Code Quality Authority but the pep8 tool itself is made following the PEP8 document itself

Gabriel-p commented 8 years ago

Thank you! Will got to complain over there :)

David-OConnor commented 8 years ago

I submitted this on pycodestyle years go and it's still there! https://github.com/PyCQA/pycodestyle/issues/248#issuecomment-213658514

Gabriel - I recommend opening a new issue there.

Gabriel-p commented 8 years ago

@David-OConnor I'll wait a day or two to see if there's an answer, if not I'll open a new one.

dev169 commented 7 years ago

I had to do a double take reading this issue, so to restate the problem:

If you decide to manually ignore checks by adding them to pep8_ignore in Anaconda user settings, these and only these settings will be ignored by pycodestyle.

Everything that used to be ignored by the default pycodestyle configuration will be un-ignored, since we are passing a custom configuration now, and you'll have to manually add them to your pep8_ignore list if you want the default pycodestyle behaviour.

These checks are E121, E123, E126, E133, E226, E241, E242, E704 and W503 (can be found here).

Therefore your /User/Anaconda.sublime-settings should look like this:

{ 
    "pep8_ignore": [
        <YOUR_STUFF_HERE>,

        "E121",
        "E123",
        "E126",
        "E133",
        "E226",
        "E241",
        "E242",
        "E704",
        "W503",
    ] 
}

Phew!

DamnWidget commented 7 years ago

That sounds about right yeah