Drkcore

04 06 2016 Python Tweet

pep8はもう古いのでpycodestyleを使おう

Pythonのコーディング規約をチェックするツールにpep8があるのだけど、pycodestyleっていう名前に変わったので今後はこちらをつかえということらしい。

つらつらと眺めていたらプロジェクトの統計を取るオプションが面白そうだったのでこのブログのCMSで実行してみた。

$ pycodestyle --statistics -qq .
1       E128 continuation line under-indented for visual indent
1       E203 whitespace before ':'
5       E231 missing whitespace after ','
2       E265 block comment should start with '# '
5       E271 multiple spaces after keyword
1       E302 expected 2 blank lines, found 1
11      E402 module level import not at top of file
29      E501 line too long (115 > 79 characters)
14      E711 comparison to None should be 'if cond is None:'
1       W291 trailing whitespace

一行のコードの文字数多すぎるんだよっていうエラーが一番多いけど、SQLAlchemyのクエリって長くなりがちだから しょうがないじゃん。 \で改行すると読みにくくなるから嫌いなんだよなぁ。

Emacs+flymakeでコード書いているのでpep8をpycodestyleに変更するだけでOK

  • EmacsのPython開発環境を整えた
  • Emacsでコード補完にJediを使う (Python)

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021