Skip to content

ALL-DUPL0004 · duplicated_repository_share

Measure how much of the repository exists only as a copy of this block.

This is a deterministic rule for all languages. Read its implementation.

Divide the lines this group repeats by every line the kernel read, and state the result as a percentage. A group of three copies covering twelve lines repeats twenty-four of them, since one copy is the original and the other two are what a merge would remove. A group covering fewer than minimum_line_count lines measures zero, because a run that short is shape rather than a paste and counting it would inflate a number people act on.

Symilar reports the same quantity for a whole run, as duplicated lines over total lines. This rule reports it one group at a time, which is what makes it actionable. A repository is never told to reduce duplication in general, it is told that one particular block accounts for a share of it that nobody meant to write.

Continue with evidence and references, or open the examples.