golang / playground
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 153 units with 2,369 lines of code in units (59.2% of code).
    • 1 very long units (102 lines of code)
    • 10 long units (646 lines of code)
    • 20 medium size units (660 lines of code)
    • 36 small units (518 lines of code)
    • 86 very small units (443 lines of code)
4% | 27% | 27% | 21% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go4% | 27% | 27% | 21% | 18%
js0% | 0% | 53% | 28% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sandbox20% | 26% | 12% | 22% | 17%
ROOT0% | 36% | 25% | 15% | 21%
internal/gcpdial0% | 0% | 46% | 46% | 7%
internal/metrics0% | 0% | 59% | 17% | 23%
internal0% | 0% | 76% | 23% | 0%
static0% | 0% | 53% | 28% | 17%
cmd/latestgo0% | 0% | 0% | 100% | 0%
cmd/redirect0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func runHandler()
in sandbox/sandbox.go
102 16 2
func sandboxBuild()
in sandbox.go
96 25 4
func startContainer()
in sandbox/sandbox.go
80 10 1
func getTestProg()
in sandbox.go
68 27 1
func()
in tests.go
66 18 1
func()
in sandbox.go
61 17 1
func()
in edit.go
61 14 1
func main()
in main.go
55 12 0
func decode()
in play.go
54 11 2
53 11 2
func main()
in sandbox/sandbox.go
52 9 0
func sandboxRun()
in sandbox.go
44 9 3
43 10 2
func()
in fmt.go
43 10 1
func runInGvisor()
in sandbox/sandbox.go
42 10 0
func()
in internal/gcpdial/gcpdial.go
40 10 1
func WaitOrStop()
in internal/internal.go
39 11 4
38 13 1
func NewService()
in internal/metrics/service.go
35 8 2
func()
in share.go
35 7 1