Skip to content

Lint rules

By default djangofmt runs every stable rule outside the pedantic category.

See Linting to select rules, apply fixes and suppress diagnostics.

Legend

    ๐Ÿงช     The rule is unstable and is in preview.
    โš ๏ธ     The rule has been deprecated and will be removed in a future release.
    โŒ     The rule has been removed; only the documentation is available.
    ๐Ÿ› ๏ธ     The rule is automatically fixable by the --fix command-line option.

Correctness

Code that is outright wrong or useless.

Name Message
invalid-attr-value Invalid value {} for attribute {}
untrimmed-blocktranslate Missing trimmed on {% blocktranslate %} ๐Ÿ› ๏ธ
duplicate-block-name Duplicate {% block %} name {}

Suspicious

Code that is most likely wrong or useless.

Name Message
django-static-url Hardcoded static path in {}
django-url-pattern Hardcoded internal URL in {} ๐Ÿงช
javascript-url Avoid javascript: URLs in {}
duplicate-attr Duplicate attribute {}
use-https Avoid http:// URLs in {} ๐Ÿ› ๏ธ
invalid-ignore-comment Invalid suppression comment: {error} ๐Ÿ› ๏ธ
invalid-ignore-code Invalid rule code in suppression: {} ๐Ÿ› ๏ธ
deprecated-ignore Deprecated HTML ignore comment ๐Ÿ› ๏ธ
unused-ignore-code Unused rule code in suppression: {} ๐Ÿ› ๏ธ

Style

Code that should be written in a more idiomatic way.

Name Message
empty-attr-value Empty {} attribute ๐Ÿ› ๏ธ
redundant-type-attr Redundant type="{}" on <{}> ๐Ÿ› ๏ธ
uppercase-form-method Form method {} should be lowercase ๐Ÿ› ๏ธ
form-action-whitespace Extra whitespace in form action ๐Ÿ› ๏ธ
missing-doctype Missing <!DOCTYPE html> declaration
same-file-partial-include Same-file partial {} rendered via {% include %} ๐Ÿ› ๏ธ

Accessibility

Code that creates accessibility (a11y) barriers.

Name Message
missing-html-lang Missing lang attribute on <html>
missing-title Missing or empty <title> in <head>
missing-img-alt Missing alt attribute on <img>

Pedantic

Rules that are rather strict, noisy, or have occasional false positives. Off by default.

Name Message
empty-tag-pair Empty <{}> tag pair
missing-img-dimensions Missing height or width attribute on <img>
table-header-missing-scope Missing or empty scope attribute on <th>
unsorted-tailwind-classes Unsorted Tailwind CSS classes ๐Ÿ› ๏ธ