kubernetes / ingress-gce
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 2,309 units with 29,865 lines of code in units (77.5% of code).
    • 10 very long units (1,492 lines of code)
    • 55 long units (3,612 lines of code)
    • 310 medium size units (9,944 lines of code)
    • 462 small units (6,655 lines of code)
    • 1,472 very small units (8,162 lines of code)
4% | 12% | 33% | 22% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go4% | 12% | 33% | 22% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/fuzz27% | 5% | 21% | 21% | 24%
pkg/neg5% | 15% | 31% | 26% | 21%
pkg/controller14% | 10% | 33% | 31% | 10%
cmd/glbc21% | 15% | 35% | 19% | 8%
pkg/apis3% | 29% | 29% | 9% | 27%
pkg/backends9% | 4% | 44% | 25% | 16%
pkg/loadbalancers5% | 29% | 31% | 22% | 11%
pkg/flags65% | 0% | 0% | 8% | 26%
pkg/l4lb0% | 26% | 36% | 11% | 25%
pkg/experimental0% | 9% | 28% | 27% | 33%
pkg/composite0% | 4% | 62% | 1% | 31%
pkg/metrics0% | 30% | 35% | 6% | 27%
pkg/firewalls0% | 24% | 19% | 25% | 31%
pkg/psc0% | 19% | 39% | 27% | 13%
cmd/fuzzer0% | 57% | 15% | 11% | 15%
pkg/context0% | 26% | 47% | 15% | 10%
cmd/404-server-with-metrics0% | 35% | 25% | 30% | 8%
pkg/healthchecks0% | 0% | 71% | 19% | 8%
pkg/translator0% | 0% | 58% | 31% | 10%
pkg/utils0% | 0% | 14% | 33% | 52%
cmd/e2e-test0% | 0% | 42% | 28% | 28%
pkg/instances0% | 0% | 41% | 32% | 25%
pkg/backendconfig0% | 0% | 15% | 40% | 44%
cmd/echo0% | 0% | 73% | 9% | 17%
pkg/crd0% | 0% | 58% | 33% | 7%
pkg/serviceattachment0% | 0% | 10% | 39% | 50%
pkg/cmconfig0% | 0% | 59% | 21% | 18%
pkg/ratelimit0% | 0% | 74% | 16% | 8%
pkg/sync0% | 0% | 73% | 22% | 4%
cmd/workload-controller0% | 0% | 61% | 15% | 22%
pkg/svcneg0% | 0% | 8% | 42% | 49%
pkg/frontendconfig0% | 0% | 8% | 42% | 48%
pkg/ingparams0% | 0% | 9% | 37% | 53%
pkg/storage0% | 0% | 35% | 27% | 37%
cmd/workload-daemon0% | 0% | 90% | 0% | 9%
pkg/common0% | 0% | 7% | 34% | 57%
pkg/annotations0% | 0% | 9% | 40% | 50%
cmd/404-server0% | 0% | 0% | 74% | 26%
pkg/events0% | 0% | 0% | 75% | 25%
pkg/klog0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func GCLBForVIP()
in pkg/fuzz/gcp.go
229 63 3
func RegionalGCLBForVIP()
in pkg/fuzz/gcp.go
226 63 4
func NewController()
in pkg/neg/controller.go
202 15 13
func NewLoadBalancerController()
in pkg/controller/controller.go
173 20 2
func main()
in cmd/glbc/main.go
126 27 0
func schema_pkg_apis_backendconfig_v1_CDNConfig()
in pkg/apis/backendconfig/v1/zz_generated.openapi.go
110 1 1
func renderConfig()
in pkg/backends/features/cdn.go
109 25 1
func()
in pkg/fuzz/gcp.go
109 40 1
func()
in pkg/loadbalancers/l4.go
107 16 1
func Register()
in pkg/flags/flags.go
101 14 0
func()
in pkg/psc/controller.go
98 18 1
func featuresForIngress()
in pkg/metrics/features.go
95 31 2
func schema_pkg_apis_serviceattachment_v1_ServiceAttachmentSpec()
in pkg/apis/serviceattachment/v1/zz_generated.openapi.go
94 1 1
func ensureNetworkEndpointGroup()
in pkg/neg/syncers/utils.go
93 22 13
func runControllers()
in cmd/glbc/main.go
90 10 1
func schema_pkg_apis_serviceattachment_v1beta1_ServiceAttachmentSpec()
in pkg/apis/serviceattachment/v1beta1/zz_generated.openapi.go
90 1 1
func()
in pkg/apis/backendconfig/v1/zz_generated.deepcopy.go
82 19 1
func()
in pkg/neg/manager.go
80 12 1
func()
in pkg/loadbalancers/forwarding_rules.go
80 14 1
func()
in pkg/neg/manager.go
79 18 1