Skip to content

Instantly share code, notes, and snippets.

@s18014
Last active July 19, 2018 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s18014/1f4294da9556c8eefe9af2fb3fd5d5da to your computer and use it in GitHub Desktop.
Save s18014/1f4294da9556c8eefe9af2fb3fd5d5da to your computer and use it in GitHub Desktop.
flake8_syntasicの不必要なエラーを無効化する設定

flake8の不必要なエラーを無効化する設定

設定

~/.vimrcに以下のように設定しています。

let g:syntastic_python_flake8_args = '--ignore="E501,F405,F403,E731,E401,F401,E226"'
" - ignored codes are as follows
" E501: line too long
" F405: name may be undefined, or defined from star imports: module
" F403: ‘from module import *’ used; unable to detect undefined names
" E731: do not assign a lambda expression, use a def
" E401: multiple imports on one line
" F401: module imported but unused
" E226: missing whitespace around arithmetic operator
  • let g:syntastic_python_flake8_args = '--ignore=""'に無効化したいエラー、警告メッセージを記述していきます。
  • 後で戻せるようにignored codes are as follows以下に無効化したコードの説明を記述しています。

無効化したエラーコードの説明

" E501: コードが長すぎる
" F405: そんなモジュールないかもよ?(tkinter使う時にうざかったから消した)
" F403: from module import * を使うなてことかな?
" E731: lambdaを変数に入れるな
" E401: import を一行に複数同時にするな(多分そのうち戻すかも)
" F401: import したモジュール使って無いけど?
" E226: 算術演算子の周辺に空白がない((y**2 + x**3) みたいな書き方ができなかったから無効化)
  • E226(a +b)みたいな書き方をしたらE225が叱ってくれるので問題ないと思う
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment