facebookincubator / cargo-guppy
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 495 units with 7,128 lines of code in units (6.9% of code).
    • 5 very long units (667 lines of code)
    • 22 long units (1,618 lines of code)
    • 65 medium size units (2,063 lines of code)
    • 87 small units (1,231 lines of code)
    • 316 very small units (1,549 lines of code)
9% | 22% | 28% | 17% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs9% | 22% | 28% | 17% | 21%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
guppy/src16% | 22% | 21% | 13% | 24%
tools/cargo-hakari30% | 13% | 27% | 11% | 17%
tools/hakari7% | 25% | 33% | 21% | 12%
tools/determinator0% | 40% | 27% | 21% | 11%
target-spec/src0% | 34% | 18% | 14% | 32%
guppy-summaries/src0% | 36% | 26% | 22% | 15%
internal-tools/cargo-compare0% | 46% | 0% | 15% | 38%
cargo-guppy/src0% | 0% | 58% | 24% | 16%
fixtures/src0% | 0% | 39% | 13% | 47%
internal-tools/fixture-manager0% | 0% | 58% | 25% | 16%
target-spec0% | 0% | 100% | 0% | 0%
fixtures/workspace0% | 0% | 0% | 0% | 100%
internal-tools/benchmarks0% | 0% | 0% | 0% | 100%
workspace-hack0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
174 28 4
131 11 4
125 12 2
122 2 0
115 8 1
98 20 1
95 3 0
91 12 1
88 9 2
88 10 5
87 10 5
86 11 2
86 8 2
86 8 2
79 1 0
76 7 2
74 20 0
72 6 4
66 2 0
63 6 3
61 7 2
56 5 2
56 7 3
55 1 0
52 3 2
52 2 3
51 1 2
50 8 2
50 7 4
49 4 2
49 3 5
48 9 2
46 2 1
43 7 1
43 7 4
41 4 2
40 4 2
39 5 3
39 6 2
39 3 2
39 1 4
38 4 2
38 5 4
37 5 3
36 3 3
36 2 1
35 6 2
35 4 0
34 1 5
33 2 0