QUAL019warningPro

duplicate-code-blocks

Duplicated code (whole function or repeated block, in this file or another) — extract it into a shared helper.

Applies to: Project-level

Why this matters

When the same logic is copied — a whole component pasted between pages, or a ten-line validation block repeated in every handler — changes to one copy don't reach the others. The copies drift, bugs get fixed in one place and not the rest, and every future change costs N times as much. Renaming the variables doesn't make it a different function. Extract the shared logic into one helper and call it from each site.

Catch it before it ships

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

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

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