pythonpylintpep8pyflakesflake8

pep8 warn about 8-space indent


This bit of code:

def foo():
        print("hello")

violates PEPĀ 0008, which states

Use 4 spaces per indentation level.

But neither the pep8, pyflakes, or flake8 commands warn about it.

How can I get one of them to complain about this unpythonic code?


Solution

  • pylint would warn about this violation:

    $ pylint test.py
    No config file found, using default configuration
    ************* Module test
    W:  2, 0: Bad indentation. Found 8 spaces, expected 4 (bad-indentation)
    

    Note that pep8 would warn you only if indentation is not a multiple of four (E111 error code).