Skip to content

Add pre-commit and pre-push git hooks#1437

Merged
maebeale merged 3 commits intomainfrom
maebeale/add-pre-commit-hook
Mar 28, 2026
Merged

Add pre-commit and pre-push git hooks#1437
maebeale merged 3 commits intomainfrom
maebeale/add-pre-commit-hook

Conversation

@maebeale
Copy link
Copy Markdown
Collaborator

@maebeale maebeale commented Mar 22, 2026

Summary

  • bin/pre-commit runs lightweight safety checks on every commit: debug statement detection, merge conflict marker detection, and secrets/env file blocking
  • bin/pre-push runs rubocop and brakeman before pushing — heavier checks that shouldn't slow down iterative commits
  • Both hooks auto-install via bin/setup
  • Removes credentials.yml.enc from secrets blocklist (it's encrypted and meant to be committed)

Test plan

  • Run bin/setup and verify both .git/hooks/pre-commit and .git/hooks/pre-push are installed
  • Stage a file with binding.pry and verify commit is blocked
  • Stage a clean file and verify commit succeeds quickly (no rubocop/brakeman)
  • Push and verify rubocop + brakeman run

🤖 Generated with Claude Code

@maebeale maebeale changed the title Add pre-commit hook Add pre-commit and pre-push git hooks Mar 28, 2026
maebeale and others added 3 commits March 28, 2026 08:44
Runs on every commit:
- rubocop on staged .rb files only
- brakeman security scan
- checks for debug statements (binding.pry, byebug, etc.)
- checks for merge conflict markers
- blocks committing .env/secrets files

Hook is auto-installed via bin/setup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pre-commit now only runs lightweight safety checks (debug statements,
conflict markers, secrets). Heavier tools run before push instead.
Also removes credentials.yml.enc from secrets blocklist since it's
meant to be committed (it's encrypted).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/add-pre-commit-hook branch from 7c41c37 to 737223b Compare March 28, 2026 12:44
@maebeale maebeale merged commit 7c1104b into main Mar 28, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/add-pre-commit-hook branch March 28, 2026 13:19
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