microsoft / calculator
Duplication

Places in code with 6 or more lines that are exactly the same.

Intro
  • 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...
Duplication Overall
  • 13% duplication:
    • 42,626 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 5,924 duplicated lines
  • 1,087 duplicates
system13% (5,924 lines)
Duplication per Extension
xaml21% (2,574 lines)
vcxproj77% (1,331 lines)
h14% (1,097 lines)
cpp4% (482 lines)
cs4% (356 lines)
yaml11% (61 lines)
filters4% (23 lines)
Duplication per Component (primary)
src/Calculator15% (2,736 lines)
src/CalcViewModel8% (816 lines)
src/GraphControl26% (748 lines)
src/CalcManager9% (721 lines)
src/CalcViewModelCopyForUT47% (229 lines)
src/TraceLogging82% (224 lines)
src/CalculatorUITests9% (194 lines)
src/GraphingImpl67% (189 lines)
build/pipelines11% (61 lines)
src/GraphingInterfaces1% (6 lines)
Tools/PGO0% (0 lines)
Tools/Scripts0% (0 lines)
build/scripts0% (0 lines)
src/CalculatorUITestFramework0% (0 lines)
src/build0% (0 lines)

Duplication Between Components (50+ lines)

G src/CalcViewModel src/CalcViewModel src/GraphControl src/GraphControl src/CalcViewModel--src/GraphControl 1175 src/TraceLogging src/TraceLogging src/CalcViewModel--src/TraceLogging 400 src/GraphingImpl src/GraphingImpl src/CalcViewModel--src/GraphingImpl 186 src/CalcViewModelCopyForUT src/CalcViewModelCopyForUT src/CalcViewModel--src/CalcViewModelCopyForUT 126 src/GraphControl--src/TraceLogging 298 src/GraphControl--src/GraphingImpl 192 src/GraphingImpl--src/TraceLogging 186 src/CalcManager src/CalcManager src/CalcManager--src/GraphingImpl 166 src/CalcManager--src/CalcViewModelCopyForUT 162 src/CalcManager--src/CalcViewModel 100 src/CalcManager--src/TraceLogging 82 src/CalcManager--src/GraphControl 80 src/CalcViewModelCopyForUT--src/GraphingImpl 116 src/CalcViewModelCopyForUT--src/TraceLogging 112 src/CalcViewModelCopyForUT--src/GraphControl 92

Download: SVG DOT (open online Graphviz editor)

Open 3D force graph...

Show more details on duplication between components...
Longest Duplicates
The list of 20 longest duplicates.
See data for all 1,087 duplicates...
Size#FoldersFilesLinesCode
114 x 2 src/CalcViewModel/Common
src/GraphControl
Utils.h
Utils.h
209:379 (19%)
176:346 (25%)
view
106 x 2 src/CalcViewModel/Common
src/GraphControl
Utils.h
Utils.h
451:562 (18%)
425:535 (23%)
view
87 x 2 src/CalcViewModel
src/TraceLogging
vcxproj
CalcViewModel.vcxproj
TraceLogging.vcxproj
41:154 (25%)
41:154 (37%)
view
77 x 2 src/CalcViewModel/Common
src/GraphControl
Utils.h
Utils.h
16:100 (13%)
12:96 (16%)
view
66 x 2 src/GraphControl
src/GraphControl
Utils.h
Utils.h
387:455 (14%)
457:526 (14%)
view
66 x 2 src/CalcViewModel/Common
src/GraphControl
Utils.h
Utils.h
484:553 (11%)
387:455 (14%)
view
65 x 2 src/GraphingImpl
src/TraceLogging
vcxproj
GraphingImpl.vcxproj
TraceLogging.vcxproj
41:124 (29%)
41:124 (27%)
view
65 x 2 src/CalcViewModel
src/GraphingImpl
vcxproj
CalcViewModel.vcxproj
GraphingImpl.vcxproj
41:124 (19%)
41:124 (29%)
view
62 x 2 src/CalcViewModel/Common
src/GraphControl
Utils.h
Utils.h
416:482 (10%)
352:418 (13%)
view
59 x 2 src/CalcViewModel
src/GraphControl
vcxproj
CalcViewModel.vcxproj
GraphControl.vcxproj
46:123 (17%)
46:123 (20%)
view
59 x 2 src/GraphControl
src/TraceLogging
vcxproj
GraphControl.vcxproj
TraceLogging.vcxproj
46:123 (20%)
46:123 (25%)
view
59 x 2 src/GraphControl
src/GraphingImpl
vcxproj
GraphControl.vcxproj
GraphingImpl.vcxproj
46:123 (20%)
46:123 (26%)
view
42 x 2 src/Calculator/Views
src/Calculator/Views
xaml
CalculatorScientificOperators.xaml
CalculatorStandardOperators.xaml
1170:1216 (3%)
265:307 (14%)
view
38 x 2 src/CalcViewModel/Common
src/GraphControl
Utils.h
Utils.h
112:165 (6%)
108:161 (8%)
view
30 x 2 src/GraphControl
src/GraphControl
Utils.h
Utils.h
425:455 (6%)
457:488 (6%)
view
30 x 2 src/CalcViewModel/Common
src/GraphControl
Utils.h
Utils.h
522:553 (5%)
457:488 (6%)
view
30 x 2 src/GraphControl
src/GraphControl
Utils.h
Utils.h
387:418 (6%)
495:526 (6%)
view
30 x 2 src/CalcViewModel/Common
src/CalcViewModel/Common
Utils.h
Utils.h
451:482 (5%)
484:515 (5%)
view
30 x 2 src/CalcViewModel/Common
src/CalcViewModel/Common
Utils.h
Utils.h
451:482 (5%)
522:553 (5%)
view
30 x 2 src/Calculator
src/Calculator
xaml
App.xaml
App.xaml
911:956 (1%)
1530:1575 (1%)
view
Duplicated Units
The list of top 11 duplicated units.
See data for all 11 unit duplicates...
Size#FoldersFilesLinesCode
24 x 2 src/Calculator/Views
src/Calculator/Views/GraphingCalculator
CalculatorScientificOperators.xaml.cs
GraphingNumPad.xaml.cs
131:157 
99:125 
view
15 x 2 src/Calculator/Views
src/Calculator/Views/GraphingCalculator
CalculatorScientificOperators.xaml.cs
GraphingNumPad.xaml.cs
113:129 
81:97 
view
10 x 2 src/Calculator/Controls
src/Calculator/Controls
CalculationResult.cs
OverflowTextBlock.cs
365:375 
280:290 
view
8 x 2 src/Calculator/Common
src/Calculator/Common
AppLifecycleLogger.cs
AppLifecycleLogger.cs
94:103 
105:114 
view
7 x 3 src/CalcViewModel/Common
src/CalcViewModel/Common
src/GraphControl
Utils.h
Utils.h
Utils.h
62:69 
84:91 
58:65 
view
7 x 2 src/Calculator/Common
src/Calculator/Common
AppLifecycleLogger.cs
AppLifecycleLogger.cs
44:52 
54:62 
view
7 x 2 src/Calculator/Controls
src/Calculator/Controls
CalculatorButton.cs
FlipButtons.cs
121:130 
65:74 
view
7 x 2 src/Calculator/Controls
src/Calculator/Controls
CalculatorButton.cs
FlipButtons.cs
132:141 
76:85 
view
6 x 2 src/Calculator/Views
src/Calculator/Views
CalculatorProgrammerRadixOperators.xa...
CalculatorScientificOperators.xaml.cs
210:216 
159:165 
view
6 x 2 src/Calculator/Views
src/Calculator/Views
CalculatorProgrammerRadixOperators.xa...
CalculatorScientificOperators.xaml.cs
218:224 
167:173 
view
6 x 2 src/Calculator/Views/StateTriggers
src/Calculator/Views/StateTriggers
AspectRatioTrigger.cs
ControlSizeTrigger.cs
105:111 
74:80 
view