開発の品質をあげるために静的解析(flake8)及びコード整形(autopep8)、コメント生成機能(AutoDocstring)をVSCodeに導入しました
この記事はその備忘録です
目次
スポンサーリンク
この記事でわかること
VSCodeに静的解析(flake8)及びコード整形(autopep8)、コメント生成機能(AutoDocstring)を導入する方法
1.必要モジュールのインストール
pipコマンドで以下モジュールをインストール
pip3 install flake8 pip3 install autopep8
2.VSCodeの拡張機能でAutoDocstringを入れる
以下URLを参考に拡張機能を入れる
marketplace.visualstudio.com
3.VSCodeの設定
3.1設定画面を開く
表示->コマンドパレットにsettingと入力した後、「基本設定:ユーザ設定を開く」を押す
3.2jsonファイル編集する
画面右上の「設定(json)を開く」を押してsettingファイルを開いた後、
以下の内容を追加する
// linter, formatter, autodocumentation for python "files.autoSave": "afterDelay", "files.autoSaveDelay": 1000, "python.linting.lintOnSave": true, "python.linting.pylintEnabled": false, "python.linting.pep8Enabled": false, "python.linting.flake8Enabled": true, "python.linting.flake8Args": [ "--ignore=W293, W504", "--max-line-length=150", "--max-complexity=20" ], "python.formatting.provider": "autopep8", "python.formatting.autopep8Args": [ "--aggressive", "--aggressive", "--max-line-length=200" ], "autoDocstring.docstringFormat": "google", // auto triming white space "files.trimTrailingWhitespace": true,
感想
コードの品質向上のための第一歩をようやく踏み出せました・・・
いろいろ改善していきたいです(^^♪
参考
スポンサーリンク