I have a Flask (v0.10.1) application using Flask-SQLAlchemy (v2.0) and I\'m trying to configure Pylint to check it. Running with Python 3.4.2.
First error was:
--load-plugins pylint-flask
--load-plugins
needs the name of the python package to be imported. You can check this on command line (will get ImportError) if you do so. Pylinting in VS Code is nastier since you will not get any visible errors. Instead, you will have zero linting errors even if your code would have some linting problems.pylint-flask is a good plugin, but it is not even meant to tackle this problem! You can see the source code for yourself. There is no mentions about Flask-SQLAlchemy; it is only designed to fix issues (false positives) with Flask.
The pylint-flask-sqlalchemy was created to fix the pylint false positives with Flask-SQLAlchemy. After installing with
pip install pylint-flask-sqlalchemy
one should add it with1
# NOT: "pylint-flask-sqlalchemy"
"python.linting.pylintArgs": ["--load-plugins", "pylint_flask_sqlalchemy"]
1Applies directly only for VS Code. With other IDEs or command line, use the same arguments in the same order.
If used together, for some reason
"python.linting.pylintArgs": ["--load-plugins", "pylint_flask", "pylint_flask_sqlalchemy"]
will not work but
"python.linting.pylintArgs": ["--load-plugins", "pylint_flask_sqlalchemy", "pylint_flask"]
does. So, presumably, the pylint-flask must be loaded after pylint-flask-sqlalchemy.