Skip to content

ALL-DUPL0003 · evidence

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

One finding is stated per copy past the first, each located at that copy and naming the lines the original covers, so the number of findings and the value are the same number read two ways. Each carries how many lines and how many tokens the block runs to, and the repair is a choice, because two blocks that look alike are not always the same idea.

A run under either floor is not reported at all, because normalization deliberately throws away every name and every literal and short runs of shape are ordinary rather than copied. A group whose copies all sit inside a longer group is never built, so a long paste is one finding rather than one for each of the shorter readings inside it. Whether the copies should be merged is a judgment about shared knowledge that this rule does not make, and ALL-DUPL1001 reads the very same fact to make it.

  • Generalizes Pylint R0801 duplicate-code
  • Cites “The Pragmatic Programmer”, the DRY principle
  • Cites “Refactoring”, Extract Function. Open reference