primer / view_components
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 416 units with 2,931 lines of code in units (27.6% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 18 medium size units (519 lines of code)
    • 61 small units (855 lines of code)
    • 337 very small units (1,557 lines of code)
0% | 0% | 17% | 29% | 53%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rb0% | 0% | 20% | 31% | 48%
rake0% | 0% | 0% | 61% | 38%
thor0% | 0% | 0% | 0% | 100%
ts0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib0% | 0% | 24% | 31% | 43%
app0% | 0% | 15% | 33% | 50%
ROOT0% | 0% | 0% | 0% | 100%
script0% | 0% | 0% | 0% | 100%
stories0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
49 14 1
40 1 0
39 18 1
38 11 5
33 12 1
31 8 1
30 14 1
30 14 2
27 7 7
25 3 0
25 6 2
24 6 2
22 2 0
22 6 1
21 7 0
21 2 0
21 2 0
21 4 3
20 1 0
19 4 3
18 2 5
18 1 0
18 8 4
18 6 1
18 4 1
17 1 6
17 4 1
17 3 2
17 1 0
17 10 1
16 10 3
16 5 1
16 5 1
16 8 1
16 6 0
15 10 0
15 1 11
15 6 1
15 5 0
15 1 1
14 1 5
14 5 4
14 1 0
14 6 0
14 2 0
14 3 1
14 9 1
14 2 1
13 3 4
13 2 6