facebook / relay
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,341 units with 39,818 lines of code in units (47.7% of code).
    • 31 very long units (4,706 lines of code)
    • 118 long units (7,960 lines of code)
    • 405 medium size units (12,584 lines of code)
    • 520 small units (7,624 lines of code)
    • 1,267 very small units (6,944 lines of code)
11% | 19% | 31% | 19% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs13% | 19% | 31% | 18% | 17%
js2% | 24% | 32% | 20% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
compiler/crates13% | 19% | 31% | 18% | 17%
packages/relay-runtime3% | 22% | 35% | 21% | 17%
website/src0% | 55% | 14% | 14% | 14%
scripts0% | 25% | 29% | 15% | 29%
packages/babel-plugin-relay0% | 0% | 28% | 61% | 9%
ROOT0% | 0% | 30% | 14% | 55%
website0% | 0% | 0% | 23% | 76%
scripts/jest0% | 0% | 0% | 0% | 100%
packages/react-relay0% | 0% | 0% | 0% | 100%
compiler/test-project0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
324 15 4
280 3 4
231 25 2
218 19 2
206 23 4
192 23 4
181 11 2
174 20 11
167 19 3
167 19 1
152 37 2
147 17 4
138 15 4
137 11 2
135 12 3
132 10 4
132 5 3
132 12 4
129 8 5
128 16 4
121 1 4
118 5 2
116 18 3
113 1 1
108 8 4
106 1 0
106 15 3
105 10 2
105 7 4
104 11 5
102 10 6
99 10 2
97 6 3
96 13 3
95 11 3
93 7 8
92 8 3
92 11 2
91 1 2
90 9 3
90 6 2
90 9 8
90 8 3
89 8 2
87 11 4
87 18 0
86 4 4
85 12 2
85 10 3
84 8 6