microsoft / go-winio
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 526 units with 6,455 lines of code in units (79.5% of code).
    • 4 very long units (480 lines of code)
    • 13 long units (788 lines of code)
    • 53 medium size units (1,584 lines of code)
    • 113 small units (1,677 lines of code)
    • 343 very small units (1,926 lines of code)
7% | 12% | 24% | 25% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go7% | 12% | 24% | 25% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
backuptar66% | 0% | 23% | 8% | 1%
pkg/etw6% | 12% | 15% | 23% | 41%
wim18% | 18% | 39% | 7% | 15%
wim/lzx0% | 40% | 44% | 12% | 2%
pkg/security0% | 17% | 24% | 26% | 31%
vhd0% | 14% | 20% | 33% | 31%
ROOT0% | 3% | 26% | 36% | 33%
pkg/guid0% | 0% | 23% | 30% | 46%
pkg/etwlogrus0% | 0% | 61% | 0% | 38%
wim/validate0% | 0% | 0% | 97% | 2%
pkg/process0% | 0% | 0% | 46% | 53%
tools/etw-provider-gen0% | 0% | 0% | 93% | 6%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
142 41 5
119 28 3
func SmartField()
in pkg/etw/fieldopt.go
111 51 2
func()
in wim/wim.go
108 28 1
func main()
in pkg/etw/sample/sample.go
79 8 0
func newFn()
in pkg/etw/mksyscall_windows.go
71 17 1
func newFn()
in pkg/security/mksyscall_windows.go
71 17 1
func newFn()
in vhd/mksyscall_windows.go
71 17 1
func()
in wim/lzx/lzx.go
59 17 1
56 9 4
func()
in pkg/etw/mksyscall_windows.go
56 12 1
func()
in pkg/security/mksyscall_windows.go
56 12 1
func()
in vhd/mksyscall_windows.go
56 12 1
func()
in wim/wim.go
55 11 1
func buildTable()
in wim/lzx/lzx.go
54 13 1
func()
in wim/lzx/lzx.go
52 12 1
func()
in wim/wim.go
52 12 1
func()
in pkg/etw/mksyscall_windows.go
48 12 1
func()
in pkg/security/mksyscall_windows.go
48 12 1
func()
in vhd/mksyscall_windows.go
48 12 1