LoginSignup
4
0

More than 5 years have passed since last update.

vscodeでflask_sqlalchemyの動的メンバへの参照箇所のpylintエラー(E1101)を抑制する

Last updated at Posted at 2018-12-23

抑制の方法

settings.jsonに以下を追加する。

"python.linting.pylintArgs": ["--load-plugins", "pylint_flask"]

どんな時の話?

vscodeでflask_sqlalchemyを使っている時の↓のような赤線がうざい場合の話です。
sqlalchemy_pylint_warn1.png

少しだけ説明

設定次第でpylintによりSQLAlchemyのメンバー参照でE1101が発生しますが、これはライブラリ内で動的に付加されるメンバーへの参照なので安全です。
しかし、だからと言って不用意にE1101全体を抑制するのはあまりよろしくないので、こんな設定が良さそうです。
※pylint_flaskの詳しい仕様までは追っていませんので、思わぬ副作用がある可能性もあります。
 (副作用とはつまり、本来のエラーまで抑制してしまう可能性)

4
0
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
4
0