DET002warningPro

unsorted-set-iteration

Set iteration without sorting can produce unpredictable order

Applies to: Python

Why this matters

Sets have no guaranteed order. Looping through a set can give you elements in a different order each time, causing flaky tests and broken caches.

Catch it before it ships

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

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