JulianEberius / SublimePythonIDE

ST3 only: A rewrite of SublimeRope for ST3, uses the Rope library to add python completions and refactoring to ST3
GNU General Public License v2.0
267 stars 38 forks source link

False reporting of E126 when tabs are used as indentation. #56

Closed vruyr closed 9 years ago

vruyr commented 10 years ago

Hi,

I use tabs in my projects to indent and pep8 linting in SublimePythonIDE reports E126 (over-indented for hanging indent) failing to recognize the tab. To check if that is the case I converted one of the files from tabs to spaces with same indentations and the error message was gone.

The problem seems to be in /lib/pep8.py:expand_indent(line) – it assumes that tab equivalent of 8 spaces and hence thinks that I over-indented the code.

A couple of very dirty and hacky solutions that I can think of is – adding a configuration setting for that assumed 8 or maybe getting the tab size from sublime.

Thanks!

JulianEberius commented 10 years ago

Hi,

This seems to be a pep8 issue, not an SublimePythonIDE issue. I do not want to hack on pep8.py itself. Personally, I would recommend to use spaces for indentation, as this is exactly what pep8 recommends to do (http://legacy.python.org/dev/peps/pep-0008/). In my opinion, it does not make much sense to use pep8.py for linting if you do not adhere to pep8.

Julian

vruyr commented 10 years ago

I only partially follow pep8, you see I'm on the "tabs" side of "spaces vs tabs" holy war. I think that spaces are there for indentation just because of people using bad code editors. Anyway, following pep8 partially is still useful for me and I disable checks that I don't agree with.

Thanks anyway.