pylint-flask
About
pylint-flask
is Pylint plugin for improving code analysis when editing code using Flask. Inspired by pylint-django.
Problems pylint-flask solves:
-
Recognize
flask.ext.*
style imports. Say you have the following code:from flask.ext import wtf from flask.ext.wtf import validators class PostForm(wtf.Form): content = wtf.TextAreaField('Content', validators=[validators.Required()])
Normally, pylint will throw errors like:
E: 1,0: No name 'wtf' in module 'flask.ext' E: 2,0: No name 'wtf' in module 'flask.ext' F: 2,0: Unable to import 'flask.ext.wtf'
As pylint builds it's own abstract syntax tree,
pylint-flask
will translate theflask.ext
imports into the actual module name, so pylint can continue checking your code.
Usage
Ensure pylint-flask
is installed and on your path, and then run pylint using pylint-flask as a plugin.
pip install pylint-flask
pylint --load-plugins pylint_flask [..your module..]
Contributing
Pull requests are always welcome. Here's an outline of the steps you need to prepare your code.
- git clone https://github.com/jschaf/pylint-flask.git
- cd pylint-flask
- mkvirtualenv pylint-flask
- pip install -r dev-requirements.txt
- git checkout -b MY-NEW-FIX
- Hack away
- Make sure everything is green by running
tox
- git push origin MY-NEW-FIX
- Create a pull request
License
pylint-flask is available under the GPLv2 license.