DET007warningPro

unsorted-directory-listing

Directory listings have no guaranteed order across systems

Applies to: Go, Python, Ruby, Rust

Why this matters

os.listdir() and Path.iterdir() return files in arbitrary order that varies between operating systems and filesystems. If you process files in a loop, the order might be different on different machines, causing inconsistent results.

Catch it before it ships

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

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