facebook / screenshot-tests-for-android
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 313 units with 2,518 lines of code in units (60.8% of code).
    • 1 very long units (113 lines of code)
    • 3 long units (172 lines of code)
    • 18 medium size units (489 lines of code)
    • 41 small units (601 lines of code)
    • 250 very small units (1,143 lines of code)
4% | 6% | 19% | 23% | 45%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java6% | 3% | 20% | 23% | 45%
py0% | 10% | 16% | 26% | 46%
kt0% | 37% | 21% | 20% | 20%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
core/src/main/java/com7% | 3% | 21% | 21% | 46%
plugin/src/py/android_screenshot_tests0% | 10% | 15% | 25% | 49%
plugin/src/main/kotlin/com0% | 52% | 0% | 27% | 20%
sample/src/main/java/com0% | 0% | 78% | 0% | 21%
layout-hierarchy-common/src/main/java/com0% | 0% | 40% | 38% | 21%
layout-hierarchy-litho/src/main/java/com0% | 0% | 0% | 58% | 41%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
113 11 1
69 12 1
52 16 1
51 12 0
38 9 1
35 5 1
33 11 2
31 4 1
31 10 2
29 2 1
29 1 1
27 12 2
27 7 1
26 4 4
25 6 2
25 4 1
24 7 2
23 4 1
23 4 2
21 3 4
21 5 3
21 5 4
20 5 1
20 8 1
20 4 4
20 3 3
19 8 4
19 5 6
18 3 3
17 4 0
17 4 0
17 8 1
17 3 4
17 5 3
17 1 0
16 5 4
15 2 1
15 6 0
15 1 2
15 2 1
14 2 1
14 4 0
14 3 1
14 2 0
14 5 0
13 3 0
13 3 2
13 3 1
13 4 1
13 6 2