Skip to main content

flake8-django

pypi CICodecov Downloads

A flake8 plugin to detect bad practices on Django projects.

Installation

Install from pip with:

$ pip install flake8-django

Testing

flake8-django uses pytest for tests. To run them use:

$ pytest

Run coverage report using:

$ pytest --cov=.

List of Rules

Rule Description
DJ01 Avoid using null=True on string-based fields such as CharField and TextField
DJ03 Avoid passing locals() as context to a render function
DJ06 Do not use exclude with ModelForm, use fields instead
DJ07 Do not use __all__ with ModelForm, use fields instead
DJ08 Model does not define __str__ method
DJ12 Order of Model's inner classes, methods, and fields does not follow the Django Style Guide

More details about each of the Rules can be found on the wiki page.

Optional Rules - Disabled by Default

Rule Description
DJ10 Model should define verbose_name on its Meta inner class
DJ11 Model should define verbose_name_plural on its Meta inner class

To enable optional rules you can use the --select parameter. It's default values are: E,F,W,C90.

For example, if you wanted to enable DJ10, you could call flake8 in the following way:

flake8 --select=E,F,W,C90,DJ,DJ10

You could also add it to your configuration file:

[flake8]
max-line-length = 120
...
select = C,E,F,W,DJ,DJ10

Licence

GPL

Thanks

@stummjr for teaching me AST, and what I could do with it. His blog is cool.

Metadata

Release files for flake8-django 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-django 1.1.3
File Size Uploaded Provenance Actions
flake8-django-1.1.3.tar.gz 8.1 kB Without provenance Details for flake8-django-1.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flake8-django 1.1.3
File Interpreter ABI Platform Actions
flake8_django-1.1.3-py3-none-any.whl Python 3 none any Details for flake8_django-1.1.3-py3-none-any.whl

Total release size: 18.7 kB

Release files / flake8-django-1.1.3.tar.gz

Download URL flake8-django-1.1.3.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
36e06d38e2ef773a5865abfd8a051b43aa0b42abd180ea9b29a47449d69c82e5
BLAKE2b-256 checksum
How to use checksums
752b80c00c39058b49bacb2c805987178b3599347cdd443c3a0a854fd051621f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.11 tqdm/4.64.0 importlib-metadata/3.7.2 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.5

Release files / flake8_django-1.1.3-py3-none-any.whl

Download URL flake8_django-1.1.3-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b39cf9adb55c7412ff66463e9e9f58dc5f38a5380265cc6a3d2a5372aa493e31
BLAKE2b-256 checksum
How to use checksums
32ddd6c0debc46fe0edab3f2012ddd9e673d96677b447742d35c45a318dfe014
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.11 tqdm/4.64.0 importlib-metadata/3.7.2 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.5

Security for flake8-django 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page