Skip to content

jschaf/pylint-flask

Repository files navigation

pylint-flask

Build Status Coverage Status PyPI License

About

pylint-flask is Pylint plugin for improving code analysis when editing code using Flask. Inspired by pylint-django.

Problems pylint-flask solves:

  1. 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 the flask.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.

  1. git clone https://github.com/jschaf/pylint-flask.git
  2. cd pylint-flask
  3. mkvirtualenv pylint-flask
  4. pip install -r dev-requirements.txt
  5. git checkout -b MY-NEW-FIX
  6. Hack away
  7. Make sure everything is green by running tox
  8. git push origin MY-NEW-FIX
  9. Create a pull request

License

pylint-flask is available under the GPLv2 license.

About

A Pylint plugin to analyze Flask applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published