facebook / infer
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 1,468 units with 8,856 lines of code in units (4.3% of code).
    • 1 very long units (149 lines of code)
    • 6 long units (428 lines of code)
    • 41 medium size units (1,262 lines of code)
    • 111 small units (1,540 lines of code)
    • 1,309 very small units (5,477 lines of code)
1% | 4% | 14% | 17% | 61%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js87% | 0% | 12% | 0% | 0%
h0% | 12% | 30% | 22% | 34%
java0% | 0% | 3% | 8% | 88%
cpp0% | 0% | 35% | 50% | 14%
c0% | 0% | 0% | 18% | 81%
py0% | 0% | 0% | 36% | 63%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
website/src87% | 0% | 12% | 0% | 0%
facebook-clang-plugins/libtooling0% | 11% | 30% | 24% | 33%
infer/models0% | 0% | 1% | 12% | 85%
infer/annotations0% | 0% | 0% | 0% | 100%
infer/src0% | 0% | 0% | 0% | 100%
sledge/model0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
149 5 0
87 20 1
81 15 1
69 16 1
66 11 1
65 14 1
60 11 1
50 11 1
49 10 1
48 10 1
47 12 1
43 10 1
41 12 1
40 13 1
40 7 1
39 8 2
38 7 1
34 4 1
34 4 1
32 5 1
32 6 1
32 7 1
32 6 1
32 9 1
31 7 1
29 9 1
28 7 1
28 10 1
28 10 1
28 7 1
27 4 1
26 5 1
26 5 1
26 5 1
25 4 1
24 10 2
24 1 10
24 1 10
24 8 5
24 9 1
24 5 1
23 1 9
23 5 1
22 1 0
22 2 1
21 6 1
21 4 1
21 4 1
20 4 1
20 3 1