flake8
$ pip install flake8
設定ファイル
.flake8、setup.cfg
code:ini
exclude =
.git,
build,
dist,
docs/source/conf.py,
old,
__pycache__
ignore = E203
max-complexity = 10
max-line-length = 100
code:json
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--ignore=E203, W503, W504",
"--max-line-length=100",
"--max-complexity=10"
]
"python.linting.lintOnSave": true,
"python.linting.flake8Path": "/usr/local/bin/flake8",
}
blackとの連携を考えてignoreやmax-line-lengthを設定する $ flake8 target_path
エラーの種別
E: Errors by pycodestyle
E1**: インデント
E2**: 空白
E3**: 空行
E4**: import
E5**: 行の長さ
E7**: statement エラー
E9**: Runtime エラー
W: Warnings by pycodestyle
W1**: インデント
W2**: 空白
W3**: 空行
W5**: 改行
W6**: deprecated
F: by pyflakes
F4**: import
F8**: define
C: checking Complexity by mccabe
C9**: 関数?
refs