aws / aws-node-termination-handler
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 122 units with 2,388 lines of code in units (7.1% of code).
    • 1 very long units (178 lines of code)
    • 6 long units (388 lines of code)
    • 26 medium size units (857 lines of code)
    • 45 small units (665 lines of code)
    • 44 very small units (300 lines of code)
7% | 16% | 35% | 27% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go7% | 16% | 35% | 27% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
cmd53% | 0% | 20% | 16% | 10%
pkg/config0% | 63% | 15% | 14% | 6%
pkg/monitor0% | 17% | 57% | 10% | 15%
pkg/webhook0% | 74% | 25% | 0% | 0%
pkg/node0% | 9% | 33% | 43% | 12%
pkg/ec2metadata0% | 0% | 49% | 50% | 0%
pkg/observability0% | 0% | 42% | 42% | 14%
pkg/interruptioneventstore0% | 0% | 0% | 68% | 31%
pkg/uptime0% | 0% | 0% | 44% | 56%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func main()
in cmd/node-termination-handler.go
178 36 0
func()
in pkg/config/config.go
79 2 1
func Post()
in pkg/webhook/webhook.go
73 13 3
func ParseCliArgs()
in pkg/config/config.go
72 9 0
func()
in pkg/monitor/sqsevent/sqs-monitor.go
62 18 1
func()
in pkg/monitor/sqsevent/asg-lifecycle-event.go
51 8 1
func removeTaint()
in pkg/node/node.go
51 13 3
func addTaint()
in pkg/node/node.go
50 12 4
func()
in pkg/ec2metadata/ec2metadata.go
47 11 1
func InitK8sEventRecorder()
in pkg/observability/k8s-events.go
46 7 5
func()
in pkg/monitor/sqsevent/scheduled-change-event.go
45 8 1
func()
in pkg/node/node.go
43 10 1
func drainOrCordonIfNecessary()
in cmd/node-termination-handler.go
39 12 8
func()
in pkg/monitor/sqsevent/sqs-monitor.go
38 11 1
func()
in pkg/config/config.go
36 1 1
func()
in pkg/monitor/scheduledevent/scheduled-event-monitor.go
36 8 1
func()
in pkg/monitor/sqsevent/spot-itn-event.go
36 5 1
func()
in pkg/monitor/sqsevent/rebalance-recommendation-event.go
36 5 1
func()
in pkg/monitor/sqsevent/ec2-state-change-event.go
32 5 1
func()
in pkg/node/node.go
32 5 1