pep8 警告有关 8 个空格的缩进

and*_*otn 5 python pep8 pylint pyflakes flake8

这段代码:

def foo():
        print("hello")
Run Code Online (Sandbox Code Playgroud)

违反PEP 0008,其中规定

每个缩进级别使用 4 个空格。

但是,无论是pep8pyflakesflake8命令,警告一下吧。

我怎样才能让他们中的一个人抱怨这个 unpythonic 代码?

ale*_*cxe 3

pylint会警告此违规行为:

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

请注意,仅当缩进不是四的倍数pep8时才会发出警告(E111 错误代码)。