facebookincubator / antlir
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,583 units with 15,233 lines of code in units (36.0% of code).
    • 8 very long units (1,036 lines of code)
    • 32 long units (2,102 lines of code)
    • 132 medium size units (4,108 lines of code)
    • 189 small units (2,782 lines of code)
    • 1,222 very small units (5,205 lines of code)
6% | 13% | 26% | 18% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs9% | 15% | 29% | 17% | 27%
py4% | 10% | 25% | 18% | 40%
c0% | 66% | 0% | 29% | 3%
js0% | 49% | 0% | 13% | 37%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
metalos/lib11% | 7% | 22% | 16% | 41%
antlir/nspawn_in_subvol23% | 20% | 14% | 15% | 26%
antlir/bzl23% | 0% | 34% | 24% | 17%
antlir/btrfs_diff11% | 10% | 10% | 17% | 49%
metalos/metalctl0% | 49% | 30% | 13% | 6%
antlir/rpm0% | 11% | 30% | 16% | 41%
antlir0% | 8% | 28% | 22% | 40%
antlir/compiler0% | 10% | 36% | 21% | 31%
tools/testinfra0% | 98% | 0% | 0% | 1%
antlir/vm0% | 14% | 22% | 18% | 44%
antlir/website0% | 40% | 0% | 23% | 36%
metalos/host_configs0% | 0% | 60% | 17% | 22%
metalos/os0% | 0% | 34% | 65% | 0%
metalos/metalos_macros0% | 0% | 0% | 72% | 27%
antlir/proxy0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
226 10 6
139 5 1
118 27 1
117 3 1
114 6 0
112 1 0
108 4 6
102 1 1
100 1 1
91 10 1
85 28 2
83 2 3
80 1 0
76 11 0
76 4 0
75 6 2
73 1 0
73 1 0
72 18 2
71 10 2
66 1 1
64 1 0
63 23 2
62 1 0
60 7 1
60 6 1
59 1 0
58 23 2
58 4 4
58 5 2
57 1 2
55 2 2
55 6 1
55 1 0
55 1 0
53 3 0
53 1 1
52 8 1
52 6 3
52 25 1
50 2 1
50 2 1
49 19 2
49 9 0
49 1 0
48 9 1
48 1 5
47 4 3
46 1 0
45 1 2