Skip to content

ALL-DUPL0005 · evidence

This page continues ALL-DUPL0005 directly from its source docstring. Read its implementation.

Each finding quotes the literal and how many times the module writes it. The value is the number of literals in that module that reached both thresholds.

A string shorter than minimum_length stays local, because a short token is usually clearer where it is written than behind a name that would have to be invented for it. A docstring is never counted, since a statement that is nothing but a string documents the code rather than stating a value the program uses. Repetition spread across several modules is a different decision with a different owner and belongs to ALL-DUPL0002, which judges cross-file groups by their resolved syntax role. A project whose domain repeats a short token with stable meaning lowers minimum_length, and one that tolerates more copies raises minimum_occurrences. Test modules restate fixture text on purpose and are excluded by pointing this rule’s source globs away from them rather than by guessing from a path.

  • Cites “Refactoring”, Replace Magic Literal. Open reference
  • Cites “The Pragmatic Programmer”, the DRY principle
  • Cites “PEP 8, Style Guide for Python Code”, constants. Open reference