and*_*otn 5 python pep8 pylint pyflakes flake8
这段代码:
def foo():
print("hello")
Run Code Online (Sandbox Code Playgroud)
违反PEP 0008,其中规定
每个缩进级别使用 4 个空格。
但是,无论是pep8
,pyflakes
或flake8
命令,警告一下吧。
我怎样才能让他们中的一个人抱怨这个 unpythonic 代码?
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 错误代码)。