Skip to content

Fix all golangci-lint warnings with extended linters#12

Merged
andrew merged 1 commit intomainfrom
fix/lint-quality-checks
Mar 26, 2026
Merged

Fix all golangci-lint warnings with extended linters#12
andrew merged 1 commit intomainfrom
fix/lint-quality-checks

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented Mar 18, 2026

Resolves all 52 warnings from golangci-lint run with gocritic, gocognit, gocyclo, maintidx, dupl, mnd, unparam, ireturn, goconst, and errcheck enabled.

  • Extract magic numbers to named constants (HTTP timeouts, retry params, connection pool sizes, backoff factors)
  • Use net/http status constants instead of raw integers
  • Fix potential panic in hackage cabal dependency parser where strings.Index could return -1
  • Refactor parseCabalFile to reduce cognitive complexity from 35 to under 30
  • Rewrite if-else chain as switch statement in urlparser
  • Use strings.Cut where it replaces SplitN+len checks
  • Add nolint directives for idiomatic Go patterns and intentional interface returns

Extract magic numbers to named constants for timeouts, retry
params, connection pool sizes, and backoff factors. Use net/http
status constants instead of raw integers. Fix potential panic in
hackage cabal dependency parser where strings.Index could return
-1. Refactor parseCabalFile to reduce cognitive complexity by
extracting helper functions. Rewrite if-else chain as switch in
urlparser. Use strings.Cut where appropriate. Add nolint directives
for idiomatic patterns (SplitN with 2, interface returns from
factory functions).
@andrew andrew merged commit cb96d95 into main Mar 26, 2026
2 checks passed
@andrew andrew deleted the fix/lint-quality-checks branch March 26, 2026 09:24
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