Skip to content

Make diagnostic output order deterministic #199

Description

@notJoon

Problem

Rules are stored and iterated as a Go map, so rule execution order is nondeterministic:

  • internal/rule/registry.go:40-47
  • internal/engine.go:237-265
  • internal/engine.go:325-370

File work also completes concurrently. The resulting issue order can vary between identical runs, producing noisy diffs in text and JSON output and making tests harder to reproduce.

Proposed change

Sort the final issue list once at the public processing boundary by stable fields such as filename, start line, start column, rule name, and message. This is smaller than redesigning the registry solely to preserve order and also handles worker completion order.

Acceptance criteria

  • Repeated runs over the same inputs produce byte-for-byte stable text and JSON issue ordering.
  • Ordering is documented and covered by a test with multiple files and rules.
  • Rule execution remains sequential per file and file-level parallelism is preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-lowPriority: LowRefactorrefactoringT-engineType: related with engine (or internal)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions