Add a multi-language duplicate finder that writes .metrics/dry.edn.

This commit is contained in:
Robert C. Martin
2026-09-30 14:37:25 -05:00
commit fcf865759d
19 changed files with 2217 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
from dataclasses import dataclass
@dataclass(frozen=True)
class Span:
"""Where one candidate form sits in a source file."""
file: str
start_line: int
end_line: int
@dataclass(frozen=True)
class Duplicate:
"""One pair of forms whose normalized structure is similar enough to report."""
score: float
language: str
left: Span
right: Span
left_nodes: int
right_nodes: int
@dataclass(frozen=True)
class Entry:
"""A normalized form ready to compare. Forms are only compared within one language."""
language: str
file: str
start_line: int
end_line: int
nodes: int
fingerprints: frozenset[str]