Plugin to catch bad style specific to Django Projects.
A flake8 plugin to detect bad practices on Django projects.
Install from pip with:
$ pip install flake8-django
flake8-django uses pytest for tests. To run them use:
Run coverage report using:
$ pytest --cov=.
List of Rules
||Avoid using null=True on string-based fields such as CharField and TextField|
||Avoid passing locals() as context to a render function|
||Do not use exclude with ModelForm, use fields instead|
||Do not use
||Model does not define
||Order of Model's inner classes, methods, and fields does not follow the Django Style Guide|
||@receiver decorator must be on top of all the other decorators|
More details about each of the Rules can be found on the wiki page.
Optional Rules - Disabled by Default
||Model should define verbose_name on its Meta inner class|
||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:
You could also add it to your configuration file:
[flake8] max-line-length = 120 ... select = C,E,F,W,DJ,DJ10
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.