pep8, flake8

延伸閱讀 About style guide of python and linter tool. pep8, pyflakes, flake8, haking, Pyling.


flake8 能比 pep8 顯示更多檢測結果

以 source.py 為例

import sys

def add(x, y):
    return x+y

pep8 顯示

source.py:3:1: E302 expected 2 blank lines, found 1

flake8 顯示

source.py:1:1: F401 'sys' imported but unused
source.py:3:1: E302 expected 2 blank lines, found 1

Install

pip install pep8

Run

pep8 source.py

Install

pip install flake8

Run

flake8 source.py

results matching ""

    No results matching ""