0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

flake8でコードをチェック

Last updated at Posted at 2019-12-17

未来電子テクノロジーでインターンをしている箕牧和廣です。
今回はflake8について書いていこうと思います。

プログラミング初心者であるため、内容に誤りがあるかもしれません。
もし、誤りがあれば修正するのでどんどん指摘してください。

flake8とは

flake8とはPythonの文法チェックツール。

flake8の導入

実際に使ってみる。まずはインストール。

terminal
$ pip install flake8

以下のようにファイル名を指定してflake8を実行すると、コードチェックの結果が表示される。コマンド引数はファイル名ではなく、ディレクトリ名でも可。

terminal
$ flake8 test.py
test.py:1:1: F401 'sys' imported but unused
test.py:3:4: E222 multiple spaces after operator
test.py:4:7: E231 missing whitespace after ','
test.py:4:12: E202 whitespace before ']'
test.py:6:1: W293 blank line contains whitespace
test.py:6:1: W391 blank line at end of file

このように間違いを検出できる。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?