DET008warningPro

hash-unsorted-collection

Hashing dicts/sets without sorting produces inconsistent cache keys

Applies to: Python

Why this matters

When you hash a dictionary or set to create a cache key, the hash depends on iteration order. Without sorting, you'll get different hashes for the same data, causing cache misses and wasted computation.

Catch it before it ships

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

DET008 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: DET008