microsoft / pxt-common-packages
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
  • 6% duplication:
    • 36,305 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 2,343 duplicated lines
  • 298 duplicates
system6% (2,343 lines)
Duplication per Extension
ts6% (1,385 lines)
cpp6% (884 lines)
h3% (74 lines)
Duplication per Component (primary)
libs/game10% (783 lines)
libs/core---esp3222% (179 lines)
libs/core6% (178 lines)
libs/core---vm8% (173 lines)
libs/base2% (124 lines)
libs/screen5% (102 lines)
libs/animation52% (100 lines)
cpptests59% (65 lines)
libs/core---linux10% (55 lines)
libs/light5% (54 lines)
libs/color-coded-tilemap25% (53 lines)
libs/screen---linux20% (41 lines)
libs/settings3% (30 lines)
libs/keyboard13% (30 lines)
libs/lcd5% (30 lines)
scripts/raffs9% (27 lines)
scripts/snorfs9% (27 lines)
libs/screen---ext26% (27 lines)
libs/mixer3% (26 lines)
libs/music7% (26 lines)
libs/radio4% (24 lines)
libs/core---nrf5230% (20 lines)
libs/core---stm3213% (20 lines)
libs/esp322% (20 lines)
libs/core---samd20% (18 lines)
libs/screen---st77352% (16 lines)
libs/edge-connector20% (16 lines)
libs/sprite-scaling23% (16 lines)
libs/net2% (13 lines)
libs/color5% (11 lines)
libs/pixel42% (11 lines)
libs/buttons6% (9 lines)
libs/game---light14% (7 lines)
libs/cable5% (6 lines)
libs/infrared5% (6 lines)
cpptests/screen0% (0 lines)
libs/accelerometer0% (0 lines)
libs/azureiot0% (0 lines)
libs/color-sensor0% (0 lines)
libs/controller---none0% (0 lines)
libs/controller0% (0 lines)
libs/core---rp20400% (0 lines)
libs/datalogger0% (0 lines)
libs/display0% (0 lines)
libs/gamepad0% (0 lines)
libs/light-spectrum-sensor0% (0 lines)
libs/lightsensor0% (0 lines)
libs/lora0% (0 lines)
libs/matrix-keypad0% (0 lines)
libs/microphone0% (0 lines)
libs/mixer---ext0% (0 lines)
libs/mixer---linux0% (0 lines)
libs/mixer---none0% (0 lines)
libs/mixer---nrf520% (0 lines)
libs/mixer---rp20400% (0 lines)
libs/mixer---samd0% (0 lines)
libs/mixer---stm320% (0 lines)
libs/mouse0% (0 lines)
libs/mqtt0% (0 lines)
libs/music---linux0% (0 lines)
libs/music---pwm0% (0 lines)
libs/net-game0% (0 lines)
libs/palette0% (0 lines)
libs/power0% (0 lines)
libs/proximity0% (0 lines)
libs/pulse0% (0 lines)
libs/radio-broadcast0% (0 lines)
libs/rotary-encoder0% (0 lines)
libs/serial---linux0% (0 lines)
libs/serial0% (0 lines)
libs/servo0% (0 lines)
libs/settings---esp320% (0 lines)
libs/settings---files0% (0 lines)
libs/storage0% (0 lines)
libs/storyboard0% (0 lines)
libs/switch0% (0 lines)
libs/text-to-speech0% (0 lines)
libs/thermometer0% (0 lines)
libs/touch0% (0 lines)
libs/wifi---esp320% (0 lines)
scripts/font-compiler0% (0 lines)
scripts0% (0 lines)

Duplication Between Components (50+ lines)

G libs/core---esp32 libs/core---esp32 libs/core---vm libs/core---vm libs/core---esp32--libs/core---vm 180 libs/core libs/core libs/core---esp32--libs/core 178 cpptests cpptests cpptests--libs/core---vm 130 cpptests--libs/core---esp32 130 libs/core---linux libs/core---linux libs/core---linux--libs/core---vm 110 libs/color-coded-tilemap libs/color-coded-tilemap libs/game libs/game libs/color-coded-tilemap--libs/game 106 libs/screen---ext libs/screen---ext libs/screen---linux libs/screen---linux libs/screen---ext--libs/screen---linux 54 scripts/raffs scripts/raffs scripts/snorfs scripts/snorfs scripts/raffs--scripts/snorfs 54 libs/mixer libs/mixer libs/music libs/music libs/mixer--libs/music 52

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 298 duplicates...
Size#FoldersFilesLinesCode
65 x 2 cpptests
libs/core---vm
queue.cpp
target.cpp
8:95 (59%)
29:115 (58%)
view
54 x 2 libs/core---esp32
libs/core---vm
dmesg.cpp
target.cpp
32:105 (28%)
42:115 (48%)
view
54 x 2 cpptests
libs/core---esp32
queue.cpp
dmesg.cpp
20:95 (49%)
32:105 (28%)
view
34 x 2 libs/game
libs/game
numberprompt.ts
prompt.ts
280:330 (11%)
317:367 (11%)
view
31 x 2 libs/game
libs/game
spritesay.ts
spritesay.ts
113:144 (10%)
149:180 (10%)
view
31 x 2 libs/game
libs/game
spritesay.ts
spritesay.ts
79:110 (10%)
183:214 (10%)
view
26 x 2 libs/color-coded-tilemap
libs/game
tilemap.ts
tilemap.ts
324:362 (12%)
448:486 (7%)
view
22 x 2 libs/base
libs/base/sim
pxtbase.h
control.ts
245:267 (3%)
184:206 (14%)
view
20 x 2 libs/core---esp32
libs/core
pins.cpp
pins.cpp
23:54 (43%)
26:57 (42%)
view
20 x 2 libs/game
libs/game
numberprompt.ts
prompt.ts
123:145 (6%)
136:158 (6%)
view
18 x 2 libs/mixer
libs/music
legacy.ts
melodies.ts
32:49 (45%)
62:79 (13%)
view
16 x 2 libs/screen---ext
libs/screen---linux
targetoverrides.ts
targetoverrides.ts
6:35 (100%)
6:35 (100%)
view
16 x 2 libs/screen---linux
libs/screen---st7735
targetoverrides.ts
targetoverrides.ts
6:35 (100%)
6:35 (100%)
view
16 x 2 libs/screen---ext
libs/screen---st7735
targetoverrides.ts
targetoverrides.ts
6:35 (100%)
6:35 (100%)
view
15 x 2 libs/lcd
libs/lcd/sim
characterlcd.ts
state.ts
8:24 (8%)
48:64 (19%)
view
15 x 2 libs/game
libs/game
physics.ts
physics.ts
474:488 (2%)
546:560 (2%)
view
15 x 2 libs/core---esp32
libs/core
usb.cpp
hf2.cpp
219:240 (7%)
346:367 (4%)
view
14 x 2 libs/animation
libs/animation
test.ts
test.ts
33:46 (12%)
78:91 (12%)
view
14 x 2 libs/core---nrf52
libs/core---stm32
platform.cpp
platform.cpp
42:57 (21%)
79:94 (10%)
view
13 x 2 libs/core---linux
libs/core---vm
linux.cpp
scheduler.cpp
84:99 (5%)
70:85 (3%)
view
Duplicated Units
The list of top 14 duplicated units.
See data for all 14 unit duplicates...
Size#FoldersFilesLinesCode
33 x 3 cpptests
libs/core---esp32
libs/core---vm
queue.cpp
dmesg.cpp
target.cpp
35:72 
47:84 
57:94 
view
28 x 2 libs/game
libs/game
numberprompt.ts
prompt.ts
289:327 
326:364 
view
16 x 3 cpptests
libs/core---esp32
libs/core---vm
queue.cpp
dmesg.cpp
target.cpp
74:96 
86:106 
96:116 
view
13 x 2 libs/core---linux
libs/core---vm
linux.cpp
scheduler.cpp
320:333 
475:488 
view
10 x 2 libs/game
libs/game
numberprompt.ts
prompt.ts
259:269 
296:306 
view
9 x 2 libs/core---samd
libs/core
platform.cpp
platform.cpp
130:139 
19:28 
view
8 x 2 libs/core---esp32
libs/core
usb.cpp
hf2.cpp
324:332 
209:217 
view
8 x 2 libs/radio
libs/radio
radio.ts
test.ts
359:369 
128:138 
view
7 x 2 libs/core---esp32
libs/core---vm
dmesg.cpp
target.cpp
214:221 
122:129 
view
6 x 3 libs/core---nrf52
libs/core---samd
libs/core---stm32
platform.cpp
platform.cpp
platform.cpp
43:49 
73:79 
80:86 
view
6 x 2 libs/game
libs/game
numberprompt.ts
prompt.ts
280:287 
317:324 
view
6 x 2 libs/game
libs/game
particlefactories.ts
particlefactories.ts
309:315 
358:364 
view
6 x 2 libs/light
libs/light
neopixel.ts
neopixel.ts
1281:1288 
1321:1327 
view
9 x 3 libs/screen---ext
libs/screen---linux
libs/screen---st7735
targetoverrides.ts
targetoverrides.ts
targetoverrides.ts
25:36 
25:36 
25:36 
view