chore: resolve golangci-lint v2.12.1 goconst findings#172
Conversation
Replace 50 repeated string literals across pkg/argo, pkg/prompts, pkg/resources, and pkg/tools with named constants — using existing Kind*, Phase*, and OutputFormat* constants where they already existed, and introducing template-type, node-status, JSON-key, and config constants where none did. Also rename a couple of slog field names from "default" to "fallback" to keep their intent clear. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (20)
WalkthroughThis pull request standardizes string literals across the codebase by introducing internal constants for configuration values, MIME types, JSON keys, workflow phases, manifest kinds, and node/template types. It also adds error pattern tracking capabilities and UTF-8-safe log truncation to enhance workflow diagnostics. ChangesConstants and Configuration Standardization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
goconstviolations reported by golangci-lint v2.12.1 (the version pinned in.github/workflows/ci.yml).KindWorkflow,KindWorkflowTemplate,KindClusterWorkflowTemplate,KindCronWorkflow,OutputFormatJSON,OutputFormatYAML,PhasePending) and introduce new ones for repeated strings: workflow phases (PhaseRunning,PhaseSucceeded,PhaseFailed,PhaseUnknown), template types (templateType*), graph node statuses (nodeStatus*), JSON resource keys (jsonKey*,mimeTypeJSON), the conventional Argo container name (containerMain), and a couple of error/IO strings in the prompts package."default"to"fallback"so the literal isn't reused with two different meanings (and the namespace use-case gets a properdefaultNamespaceconstant).Test plan
make lint(with golangci-lint v2.12.1) —0 issuesmake test— all packages pass with race detectionmake vet— cleanmake fmt— no diffsSummary by CodeRabbit
New Features
Improvements