Skip to content

fix(linter): deduplicate issues and make their order total - #86

Merged
nozaq merged 1 commit into
mainfrom
claude/decolint-dedupe-sort-nnulpj
Aug 1, 2026
Merged

fix(linter): deduplicate issues and make their order total#86
nozaq merged 1 commit into
mainfrom
claude/decolint-dedupe-sort-nnulpj

Conversation

@nozaq

@nozaq nozaq commented Aug 1, 2026

Copy link
Copy Markdown
Member

Summary

Enhanced the linter's issue reporting to provide deterministic, deduplicated output by sorting findings by message as a tertiary sort key and deduplicating identical issues.

Key Changes

  • Deduplication: Issues that match in all fields (path, line, column, rule ID, message, and severity) are now reported only once, preventing duplicate reports when multiple rules or paths reach the same problem
  • Tertiary sorting: Added message as a tertiary sort key after line, column, and rule ID to ensure a total ordering of issues and deterministic output
  • Documentation: Updated LintDocument docstring to clarify the sorting behavior and deduplication guarantee

Implementation Details

  • Deduplication uses a map keyed by Issue to track seen findings before appending to results
  • The sort order is now: Line → Column → Rule ID → Message, ensuring consistent output across runs
  • This ordering is now a total order since position, rule ID, and message together form a unique key after deduplication
  • Added comprehensive test coverage including:
    • TestLintDocument_SortsByMessageAtSamePosition: Verifies message-based sorting when position and rule ID match
    • TestLintDocument_Deduplicates: Tests deduplication across various scenarios (identical findings, differing columns/lines/messages/rule IDs)

https://claude.ai/code/session_014XrANytHY1H4cV7Wm8bBdv

A rule that reaches the same problem by more than one route reported it
twice, and findings sharing a position and a rule ID came back in an
unspecified order because the sort had no tiebreaker beyond the rule ID.

LintDocument now drops issues matching in every field, and orders equal
positions by rule ID then message. After deduplication that key is
unique, so the order is total and a document always lints to the same
sequence.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014XrANytHY1H4cV7Wm8bBdv
@nozaq nozaq changed the title Sort linter findings by message and deduplicate issues fix(linter): deduplicate issues and make their order total Aug 1, 2026
@nozaq
nozaq merged commit 8ae6637 into main Aug 1, 2026
9 checks passed
@nozaq
nozaq deleted the claude/decolint-dedupe-sort-nnulpj branch August 1, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants