Skip to content

Configure goconst to ignore test files#34

Merged
andrew merged 1 commit into
mainfrom
fix-npm-goconst
May 22, 2026
Merged

Configure goconst to ignore test files#34
andrew merged 1 commit into
mainfrom
fix-npm-goconst

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented May 22, 2026

Adds .golangci.yml with goconst.ignore-tests: true.

The 19 goconst warnings in internal/npm/npm_test.go are version strings ("1.1.3", "4.17.21") and package names ("@types/node", "babel") that repeat because separate test cases assert against fixtures that happen to share packages. Pulling those into shared constants would couple unrelated tests and make each assertion harder to read at a glance.

Using the goconst-level setting rather than a path exclusion because exclusions only filter where issues are reported, not which files contribute to the occurrence count, so a single production-code use of a string that appears twice more in tests would still be flagged.

Test tables repeat version strings and package names across independent fixtures. Extracting them into shared constants would couple unrelated tests and make the assertions harder to read, so skip test files instead.
@andrew andrew merged commit 640e94c into main May 22, 2026
5 checks passed
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