kubernetes / ingress-nginx
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 734 units with 13,470 lines of code in units (49.3% of code).
    • 13 very long units (2,379 lines of code)
    • 28 long units (1,921 lines of code)
    • 141 medium size units (4,451 lines of code)
    • 186 small units (2,752 lines of code)
    • 366 very small units (1,967 lines of code)
17% | 14% | 33% | 20% | 14%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go18% | 14% | 32% | 20% | 13%
lua0% | 6% | 46% | 24% | 22%
py0% | 0% | 44% | 18% | 36%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
internal/ingress23% | 14% | 33% | 15% | 13%
cmd/nginx52% | 30% | 0% | 12% | 4%
cmd/plugin0% | 10% | 29% | 39% | 20%
images/custom-error-pages0% | 78% | 0% | 16% | 4%
cmd/dbg0% | 41% | 28% | 19% | 9%
images/kube-webhook-certgen0% | 14% | 40% | 31% | 13%
internal/net0% | 13% | 34% | 40% | 11%
rootfs/etc0% | 6% | 46% | 24% | 22%
internal/nginx0% | 0% | 41% | 47% | 11%
internal/admission0% | 0% | 89% | 0% | 10%
hack/boilerplate0% | 0% | 44% | 18% | 36%
internal/watch0% | 0% | 78% | 0% | 21%
internal/sets0% | 0% | 78% | 0% | 22%
internal/task0% | 0% | 30% | 31% | 38%
internal/k8s0% | 0% | 28% | 47% | 23%
internal/runtime0% | 0% | 0% | 88% | 11%
internal/file0% | 0% | 0% | 61% | 38%
cmd/waitshutdown0% | 0% | 0% | 100% | 0%
images/fastcgi-helloserver0% | 0% | 0% | 0% | 100%
version0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func New()
in internal/ingress/controller/store/store.go
461 76 11
func ReadConfig()
in internal/ingress/controller/template/configmap.go
261 56 1
func parseFlags()
in cmd/nginx/flags.go
260 44 0
func()
in internal/ingress/controller/controller.go
222 54 1
func()
in internal/ingress/controller/controller.go
207 40 1
func NewDefault()
in internal/ingress/controller/config/config.go
164 2 0
func()
in internal/ingress/controller/nginx.go
144 28 1
func()
in internal/ingress/types_equals.go
120 42 1
func()
in internal/ingress/controller/controller.go
118 24 1
func()
in internal/ingress/controller/controller.go
112 24 1
func NewNGINXController()
in internal/ingress/controller/nginx.go
104 12 2
func NewController()
in internal/ingress/metric/collectors/controller.go
103 2 3
func NewSocketCollector()
in internal/ingress/metric/collectors/socket.go
103 4 5
func()
in internal/ingress/metric/collectors/socket.go
92 18 1
func()
in internal/ingress/controller/store/backend_ssl.go
89 23 1
func()
in internal/ingress/controller/controller.go
87 24 1
func main()
in cmd/nginx/main.go
84 19 0
func()
in internal/ingress/annotations/authreq/main.go
80 19 1
func mergeAlternativeBackends()
in internal/ingress/controller/controller.go
76 21 3
func errorHandler()
in images/custom-error-pages/rootfs/main.go
75 12 2