dreadatour / Flake8Lint

Sublime Text plugin for lint Python files
233 stars 58 forks source link

Multiline if statement marked as invalid if seconds row is aligned to text and not to bracket #78

Closed hakib closed 8 years ago

hakib commented 9 years ago

according to the indention section of PEP 8 this block is valid

if (this_is_one_thing and
    that_is_another_thing):
    do_something()

However , using the linter in sublime sublime

Is this valid ?

Thanks, Haki.

dreadatour commented 8 years ago

Sorry for a long answer.

This code is not valid according to PEP8. This code is valid:

if (this_is_one_thing and
        that_is_another_thing):
    do_something()
hakib commented 8 years ago

I'm pretty sure the example in the pep is similar to mine:

# No extra indentation.
if (this_is_one_thing and
    that_is_another_thing):
    do_something()

If you disagree you can close.

dreadatour commented 8 years ago

It seems you are right and this is valid and PEP8 does allow this, at least they say this is "acceptable option". I've found these discussions about this error:

You can simply add this error into global ignore list:

"ignore": ["E129"]

pep8 tool which is used for lint by default does not ignore this E129 error, there is a note about default ignore rules: https://github.com/dreadatour/Flake8Lint#note.

My Python Flake8 Lint plugin for ST by default ignore only one error: "D203", because of conflict with "D211". All other settings you could define as you wish :-)

Thank you for your answer, I've learned something new. Have a nice day!

hakib commented 8 years ago

OK, thanks man.