anthropics/fermats-last-theorem
Duplication Places in code with 6 or more lines that are exactly the same. |
Duplication Overall
- 47% duplication:
- 5,889,107 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
- 2,826,080 duplicated lines
- 645,964 duplicates
Duplication per Extension
Duplication per Component (primary)
Duplication Between Components (50+ lines)
flowchart TB
n0["P2M"]
n1["Theorems"]
n2["Definitions"]
n3["html"]
n4["tools"]
n0 ---|"566749"| n1
n2 ---|"67976"| n0
n2 ---|"5580"| n1
n3 ---|"1340"| n4
classDef default fill:#00b2ee,stroke:#ffffff,color:#000000;
classDef highlighted fill:#00b2ee,stroke:#ffffff,color:#000000;
linkStyle 0 stroke:#DC143CFF,stroke-width:10px
linkStyle 1 stroke:#DC143C5E,stroke-width:1px
linkStyle 2 stroke:#DC143C4C,stroke-width:1px
linkStyle 3 stroke:#DC143C4C,stroke-width:1px
Download:
Mermaid (.mmd)
(open online Mermaid editor)
2D force graph
|
3D force graph
Show more details on duplication between components...
From Component
--> To Component
Duplicated
Lines
File Pairs
Details
P2M (5%)
  --> Theorems (64%)
566749
129590 file pairs
details...
Definitions (15%)
  --> P2M (<1%)
67976
2332 file pairs
details...
Definitions (1%)
  --> Theorems (<1%)
5580
846 file pairs
details...
html (24%)
  --> tools (28%)
1340
4 file pairs
details...
flowchart TB
n0["P2M"]
n1["Theorems"]
n2["Definitions"]
n3["html"]
n4["tools"]
n0 ---|"566749"| n1
n2 ---|"67976"| n0
n2 ---|"5580"| n1
n3 ---|"1340"| n4
classDef default fill:#00b2ee,stroke:#ffffff,color:#000000;
classDef highlighted fill:#00b2ee,stroke:#ffffff,color:#000000;
linkStyle 0 stroke:#DC143CFF,stroke-width:10px
linkStyle 1 stroke:#DC143C5E,stroke-width:1px
linkStyle 2 stroke:#DC143C4C,stroke-width:1px
linkStyle 3 stroke:#DC143C4C,stroke-width:1px
Show more details on duplication between components...
| From Component --> To Component |
Duplicated Lines |
File Pairs | Details |
|---|---|---|---|
| P2M (5%)   --> Theorems (64%) |
566749 | 129590 file pairs | details... |
| Definitions (15%)   --> P2M (<1%) |
67976 | 2332 file pairs | details... |
| Definitions (1%)   --> Theorems (<1%) |
5580 | 846 file pairs | details... |
| html (24%)   --> tools (28%) |
1340 | 4 file pairs | details... |
Longest Duplicates
The list of 50 longest duplicates.
| Size | # | Folders | Files | Lines | Code |
|---|---|---|---|---|---|
| 4230 | x 2 | P2M/SolP2M/Sol | 11:4794 (94%)10:4793 (93%) | view | |
| 2805 | x 2 | P2M/SolP2M/Sol | 105:3246 (46%)105:3246 (45%) | view | |
| 2514 | x 2 | P2M/SolP2M/Sol | 26:2804 (98%)26:2804 (98%) | view | |
| 2499 | x 2 | P2M/SolP2M/Sol | 1954:4793 (55%)1958:4797 (47%) | view | |
| 2499 | x 2 | P2M/SolP2M/Sol | 1955:4794 (55%)1958:4797 (47%) | view | |
| 2268 | x 2 | P2M/SolP2M/Sol | 41:2558 (90%)32:2549 (48%) | view | |
| 2268 | x 2 | P2M/SolP2M/Sol | 41:2558 (90%)32:2549 (90%) | view | |
| 2268 | x 2 | P2M/SolP2M/Sol | 32:2549 (90%)32:2549 (48%) | view | |
| 2135 | x 2 | P2M/SolP2M/Sol | 2365:4794 (47%)2362:4791 (47%) | view | |
| 2135 | x 2 | P2M/SolP2M/Sol | 2368:4797 (40%)2362:4791 (47%) | view | |
| 2135 | x 2 | P2M/SolP2M/Sol | 2364:4793 (47%)2362:4791 (47%) | view | |
| 2092 | x 2 | P2M/SolP2M/Sol | 11:2359 (46%)9:2357 (46%) | view | |
| 2092 | x 2 | P2M/SolP2M/Sol | 10:2358 (46%)9:2357 (46%) | view | |
| 2069 | x 2 | P2M/SolP2M/Sol | 49:2498 (96%)49:2498 (96%) | view | |
| 2039 | x 2 | P2M/SolP2M/Sol | 10:2297 (39%)11:2298 (39%) | view | |
| 2037 | x 2 | P2M/SolP2M/Sol | 14:2297 (39%)11:2294 (45%) | view | |
| 2037 | x 2 | P2M/SolP2M/Sol | 12:2295 (45%)15:2298 (39%) | view | |
| 2037 | x 2 | P2M/SolP2M/Sol | 13:2296 (45%)14:2297 (39%) | view | |
| 2037 | x 2 | P2M/SolP2M/Sol | 15:2298 (39%)11:2294 (45%) | view | |
| 2037 | x 2 | P2M/SolP2M/Sol | 12:2295 (45%)14:2297 (39%) | view | |
| 2037 | x 2 | P2M/SolP2M/Sol | 13:2296 (45%)15:2298 (39%) | view | |
| 1931 | x 2 | P2M/SolP2M/Sol | 18:2218 (81%)18:2218 (82%) | view | |
| 1931 | x 2 | P2M/SolP2M/Sol | 18:2218 (81%)19:2219 (85%) | view | |
| 1931 | x 2 | P2M/SolP2M/Sol | 19:2219 (85%)18:2218 (82%) | view | |
| 1901 | x 2 | P2M/SolP2M/Sol | 20:2135 (47%)20:2135 (45%) | view | |
| 1901 | x 2 | P2M/SolP2M/Sol | 20:2135 (60%)20:2135 (47%) | view | |
| 1901 | x 2 | P2M/SolP2M/Sol | 20:2135 (60%)20:2135 (45%) | view | |
| 1806 | x 2 | P2M/SolP2M/Sol | 28:2054 (36%)26:2052 (36%) | view | |
| 1730 | x 2 | P2M/SolP2M/Sol | 11:1952 (32%)11:1952 (33%) | view | |
| 1730 | x 2 | P2M/SolP2M/Sol | 10:1951 (33%)11:1952 (32%) | view | |
| 1728 | x 2 | P2M/SolP2M/Sol | 12:1949 (38%)15:1952 (32%) | view | |
| 1728 | x 2 | P2M/SolP2M/Sol | 13:1950 (38%)15:1952 (32%) | view | |
| 1728 | x 2 | P2M/SolP2M/Sol | 15:1952 (32%)11:1948 (38%) | view | |
| 1703 | x 2 | P2M/SolP2M/Sol | 24:2003 (95%)24:2003 (82%) | view | |
| 1600 | x 2 | P2M/SolP2M/Sol | 108:1874 (73%)110:1876 (73%) | view | |
| 1594 | x 2 | P2M/SolP2M/Sol | 31:1772 (85%)34:1775 (89%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1525 | x 2 | P2M/SolP2M/Sol | 12:1621 (99%)12:1621 (99%) | view | |
| 1516 | x 2 | P2M/SolP2M/Sol | 3092:4795 (29%)3088:4791 (33%) | view | |
| 1516 | x 2 | P2M/SolP2M/Sol | 3090:4793 (33%)3094:4797 (29%) | view | |
| 1516 | x 2 | P2M/SolP2M/Sol | 3091:4794 (33%)3092:4795 (29%) | view | |
| 1516 | x 2 | P2M/SolP2M/Sol | 3094:4797 (28%)3094:4797 (29%) | view |
Most Frequent Duplicates
The list of 50 most frequently found duplicates.
Duplicated Units
The list of top 23 duplicated units.
| Size | # | Folders | Files | Lines | Code |
|---|---|---|---|---|---|
| 113 | x 2 | tools/docs-site/gen/assetshtml/assets | 40:164 40:164 | view | |
| 136 | x 2 | tools/docs-site/gen/assetshtml/assets | 4:155 4:155 | view | |
| 38 | x 2 | tools/docs-site/gen/assetshtml/assets | 14:53 14:53 | view | |
| 37 | x 2 | tools/docs-site/gen/assetshtml/assets | 309:347 309:347 | view | |
| 25 | x 2 | tools/docs-site/gen/assetshtml/assets | 230:257 230:257 | view | |
| 16 | x 2 | tools/docs-site/gen/assetshtml/assets | 290:308 290:308 | view | |
| 14 | x 2 | tools/docs-site/gen/assetshtml/assets | 37:53 37:53 | view | |
| 34 | x 2 | tools/docs-site/gen/assetshtml/assets | 194:229 194:229 | view | |
| 14 | x 2 | tools/docs-site/gen/assetshtml/assets | 212:227 212:227 | view | |
| 11 | x 2 | tools/docs-site/gen/assetshtml/assets | 179:191 179:191 | view | |
| 11 | x 2 | tools/docs-site/gen/assetshtml/assets | 275:287 275:287 | view | |
| 11 | x 2 | tools/docs-site/gen/assetshtml/assets | 6:18 6:18 | view | |
| 51 | x 2 | tools/docs-site/gen/assetshtml/assets | 3:55 3:55 | view | |
| 9 | x 2 | tools/docs-site/gen/assetshtml/assets | 25:35 25:35 | view | |
| 8 | x 2 | tools/docs-site/gen/assetshtml/assets | 85:94 85:94 | view | |
| 8 | x 2 | tools/docs-site/gen/assetshtml/assets | 120:129 120:129 | view | |
| 7 | x 2 | tools/docs-site/gen/assetshtml/assets | 358:366 358:366 | view | |
| 7 | x 2 | tools/docs-site/gen/assetshtml/assets | 52:60 52:60 | view | |
| 6 | x 2 | tools/docs-site/gen/assetshtml/assets | 384:391 384:391 | view | |
| 6 | x 2 | tools/docs-site/gen/assetshtml/assets | 22:29 22:29 | view | |
| 151 | x 2 | tools/docs-site/gen/assetshtml/assets | 2:165 2:165 | view | |
| 18 | x 2 | tools/docs-site/gen/assetshtml/assets | 209:228 209:228 | view | |
| 11 | x 2 | tools/docs-site/gen/assetshtml/assets | 355:367 355:367 | view |
About This Analysis
- For duplication, we look at places in code where there are 6 or more lines of code that are exactly the same.
- Before duplication is calculated, the code is cleaned to remove empty lines, comments, and frequently duplicated constructs such as imports.
- You should aim at having as little as possible (<5%) of duplicated code as high-level of duplication can lead to maintenance difficulties, poor factoring, and logical contradictions.
Learn more...
- To learn more about duplications and techniques for eliminating duplication, Sokrates recommends the following resources:
- Avoid Repetition, MartinFlower.com (IEEE Software article)
- Refactoring duplicated code, sourcemaking.com
- Beck Design Rules, MartinFowler.com
- DRY (Don't Repeat Yourself) Principle, Wikipedia
- The Cut-and-Paste Programming Software Development Anti-Pattern, sourcemaking.com
- Code Smells / Duplicated Code, Jeff Atwood, codinghorror.com:
- "Duplicated code is the bane of software development. Stamp out duplication whenever possible. You should always be on the lookout for more subtle cases of near-duplication, too. Don't Repeat Yourself!"
- Reducing Coupling, MartinFlower.com (IEEE Software article):
- "There are several ways to describe coupling, but it boils down to this: If changing one module in a program requires changing another module, then coupling exists. ... Duplication always implies coupling, because changing one piece of duplicate code implies changing the other."