【python】flake8でコードをチェックする
使うコード
code:app.py
import os
print('helloworld')
実行
code:flake8実行①
$ flake8
./app.py:1:1: F401 'os' imported but unused
./app.py:3:20: W292 no newline at end of file
なおしたもの
code:app.py
print('helloworld')
実行
code:flake8実行②
$ flake8
$
詳細も見れる
code:flake8詳細
$ flake8 -v
flake8.plugins.manager MainProcess 31 INFO Loading entry-points for "flake8.extension".
... 略 ...
flake8.main.application MainProcess 105 INFO Found a total of 0 violations and reported 0
$
そもそも何故no newline at end of fileでひっかかるの?
空ではないファイルは改行で終わらせるべき、というルール?があるらしい
参考