Skip to content

unused-ignore-code

Added in 1.0.0 · Related issues · View source

Fix is always available.

What it does

Checks for ignore[...] / file-ignore[...] suppression that are no longer applicable.

Why is this bad?

A suppression that no longer matches any diagnostic violations is likely included by mistake, and should be removed to avoid confusion.

Example

{# djangofmt: ignore[invalid-attr-value, empty-attr-value] #}
<form method="yes">Submit</form>

Use instead:

{# djangofmt: ignore[invalid-attr-value] #}
<form method="yes">Submit</form>

Fix safety

The fix is marked as unsafe when it deletes a comment along with the free-text reason after its code list, as in ignore[...]: reason. Dropping a code from a list, or a comment carrying no reason, is safe.