facebook / watchman
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,248 units with 30,471 lines of code in units (57.4% of code).
    • 25 very long units (3,376 lines of code)
    • 69 long units (4,523 lines of code)
    • 312 medium size units (9,615 lines of code)
    • 442 small units (6,446 lines of code)
    • 1,400 very small units (6,511 lines of code)
11% | 14% | 31% | 21% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp17% | 17% | 34% | 18% | 12%
py1% | 10% | 31% | 25% | 31%
rs7% | 5% | 15% | 24% | 47%
c0% | 26% | 47% | 13% | 12%
java0% | 13% | 24% | 35% | 26%
js0% | 16% | 29% | 27% | 26%
h0% | 0% | 9% | 26% | 63%
rb0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
watchman12% | 17% | 30% | 21% | 16%
watchman/watcher25% | 19% | 25% | 13% | 15%
watchman/root29% | 7% | 42% | 13% | 6%
watchman/winbuild40% | 16% | 19% | 14% | 10%
watchman/query14% | 12% | 32% | 18% | 22%
watchman/cmds15% | 15% | 44% | 19% | 5%
watchman/integration16% | 0% | 9% | 28% | 45%
build/fbcode_builder2% | 11% | 36% | 22% | 28%
watchman/rust7% | 5% | 16% | 24% | 46%
watchman/fs0% | 46% | 26% | 10% | 16%
watchman/python0% | 13% | 29% | 28% | 28%
watchman/java0% | 13% | 24% | 35% | 26%
watchman/node0% | 17% | 31% | 26% | 25%
watchman/ruby0% | 20% | 43% | 14% | 22%
watchman/scm0% | 11% | 59% | 21% | 7%
watchman/cppclient0% | 0% | 51% | 25% | 23%
watchman/build0% | 0% | 100% | 0% | 0%
watchman/saved_state0% | 0% | 70% | 0% | 29%
watchman/cli0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
216 62 3
178 28 7
173 30 6
162 25 2
152 19 2
148 24 1
147 24 1
145 24 4
144 30 0
142 20 0
138 24 4
131 20 4
128 13 3
126 15 0
124 29 3
123 30 4
120 10 0
115 23 2
113 31 5
112 1 0
111 20 6
109 19 4
107 24 6
106 33 5
106 14 2
99 14 0
99 14 0
99 29 2
94 19 2
90 12 0
89 5 1
86 20 3
84 21 2
84 26 2
84 17 2
81 10 1
80 21 3
79 12 1
78 1 1
78 7 0
76 25 4
74 6 1
74 11 1
74 22 0
73 12 1
73 19 2
69 18 2
68 8 4
67 28 2
66 15 3