LoginSignup
1
2

More than 5 years have passed since last update.

Windows環境でflake8のチェック内容を調整する(Windows7, Python3)

Posted at

はじめに

Python3の構文チェックでflake8を使うことにしたけど、
一行あたりの文字数のチェックが、デフォルトだと短い。(79文字)

ので、チェック内容の変更方法を記録しときます。

設定ファイルを作成/更新する

OSのユーザーごとに設定ファイル作りたい。
何も意識しないでPythonインストールしただけだと、設定ファイルは作られないっぽいので、ユーザーディレクトリの直下に'.flake8'ファイルを作成する。

今回は最大文字数チェックの文字数を増やしたかったので、以下のようにした。(100文字までOKに)

~\.flake8
[flake8]
max-line-length = 100

結果確認

最大文字数のチェックを変えられた。

>flake8 .\hoge.py
hoge.py:69:101: E501 line too long (114 > 100 characters)

参考

[Configuring Flake8]http://flake8.pycqa.org/en/latest/user/configuration.html)

その他のチェック内容とかも、いろいろ書いててくれてるかも(未確認)

1
2
4

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
1
2