Description
GenerateNpmInstallStepsWithScope at pkg/workflow/nodejs.go:270 ends with four bool values (includeNodeSetup, isGlobal, runInstallScripts, cooldownEnabled) as positional parameters. These are indistinguishable at call sites without looking up the signature, making incorrect argument order a silent compile-time bug.
Suggested Changes
Introduce a NpmInstallOptions struct:
type NpmInstallOptions struct {
PackageName string
Version string
StepName string
CacheKeyPrefix string
IncludeNodeSetup bool
IsGlobal bool
RunInstallScripts bool
CooldownEnabled bool
}
Refactor GenerateNpmInstallStepsWithScope to accept (opts NpmInstallOptions) []GitHubActionStep.
Files Affected
pkg/workflow/nodejs.go (line 270 and all callers within pkg/workflow/)
Success Criteria
Source
Extracted from [repository-quality] Options Struct Pattern Adoption — discussion #46005
Priority
Medium — four consecutive unnamed booleans at call sites are a readability and correctness risk
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 117.9 AIC · ⌖ 7.65 AIC · ⊞ 7K · ◷
Description
GenerateNpmInstallStepsWithScopeatpkg/workflow/nodejs.go:270ends with fourboolvalues (includeNodeSetup, isGlobal, runInstallScripts, cooldownEnabled) as positional parameters. These are indistinguishable at call sites without looking up the signature, making incorrect argument order a silent compile-time bug.Suggested Changes
Introduce a
NpmInstallOptionsstruct:Refactor
GenerateNpmInstallStepsWithScopeto accept(opts NpmInstallOptions) []GitHubActionStep.Files Affected
pkg/workflow/nodejs.go(line 270 and all callers withinpkg/workflow/)Success Criteria
NpmInstallOptionsstruct definedGenerateNpmInstallStepsWithScoperefactoredpkg/workflow/updatedmake fmt && make lint && make testpassSource
Extracted from [repository-quality] Options Struct Pattern Adoption — discussion #46005
Priority
Medium — four consecutive unnamed booleans at call sites are a readability and correctness risk