facebookincubator / contest
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 754 units with 9,449 lines of code in units (73.0% of code).
    • 8 very long units (1,116 lines of code)
    • 18 long units (1,206 lines of code)
    • 90 medium size units (2,737 lines of code)
    • 140 small units (2,055 lines of code)
    • 498 very small units (2,335 lines of code)
11% | 12% | 28% | 21% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go11% | 12% | 28% | 21% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/runner48% | 10% | 26% | 10% | 3%
plugins/teststeps9% | 21% | 36% | 14% | 18%
cmds/contest67% | 0% | 16% | 13% | 3%
plugins/listeners63% | 0% | 0% | 26% | 10%
plugins/targetlocker23% | 18% | 16% | 21% | 20%
cmds/clients57% | 0% | 16% | 16% | 8%
plugins/storage10% | 22% | 28% | 12% | 26%
pkg/jobmanager13% | 19% | 38% | 15% | 12%
plugins/targetmanagers0% | 53% | 13% | 13% | 19%
db/rdbms0% | 39% | 50% | 0% | 10%
cmds/exec_agent0% | 20% | 32% | 21% | 25%
pkg/xcontext0% | 3% | 24% | 34% | 38%
cmds/contest-generator0% | 0% | 58% | 24% | 17%
pkg/api0% | 0% | 38% | 34% | 26%
tools/migration0% | 0% | 85% | 0% | 14%
pkg/transport0% | 0% | 48% | 51% | 0%
plugins/testfetchers0% | 0% | 70% | 0% | 29%
pkg/lib0% | 0% | 61% | 0% | 38%
plugins/reporters0% | 0% | 42% | 0% | 57%
pkg/pluginregistry0% | 0% | 10% | 88% | 1%
pkg/job0% | 0% | 0% | 62% | 37%
pkg/storage0% | 0% | 0% | 22% | 77%
pkg/config0% | 0% | 0% | 100% | 0%
pkg/event0% | 0% | 0% | 8% | 91%
pkg/logging0% | 0% | 0% | 0% | 100%
pkg/cerrors0% | 0% | 0% | 0% | 100%
pkg/types0% | 0% | 0% | 0% | 100%
pkg/userfunctions0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
236 43 1
167 40 1
159 36 4
119 25 1
115 34 1
113 29 3
104 18 1
103 21 1
92 27 1
90 22 4
90 19 1
81 16 4
80 17 1
74 20 5
68 15 2
64 14 1
63 14 1
61 15 1
60 9 1
57 16 1
56 13 1
56 16 7
55 12 1
54 18 1
53 11 1
52 12 1
50 11 1
47 8 1
47 7 1
47 7 1
47 8 1
46 12 1
42 10 0
40 11 1
40 8 1
40 9 1
40 8 1
39 8 1
39 9 1
39 9 0
39 9 1
39 11 1
39 5 2
38 8 4
38 8 1
38 11 0
38 12 2
38 8 1
38 14 1
37 14 2