Skip to main content

Static analysis checks for Flask, by r2c. Available in our free program analysis tool, Bento. (ht

Project description

flake8-flask

flake8-flask is a plugin for flake8 with checks specifically for the flask framework, written by r2c

Installation

pip install flake8-flask

Validate the install using --version.

> flake8 --version
3.7.9 (flake8-flask: 0.2.1, mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1)

List of warnings

r2c-flask-send-file-open: This check detects the use of a file-like object in flask.send_file without either mimetype or attachment_filename keyword arguments. send_file will throw a ValueError in this situation.

r2c-flask-secure-set-cookie: This check detects calls to response.set_cookie that do not have secure, httponly, and samesite set. This follows the guidance in the Flask documentation.

r2c-flask-unescaped-file-extension: Flask will not autoescape Jinja templates that do not have .html, .htm, .xml, or .xhtml as extensions. This check will alert you if you do not have one of these extensions. This check will also do its best to detect if context variables are escaped if a non-escaped extension is used.

r2c-flask-use-blueprint-for-modularity: This check recommends using Blueprint when there are too many route handlers in a single file. Blueprint encourages modularity and can greatly simplify how large applications work and provide a central means for Flask extensions to register operations on applications.

r2c-flask-use-jsonify: flask.jsonify() is a Flask helper method which handles the correct settings for returning JSON from Flask routes. This check catches uses of json.dumps() returned from Flask routes and encourages flask.jsonify() instead.

r2c-flask-missing-jwt-token: This check alerts when @jwt_required, @jwt_optional, @fresh_jwt_required, and @jwt_refresh_token_required decorators are missing in files where flask_jwt, flask_jwt_extended, or flask_jwt_simple packages are imported.

Have an idea for a check? Reach out to us at https://r2c.dev!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8-flask-0.10.0b1.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

flake8_flask-0.10.0b1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file flake8-flask-0.10.0b1.tar.gz.

File metadata

  • Download URL: flake8-flask-0.10.0b1.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.5 Darwin/19.2.0

File hashes

Hashes for flake8-flask-0.10.0b1.tar.gz
Algorithm Hash digest
SHA256 84b691a18a5bc240202c49170c53213ed98d0fb002fe8b7025be248acce966fe
MD5 765c3fb19a7848aa4ed37cd4414893ea
BLAKE2b-256 82def55d4824ae3ab4f7d49ca702724ffccb119b4582b4294e25b0ac7ea4d0ac

See more details on using hashes here.

File details

Details for the file flake8_flask-0.10.0b1-py3-none-any.whl.

File metadata

  • Download URL: flake8_flask-0.10.0b1-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.5 Darwin/19.2.0

File hashes

Hashes for flake8_flask-0.10.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 26c66a078f7f36f7145a3db53303b367fae8877452d979d4ee46487974d5dd57
MD5 bf1e3b3739de4c7d9ff4316ab1745e27
BLAKE2b-256 cdc093a5b9b1f8eb9344247effc58ddb82b987a8ce2b5435ac5a35ef75e87b10

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page