apple / HomeKitADK
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
  • 41% duplication:
    • 47,380 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 19,564 duplicated lines
  • 2,789 duplicates
system41% (19,564 lines)
Duplication per Extension
c45% (17,405 lines)
h26% (2,082 lines)
m8% (77 lines)
Duplication per Component (primary)
HAP27% (7,662 lines)
PAL/Linux99% (2,883 lines)
PAL/Raspi99% (2,883 lines)
PAL/POSIX99% (2,883 lines)
Applications/Lock76% (702 lines)
Applications/Lightbulb89% (642 lines)
PAL/Mock27% (454 lines)
PAL19% (453 lines)
PAL/Crypto13% (374 lines)
External/JSON41% (233 lines)
Applications100% (160 lines)
External/HTTP29% (122 lines)
PAL/Darwin10% (101 lines)
External/Base6410% (12 lines)
Tools/AccessorySetupGenerator0% (0 lines)

Duplication Between Components (50+ lines)

G PAL/Linux PAL/Linux PAL/POSIX PAL/POSIX PAL/Linux--PAL/POSIX 5766 PAL/Raspi PAL/Raspi PAL/Linux--PAL/Raspi 5766 PAL/Mock PAL/Mock PAL/Linux--PAL/Mock 586 PAL/POSIX--PAL/Raspi 5766 Applications/Lightbulb Applications/Lightbulb Applications/Lock Applications/Lock Applications/Lightbulb--Applications/Lock 1328 Applications Applications Applications/Lightbulb--Applications 320 Applications/Lock--Applications 320 PAL/Mock--PAL/Raspi 586 PAL/Mock--PAL/POSIX 586 PAL/Crypto PAL/Crypto PAL PAL PAL/Crypto--PAL 199 PAL--PAL/Linux 54 PAL--PAL/Raspi 54 PAL--PAL/POSIX 54 PAL/Darwin PAL/Darwin PAL/Darwin--PAL/Linux 110 PAL/Darwin--PAL/Raspi 110 PAL/Darwin--PAL/POSIX 110 PAL/Darwin--PAL/Mock 74 PAL/Darwin--PAL 68

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 2,789 duplicates...
Size#FoldersFilesLinesCode
577 x 2 PAL/Linux
PAL/POSIX
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
20:784 (100%)
20:784 (100%)
view
577 x 2 PAL/POSIX
PAL/Raspi
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
20:784 (100%)
20:784 (100%)
view
577 x 2 PAL/Linux
PAL/Raspi
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
20:784 (100%)
20:784 (100%)
view
420 x 2 PAL/Linux
PAL/Raspi
HAPPlatformRunLoop.c
HAPPlatformRunLoop.c
22:711 (100%)
22:711 (100%)
view
420 x 2 PAL/Linux
PAL/POSIX
HAPPlatformRunLoop.c
HAPPlatformRunLoop.c
22:711 (100%)
22:711 (100%)
view
420 x 2 PAL/POSIX
PAL/Raspi
HAPPlatformRunLoop.c
HAPPlatformRunLoop.c
22:711 (100%)
22:711 (100%)
view
323 x 2 Applications/Lightbulb
Applications/Lock
DB.c
DB.c
48:390 (81%)
53:395 (64%)
view
295 x 2 PAL/Linux
PAL/Raspi
HAPPlatformFileManager.c
HAPPlatformFileManager.c
18:451 (100%)
18:451 (100%)
view
295 x 2 PAL/Linux
PAL/POSIX
HAPPlatformFileManager.c
HAPPlatformFileManager.c
18:451 (100%)
18:451 (100%)
view
295 x 2 PAL/POSIX
PAL/Raspi
HAPPlatformFileManager.c
HAPPlatformFileManager.c
18:451 (100%)
18:451 (100%)
view
267 x 2 PAL/Linux
PAL/POSIX
HAPPlatformKeyValueStore.c
HAPPlatformKeyValueStore.c
15:437 (100%)
15:437 (100%)
view
267 x 2 PAL/Linux
PAL/Raspi
HAPPlatformKeyValueStore.c
HAPPlatformKeyValueStore.c
15:437 (100%)
15:437 (100%)
view
267 x 2 PAL/POSIX
PAL/Raspi
HAPPlatformKeyValueStore.c
HAPPlatformKeyValueStore.c
15:437 (100%)
15:437 (100%)
view
170 x 2 PAL/Linux
PAL/POSIX
HAPPlatformServiceDiscovery.c
HAPPlatformServiceDiscovery.c
13:229 (100%)
13:229 (100%)
view
170 x 2 PAL/POSIX
PAL/Raspi
HAPPlatformServiceDiscovery.c
HAPPlatformServiceDiscovery.c
13:229 (100%)
13:229 (100%)
view
170 x 2 PAL/Linux
PAL/Raspi
HAPPlatformServiceDiscovery.c
HAPPlatformServiceDiscovery.c
13:229 (100%)
13:229 (100%)
view
160 x 2 Applications/Lock
Applications
Main.c
Main.c
24:323 (100%)
24:323 (100%)
view
160 x 2 Applications/Lightbulb
Applications
Main.c
Main.c
24:323 (100%)
24:323 (100%)
view
160 x 2 Applications/Lightbulb
Applications/Lock
Main.c
Main.c
24:323 (100%)
24:323 (100%)
view
157 x 2 PAL/Linux
PAL/Raspi
HAPPlatformAccessorySetupNFC.c
HAPPlatformAccessorySetupNFC.c
148:384 (64%)
148:384 (64%)
view
Duplicated Units
The list of top 20 duplicated units.
See data for all 88 unit duplicates...
Size#FoldersFilesLinesCode
158 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
194:366 
194:366 
194:366 
view
156 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformFileManager.c
HAPPlatformFileManager.c
HAPPlatformFileManager.c
76:259 
76:259 
76:259 
view
132 x 4 PAL/Linux
PAL/Mock
PAL/POSIX
PAL/Raspi
HAPPlatformSystemCommand.c
HAPPlatformSystemCommand.c
HAPPlatformSystemCommand.c
HAPPlatformSystemCommand.c
31:194 
31:194 
31:194 
31:194 
view
129 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformLog.c
HAPPlatformLog.c
HAPPlatformLog.c
81:231 
81:231 
81:231 
view
90 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
411:519 
411:519 
411:519 
view
86 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformServiceDiscovery.c
HAPPlatformServiceDiscovery.c
HAPPlatformServiceDiscovery.c
73:165 
73:165 
73:165 
view
82 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformRunLoop.c
HAPPlatformRunLoop.c
HAPPlatformRunLoop.c
566:659 
566:659 
566:659 
view
76 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformFileManager.c
HAPPlatformFileManager.c
HAPPlatformFileManager.c
328:418 
328:418 
328:418 
view
65 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformRunLoop.c
HAPPlatformRunLoop.c
HAPPlatformRunLoop.c
467:545 
467:545 
467:545 
view
56 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
549:616 
549:616 
549:616 
view
55 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformMFiTokenAuth.c
HAPPlatformMFiTokenAuth.c
HAPPlatformMFiTokenAuth.c
24:83 
24:83 
24:83 
view
54 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformFileManager.c
HAPPlatformFileManager.c
HAPPlatformFileManager.c
262:325 
262:325 
262:325 
view
52 x 3 Applications/Lightbulb
Applications/Lock
Applications
Main.c
Main.c
Main.c
63:139 
63:139 
63:139 
view
52 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformRunLoop.c
HAPPlatformRunLoop.c
HAPPlatformRunLoop.c
405:465 
405:465 
405:465 
view
50 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformClock.c
HAPPlatformClock.c
HAPPlatformClock.c
15:83 
15:83 
15:83 
view
50 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
HAPPlatformTCPStreamManager.c
118:176 
118:176 
118:176 
view
48 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformKeyValueStore.c
HAPPlatformKeyValueStore.c
HAPPlatformKeyValueStore.c
317:372 
317:372 
317:372 
view
48 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformServiceDiscovery.c
HAPPlatformServiceDiscovery.c
HAPPlatformServiceDiscovery.c
167:218 
167:218 
167:218 
view
43 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformAccessorySetupNFC.c
HAPPlatformAccessorySetupNFC.c
HAPPlatformAccessorySetupNFC.c
44:90 
44:90 
44:90 
view
39 x 3 PAL/Linux
PAL/POSIX
PAL/Raspi
HAPPlatformFileManager.c
HAPPlatformFileManager.c
HAPPlatformFileManager.c
21:73 
21:73 
21:73 
view