Django Lint is a static analysis tool that checks (or lints) web applications that are built around the Django web development framework. It aims to encourage the development of high-quality reusable Django applications.
It currently reports on:
- Nullable CharField or TextField model fields
- Missing recommended configuration variables in settings.py
- Mismatch of null=True and blank=False for model fields
- Use of BooleanField with default=True or use of NullBooleanField
- Where myapp.models is actually a directory-based package instead of a single models.py
- Excessive number of models in a single application
- Models within an application having a common prefix
- Use of unique_for_date, unique_for_month or unique_for_year modifiers
- Naive tree structure implementations using ForeignKey('self')
- Missing __unicode__ methods or use of __str__
- Incorrect ordering of standard model methods relative to Django style guidelines
- Misordered middleware in settings.py
- Models with too many fields (or zero) fields
- Extremely large CharField fields
- Use of the PositiveSmallIntegerField or SmallIntegerField fields
- Use of auto_now or auto_now_add modifiers on date fields
- Instances of URLField without an explicit verify_exists value
- (and more)
Admittedly, some of the checks are based on the implementation details of MySQL, PostgreSQL and SQLite backends, but this fits with the goal of promoting re-usable applications anyway.
GPLv3 source, tarballs, etc. Patches welcome.
You can subscribe to new posts via email or RSS.