kubernetes / k8s.io
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 112 units with 1,494 lines of code in units (1.7% of code).
    • 0 very long units (0 lines of code)
    • 5 long units (296 lines of code)
    • 18 medium size units (565 lines of code)
    • 19 small units (249 lines of code)
    • 70 very small units (384 lines of code)
0% | 19% | 37% | 16% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 29% | 36% | 13% | 21%
py0% | 0% | 41% | 23% | 35%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
groups0% | 31% | 33% | 13% | 22%
apps0% | 0% | 35% | 23% | 40%
dns0% | 0% | 59% | 23% | 16%
artifactserver0% | 0% | 73% | 16% | 10%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in groups/service.go
67 18 1
func main()
in groups/reconcile.go
62 12 0
func()
in groups/service.go
60 13 1
func()
in groups/service.go
55 16 1
func()
in groups/reconcile.go
52 10 1
func()
in groups/reconcile.go
47 12 1
def test_go()
in apps/k8s-io/test.py
42 2 1
func NewAugmentedFakeAdminServiceClient()
in groups/fake/fake_client.go
42 1 0
def verify_dns()
in dns/check-zone.py
41 12 1
func()
in groups/service.go
40 11 1
func()
in groups/service.go
40 10 1
func()
in artifactserver/cmd/artifactserver/main.go
34 9 1
func()
in groups/service.go
31 8 1
func NewAugmentedFakeGroupServiceClient()
in groups/fake/fake_client.go
30 1 0
def main()
in dns/check-zone.py
27 6 0
func()
in groups/reconcile.go
27 5 1
func()
in groups/reconcile.go
26 7 1
func run()
in artifactserver/cmd/artifactserver/main.go
25 3 0
def test_dl()
in apps/k8s-io/test.py
25 3 1
func()
in groups/reconcile.go
24 6 1