pylint-flask

0.6 · maintenance · verified Thu Apr 16

pylint-flask is a Pylint plugin designed to improve static code analysis for Flask applications. It helps Pylint correctly interpret Flask-specific patterns, particularly addressing issues related to the `flask.ext` import style (which has since been deprecated in Flask itself) and other dynamic attributes in Flask extensions. The current version is 0.6, released in January 2019, indicating a maintenance phase with infrequent updates.

Common errors

Warnings

Install

Imports

Quickstart

Install `pylint-flask` and then run Pylint, explicitly loading the plugin with the `--load-plugins` flag. This example shows a minimal Flask app and how to lint it. For Flask extensions, ensure you are using direct imports (e.g., `from flask_wtf import ...`) as the `flask.ext` pattern is deprecated in modern Flask versions.

# my_flask_app.py
from flask import Flask
from flask_wtf import CSRFProtect # Example: direct import for Flask-WTF

app = Flask(__name__)
app.config['SECRET_KEY'] = 'a-very-secret-key'
csrf = CSRFProtect(app)

@app.route('/')
def index():
    return 'Hello, Flask!'

# To run pylint with the plugin:
# pylint --load-plugins pylint_flask my_flask_app.py

view raw JSON →