golang / mobile
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,441 units with 23,896 lines of code in units (67.1% of code).
    • 18 very long units (4,552 lines of code)
    • 52 long units (3,576 lines of code)
    • 199 medium size units (6,091 lines of code)
    • 411 small units (5,784 lines of code)
    • 761 very small units (3,893 lines of code)
19% | 14% | 25% | 24% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go18% | 15% | 26% | 24% | 14%
c79% | 0% | 5% | 3% | 11%
java0% | 6% | 25% | 31% | 36%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
gl32% | 1% | 5% | 46% | 14%
cmd25% | 27% | 27% | 12% | 7%
internal18% | 21% | 36% | 13% | 9%
app35% | 8% | 25% | 10% | 20%
bind7% | 25% | 39% | 17% | 11%
exp0% | 5% | 23% | 17% | 52%
example0% | 7% | 32% | 30% | 28%
event0% | 0% | 23% | 40% | 35%
asset0% | 0% | 0% | 17% | 82%
geom0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in gl/gldebug.go
1188 592 1
519 161 2
func UnmarshalXML()
in internal/binres/binres.go
402 89 2
func convAndroidKeyCode()
in app/android.go
315 212 1
func fixFloat()
in gl/work_windows.go
297 145 4
func goAndroidBuild()
in cmd/gomobile/build_androidapp.go
228 56 2
func convVirtualKeyCode()
in app/darwin_desktop.go
228 112 1
func goAppleBind()
in cmd/gomobile/bind_iosapp.go
185 35 3
func main()
in gl/gendebug.go
144 35 0
func genPkg()
in cmd/gobind/gen.go
141 16 6
func()
in bind/genjava.go
127 32 1
func buildAAR()
in cmd/gomobile/bind_androidapp.go
122 30 4
func()
in internal/importers/java/java.go
118 32 1
func goAppleBuild()
in cmd/gomobile/build_apple.go
114 27 3
func()
in internal/importers/java/java.go
112 33 1
func()
in bind/genjava.go
105 28 1
func()
in bind/genobjcw.go
104 29 1
func()
in bind/genobjc.go
103 23 1
func run()
in cmd/gobind/main.go
98 24 0
func envInit()
in cmd/gomobile/env.go
97 20 0