DET001warningProauto-fixable

unsorted-dict-iteration

Dictionary iteration without a canonical sort order

Applies to: Go, Python, Ruby

Why this matters

In Go, map iteration order is deliberately randomized every run. In Python (3.7+) and Ruby (1.9+), dict/hash iteration follows insertion order — deterministic within a run, but it changes whenever insertion order changes, so hashed/serialized/diffed output built from the loop isn't canonical across code changes. Sorting gives a canonical order in every language.

Catch it before it ships

pip install stablestack # or: npx stablestackstablestack # scans your project, DET001 includedstablestack explain DET001

DET001 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.

False positive in your codebase? Suppress a single line with # noqa: DET001