Skip to content

LtUnlint silently drops defects at line 0 when a line-specific +unlint meta is present #950

@morphqdd

Description

@morphqdd

What happens: In LtUnlint.defects() (line 83), the loop that re-adds non-suppressed defects to the result uses the guard line != 0 && defect.line() == line. When a lint produces a defect at line 0 (which happens whenever an XMIR element has no @line attribute — e.g. mandatory-package reports at line 0 when the whole +package meta is absent), and the EO program also contains a line-specific +unlint meta for the same lint (e.g. +unlint mandatory-package:5), the following occurs: (1) global is set to true because a +unlint meta exists; (2) line 5 is removed from problematic but line 0 stays; (3) the loop skips line 0 due to line != 0; (4) added remains false; (5) the fallback if (!added.get() && !global) defects.addAll(found) is also skipped because global is true. The defect at line 0 is silently discarded even though it was never targeted by the +unlint meta. The lineno.xsl helper and empty-object.xsl both explicitly handle line 0 (the XSL even adds a context attribute when $line = '0'), confirming that line-0 defects are an intentional, production-occurring case.

What should happen: A defect at line 0 that is not covered by a global +unlint lint-name suppression should always be reported, regardless of whether other line-specific +unlint metas exist for the same lint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions