Skip to main content

Plugin to catch bad style specific to Django Projects

Project description

flake8-django

CircleCI Codecov Downloads

A flake8 plugin for 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 warnings

Warning Description
DJ01 Using null=True is not recommended for some of the Django ORM fields. E.g. CharField, EmailField, ImageField, FileField, UUIDField, SlugField, TextField
DJ02 Using blank=True is not recommended on BooleanField
DJ03 Using locals() in render function is not recommended, use explicit arguments
DJ04 Using dashes in url names is discouraged, use underscores instead
DJ05 URLs include() should set a namespace
DJ06 ModelForm should not set exclude, instead it should use fields, which is an explicit list of all the fields that should be included in the form
DJ07 ModelForm.Meta should not set fields to __all__
DJ08 Models that inherits from django db models should set __str__

Licence

GPL

Thanks

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

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-django-0.0.4.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distributions

flake8_django-0.0.4-py3.7.egg (21.5 kB view hashes)

Uploaded Source

flake8_django-0.0.4-py3.5.egg (24.6 kB view hashes)

Uploaded Source

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