Skip to content

refactor(common,registry,controller,cni): reduce cognitive complexity to <=15 (part of #556) - #560

Merged
bpalermo merged 1 commit into
mainfrom
refactor/cognit-lane6-common-misc
Jul 19, 2026
Merged

bpalermo merged 1 commit into
mainfrom
refactor/cognit-lane6-common-misc

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Summary

Reduces gocognit cognitive complexity to ≤15 for all non-test functions in scope (Lane 6 of #556). Structure-only refactor — zero behavior change.

Per-function extraction summary

Function File Before After Extracted helpers
ValidateSpec common/extensionfilter/extensionfilter.go 68 ≤15 validateFormCount, validateScope, validateTypedForms, validateRBACForm, validateRBACPolicy, validateOpaqueForm
Render common/extensionfilter/extensionfilter.go 20 ≤15 renderRBACPerRoute, renderExtAuthzPerRoute, renderHeaderToMetadata
ProjectHTTPRule common/gammaproject/project.go 22 ≤15 httpRouteTimeout, projectHTTPMatches, collectHTTPExtensionFilters
ProjectGRPCRule common/gammaproject/project.go 37 ≤15 projectGRPCMatches, applyGRPCMethodMatch, collectGRPCExtensionFilters
(*Server).Start common/xds/server.go 18 ≤15 listen
AtomicWriteReader common/file/file.go 16 ≤15 joinErrors
(*DynamoDBRegistry).ListAllEndpoints registry/internal/ddb/dynamodb.go 18 ≤15 collectPageEndpoints
(*RegistrarRegistry).processStream registry/internal/registrar/registrar.go 29 ≤15 handleStreamError, handleCatalogEvent
(*Validator).checkChainConflict controller/internal/httpfilter/webhook.go 20 ≤15 chainTargetServices, findChainConflict
(*CABundleInjector).inject controller/internal/meshconfig/cabundle.go 16 ≤15 injectValidating, injectMutating
podExcludedOutboundIPRanges cni/internal/plugin/plugin.go 16 ≤15 parseIPv4RangeEntry
getCNIConfigFilepath cni/internal/install/cniconfig.go 16 ≤15 resolveConfName, waitForConfigFile
BuildOutboundServiceVirtualHost agent/internal/xds/proxy/route.go 16 ≤15 buildScoredRoutes (+ scoredRoute type promoted to package level)

Verification

  • $BIN -over 15 <all scope dirs> excluding _test.go → empty output
  • All 21 test targets in scope pass
  • make gazelle && make format clean

Part of #556

🤖 Generated with Claude Code

https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR

… to <=15 (part of #556)

Extract nested blocks to named helpers across 11 files to bring all
non-test functions in scope to gocognit <=15. Zero behavior change:
identical error strings, log messages, and event-handling order.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR
@bpalermo
bpalermo merged commit bbd4ba8 into main Jul 19, 2026
14 checks passed
@bpalermo
bpalermo deleted the refactor/cognit-lane6-common-misc branch July 19, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant