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 | ๐ ๏ธ |