mapillary / OpenSfM
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 2,972 units with 20,733 lines of code in units (52.6% of code).
    • 8 very long units (1,352 lines of code)
    • 24 long units (1,511 lines of code)
    • 170 medium size units (5,035 lines of code)
    • 325 small units (4,723 lines of code)
    • 2,445 very small units (8,112 lines of code)
6% | 7% | 24% | 22% | 39%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc20% | 7% | 27% | 21% | 22%
py2% | 5% | 24% | 20% | 46%
js5% | 5% | 24% | 30% | 34%
h0% | 13% | 25% | 26% | 34%
pyi0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
opensfm/src10% | 9% | 24% | 21% | 33%
opensfm4% | 9% | 16% | 17% | 52%
viewer/legacy18% | 0% | 37% | 28% | 15%
viewer/src3% | 8% | 20% | 28% | 39%
opensfm/actions0% | 0% | 51% | 27% | 20%
annotation_gui_gcp0% | 0% | 57% | 28% | 14%
annotation_gui_gcp/js0% | 0% | 28% | 39% | 31%
annotation_gui_gcp/lib0% | 0% | 27% | 30% | 41%
opensfm/large0% | 0% | 40% | 18% | 41%
opensfm/commands0% | 0% | 34% | 13% | 51%
opensfm/synthetic_data0% | 0% | 11% | 28% | 60%
ROOT0% | 0% | 0% | 51% | 48%
viewer0% | 0% | 0% | 24% | 75%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
433 73 0
165 21 6
148 22 5
145 21 5
129 11 1
117 9 2
114 11 3
101 1 1
91 11 1
85 21 2
76 11 1
72 14 2
71 10 0
71 12 3
71 2 4
62 7 1
62 21 2
62 3 4
61 12 4
61 10 3
59 26 0
59 10 3
57 9 1
57 8 1
57 11 3
56 14 1
55 2 4
54 11 5
53 1 0
53 9 3
53 11 1
53 11 1
50 11 4
49 2 0
48 11 4
46 13 1
46 7 3
46 12 3
45 1 0
45 1 1
44 2 4
44 7 6
43 6 1
43 5 1
43 14 5
43 9 7
43 3 0
43 9 1
42 10 4
42 14 1