Add option to use tabs instead of spaces #131

Closed
glarrain opened this Issue Oct 17, 2012 · 7 comments

7 participants

@glarrain

While it is not endorsed by PEP8, it does acknowledge many users prefer tab indentation over spaces indentation.

Using this tool, one can disable "W191 indentation contains tabs", but other errors will be raised inappropriately, such as:

  • E122 continuation line missing indentation or outdented
  • E127 continuation line over-indented for visual indent
  • E128 continuation line under-indented for visual indent

The case of "E101 indentation contains mixed spaces and tabs" seems more complex because it is alright for continuations lines but not for regular statements.

What do you think?

@florentx

I agree the other errors should not be raised.
This is not a priority use case, but I'll be ok to merge a patch with the relevant test cases.

@urbaniak

Agree, I'm also using tabs for indenting python code, and pep8 is complaining about it.

@myint
Python Code Quality Authority member

So E122 can be triggered by the following.

if True:
<tab>foo(
<tab><tab>1,
<tab><tab>2)
$ pep8 --select=E12 e122.py
e122.py:3:3: E122 continuation line missing indentation or outdented
e122.py:4:3: E122 continuation line missing indentation or outdented

But how are E127 and E128 triggered with tabs? The following is fine with respect to E12.

if True:
<tab>foo(1,
<tab>....2)
$ pep8 --select=E12 e12.py
@brot

+1 for this issue. Would be great to see a fix for this issue

@rnhmjoj

+1 I use tabs too and this is quite annoying.

@quasipedia

For the records, although I consider tabs a far better semantic solution to indentation than spaces, I think using tabs is just silly in the context of the python ecosystem: there is value in keeping coding standard consistent.

That said, I am obliged to work now with a codebase where somebody above me thinks differently, so I would appreciate if this were fixed.

My specific gripe is with E126 though (continuation line over-indented), that AFAIK should have been fixed in #155. This is the code that triggers the error:

def test_keys(self):
    '''areas.json - All regions are accounted for.'''
    expected = set([
        u'Norrbotten',  # <-------- This line will trigger a E126
        u'V\xe4sterbotten',
@florentx

This was mostly fixed with #155.

The only remaining issue is E126, which is now tracked with issue #204.

@florentx florentx closed this Mar 24, 2014
@florentx florentx added this to the 1.5.0 milestone Mar 25, 2014
@florentx florentx removed the needs patch label Mar 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment