facebookincubator / facebook-for-magento2
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 338 units with 4,374 lines of code in units (67.6% of code).
    • 3 very long units (870 lines of code)
    • 2 long units (131 lines of code)
    • 33 medium size units (955 lines of code)
    • 82 small units (1,209 lines of code)
    • 218 very small units (1,209 lines of code)
19% | 2% | 21% | 27% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
php21% | 3% | 21% | 27% | 25%
js0% | 0% | 26% | 24% | 49%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Model45% | 0% | 18% | 20% | 16%
Setup60% | 0% | 27% | 10% | 1%
Helper0% | 12% | 31% | 30% | 24%
view0% | 0% | 26% | 24% | 49%
Controller0% | 0% | 25% | 38% | 36%
Observer0% | 0% | 25% | 44% | 29%
Block0% | 0% | 0% | 40% | 60%
Cron0% | 0% | 0% | 35% | 64%
Logger0% | 0% | 0% | 0% | 100%
Plugin0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
411 2 0
304 2 0
155 16 2
73 13 2
58 14 0
48 10 1
43 14 1
42 1 0
41 23 2
39 12 2
36 1 2
35 10 2
33 5 1
31 6 0
30 1 1
30 4 2
30 4 0
30 4 0
29 5 1
29 4 0
29 5 1
29 1 0
28 7 1
27 8 0
24 4 0
24 5 0
24 6 2
24 4 0
23 3 1
23 3 0
23 2 2
22 3 0
22 4 1
22 3 2
22 7 0
21 4 1
21 2 2
21 1 9
20 2 1
20 4 1
20 4 0
20 3 2
20 3 1
19 2 1
19 4 1
19 2 1
19 3 2
19 4 0
19 3 0
18 3 0