bottlerocket-os / bottlerocket-update-operator
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 160 units with 1,644 lines of code in units (55.3% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (142 lines of code)
    • 15 medium size units (451 lines of code)
    • 33 small units (464 lines of code)
    • 110 very small units (587 lines of code)
0% | 8% | 27% | 28% | 35%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 8% | 27% | 28% | 35%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/agent0% | 21% | 19% | 39% | 18%
pkg/controller0% | 19% | 47% | 14% | 17%
pkg/platform0% | 0% | 25% | 28% | 45%
ROOT0% | 0% | 73% | 0% | 26%
pkg/sigcontext0% | 0% | 100% | 0% | 0%
pkg/nodestream0% | 0% | 34% | 0% | 65%
pkg/intent0% | 0% | 10% | 44% | 45%
pkg/k8sutil0% | 0% | 0% | 81% | 18%
pkg/marker0% | 0% | 0% | 100% | 0%
pkg/internal0% | 0% | 0% | 13% | 86%
pkg/logging0% | 0% | 0% | 47% | 52%
pkg/workgroup0% | 0% | 0% | 0% | 100%
pkg/bottlerocket0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in pkg/agent/agent.go
75 17 1
func()
in pkg/controller/manager.go
67 15 1
func main()
in main.go
44 13 0
func()
in pkg/controller/manager.go
38 10 1
func New()
in pkg/agent/agent.go
37 7 3
func newPolicyCheck()
in pkg/controller/policy.go
36 7 2
func()
in pkg/controller/manager.go
35 12 1
func()
in pkg/agent/agent.go
30 6 1
func()
in pkg/platform/updog/updog.go
30 6 1
func()
in pkg/controller/manager.go
29 6 1
func WithSignalCancel()
in pkg/sigcontext/sigcontext.go
28 5 2
func()
in pkg/controller/policy.go
28 7 1
func()
in pkg/nodestream/config.go
26 6 1
func()
in pkg/platform/api/api.go
26 8 1
func()
in pkg/intent/intent.go
22 14 1
func()
in pkg/platform/api/platform.go
21 8 1
func()
in pkg/platform/api/platform.go
21 7 1
func()
in pkg/agent/agent.go
20 3 1
func PostMetadata()
in pkg/k8sutil/marker.go
20 4 3
func()
in pkg/agent/agent.go
19 5 1