Skip to content

fix: add pre-commit hook and full lint in CI#69

Merged
tito merged 1 commit intomainfrom
fix/lint-precommit-ci
Apr 1, 2026
Merged

fix: add pre-commit hook and full lint in CI#69
tito merged 1 commit intomainfrom
fix/lint-precommit-ci

Conversation

@tito
Copy link
Copy Markdown
Contributor

@tito tito commented Apr 1, 2026

Summary

  • Fixes missing //nolint:gosec on os.WriteFile(profilePath, ...) in the profiles edit command — same suppression pattern as every other use of profilePath in the same block, overlooked in feat: add profiles edit command #64
  • Adds scripts/pre-commit hook that runs gofumpt check + golangci-lint; installed automatically via make setup or make install-hooks
  • Replaces golangci-lint-action in CI (incremental/diff-only mode) with make fmt-check && make lint so the full codebase is always checked on every PR

Root cause

golangci-lint-action defaults to --new-from-rev (incremental mode), which only lints lines changed in the PR diff. If a nolint comment is missing on a line that wasn't directly touched, it slips through. Running golangci-lint run directly always scans the full tree.

Test plan

  • make fmt-check passes
  • make lint passes (0 issues)
  • make install-hooks copies scripts/pre-commit to .git/hooks/pre-commit
  • CI lint job runs make fmt-check && make lint (check workflow diff)

- Fix missing nolint:gosec comment on os.WriteFile in profiles edit
  command (same pattern as other uses of profilePath in the same block)
- Add scripts/pre-commit hook that runs gofumpt check + golangci-lint;
  installed automatically via make setup or make install-hooks
- Add fmt-check Makefile target (non-destructive, suitable for CI)
- Replace golangci-lint-action in CI with make install-lint-tools &&
  make fmt-check && make lint so the full codebase is always checked
  rather than only diff-incremental lines
@tito tito merged commit 2010aaf into main Apr 1, 2026
4 checks passed
@tito tito deleted the fix/lint-precommit-ci branch April 1, 2026 17:06
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