Skip to content

ALL-DUPL1001 · semantic_duplication

Judge whether similar code duplicates shared knowledge.

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

Compare the exact source snippets and locations from one structurally normalized clone group. Classify it as shared knowledge only when both snippets encode the same domain fact and should change together. Similar mechanics with different domain meaning are similar_shape. Repeated protocol or adapter code whose separation preserves an ownership boundary is intentional_boundary. Missing ownership or meaning evidence is uncertain. minimum_tokens limits this semantic pass to clones large enough to carry domain meaning.

Findings cite every compared region and the ownership or history facts used.

Independent contracts and explicit adapters may retain similar code.

Two validators implementing the same tax rule are shared_knowledge, because a change to the rule has to reach both. Similar request parsing at two independent protocol boundaries is an intentional_boundary. Two loops that normalize different domains through the same shape are similar_shape.

  • Cites “The Pragmatic Programmer”, DRY principle
  • Cites “A Philosophy of Software Design”, chapter 6
  • Cites “Refactoring Guru”, duplicate code smell