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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flake8-flask-0.10.0b3.tar.gz
.
File metadata
- Download URL: flake8-flask-0.10.0b3.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.5 Darwin/19.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9861970784525ebb20c6695c02ded36ad6a8d3490614c00a8a6c84a2a2e6dfbe |
|
MD5 | f3428ab62fa1ec31ceda6fc551b8010c |
|
BLAKE2b-256 | ba7b204e5ad877a92a2624de45aed4a56684b1cfe61f2fcb25ccedd867f713ed |
File details
Details for the file flake8_flask-0.10.0b3-py3-none-any.whl
.
File metadata
- Download URL: flake8_flask-0.10.0b3-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.5 Darwin/19.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 132239b7e75b26c5105502c07129677e21a4246b43f742553d3e37931bfca588 |
|
MD5 | 7aacf4c3fe1d0900a78d24d903e75e88 |
|
BLAKE2b-256 | 96c585c66e27e27592a0ef596c9ffba78498ce8093b9f465d31c3514a8ff96f0 |