You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix go:S1192: String literals should not be duplicated #416
Sonar rule go:S1192 flags string literals that appear 3+ times in a package, requiring them to be extracted as named constants to reduce duplication and simplify future refactoring.
Changes
Extracted "(/|$)(.*)" → ingressPathSuffix constant in kaoto_controller_action_expose_ingress.go
Extracted "Failure" → reasonFailure constant in a new shared constants.go (used across kaoto_controller.go, kaoto_controller_action_deploy.go, kaoto_controller_action_expose_ingress.go, kaoto_controller_action_expose_route.go, kaoto_controller_action_expose_service.go)
Re-enabled the goconst linter in .golangci.yml (it was disabled since the initial setup commit with no documented reason; the ignore-tests: true setting was already pre-configured, indicating the intent to use it)
Prevention: go:S1192 — String literals should not be duplicated
Go equivalent: goconst linter (autofixable: no)
Previously enabled in repo: no (explicitly disabled in .golangci.yml)
Status after this PR: enabled — goconst is now active and will catch future occurrences at lint time
Activity
fix(sonar): resolve go:S1192 string literals should not be duplicated