facebookincubator / CG-SQL
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,188 units with 22,520 lines of code in units (72.4% of code).
    • 25 very long units (4,079 lines of code)
    • 62 long units (4,256 lines of code)
    • 204 medium size units (6,317 lines of code)
    • 307 small units (4,381 lines of code)
    • 590 very small units (3,487 lines of code)
18% | 18% | 28% | 19% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c18% | 18% | 27% | 19% | 15%
py0% | 25% | 50% | 13% | 10%
m0% | 72% | 0% | 17% | 10%
js0% | 0% | 25% | 68% | 5%
java0% | 0% | 16% | 0% | 83%
h0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sources19% | 19% | 27% | 19% | 14%
sources/linetester36% | 14% | 44% | 4% | 0%
sources/cqljson0% | 29% | 50% | 12% | 8%
sources/tester0% | 18% | 56% | 19% | 5%
sources/cqlrt_cf0% | 21% | 0% | 5% | 73%
sources/grammar_docs0% | 0% | 32% | 46% | 20%
website/src0% | 0% | 32% | 67% | 0%
sources/java0% | 0% | 15% | 0% | 85%
website/plugins0% | 0% | 0% | 73% | 26%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
407 70 1
352 45 1
222 41 1
214 46 5
199 19 1
177 44 5
165 53 2
164 25 11
156 32 5
155 23 1
150 1 0
148 1 1
134 14 1
134 27 6
133 39 2
128 25 3
126 27 4
120 32 9
119 26 3
119 17 1
118 9 1
111 11 4
111 17 2
109 10 3
108 23 2
100 20 10
100 12 3
97 30 1
97 14 2
94 18 2
92 29 3
91 22 2
91 23 2
84 21 4
81 18 5
79 18 1
78 16 3
77 1 1
76 1 1
76 16 2
75 8 3
75 1 1
75 11 3
75 16 1
74 8 3
74 1 1
74 1 1
74 1 1
74 15 2
74 7 1