Add gosec + correctness linters to golangci-lint - #16
Conversation
Enable a stronger linter set befitting a security-adjacent tool: gosec (SAST), errorlint, bodyclose, nilerr, unconvert, usestdlibvars. Annotate the deliberate patterns gosec/nilerr flag, each with a scoped //nolint and a justification rather than a blanket disable: - explain: EXPLAIN string concatenation (G202) — no bind params exist; the defense is validate() + the rolled-back read-only tx. - config.Load: reading the .sqlguard.yml path the caller pointed at (G304). - pg/mysql parsers: return the best-effort fallback Statement (not an error) on parse failure, by contract (nilerr). - scanner: skip an unparseable Go file and keep walking (nilerr). Exclude gosec from _test.go (lax fixture perms / ignored setup errors), mirroring the existing errcheck exclusion. gosec G115 is excluded globally (noisy on deliberate range-checked int conversions).
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
WalkthroughThis PR expands ChangesLint hardening and suppressions
Estimated code review effort: 1 (Trivial) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 59 minutes. |
Enable a stronger linter set befitting a security-adjacent tool: gosec (SAST), errorlint, bodyclose, nilerr, unconvert, usestdlibvars.
Annotate the deliberate patterns gosec/nilerr flag, each with a scoped //nolint and a justification rather than a blanket disable:
Exclude gosec from _test.go (lax fixture perms / ignored setup errors), mirroring the existing errcheck exclusion. gosec G115 is excluded globally (noisy on deliberate range-checked int conversions).
Summary
What does this PR change, and why?
Closes #
Type of change
Checklist
make cipasses (fmt-check, vet, lint, test-race) across all modulesREADME.md,CLAUDE.md,.sqlguard.example.yml)## [Unreleased]inCHANGELOG.mdanalyzer/middleware/reporterResult)Notes for reviewers
Anything reviewers should focus on — tricky areas, trade-offs, follow-ups.
Summary by CodeRabbit