-
-
Save rothanachoun/4b5426e2b9be32c180ddca2f74152790 to your computer and use it in GitHub Desktop.
Using Claude Code Hooks to automatically run rubocop --auto-correct on Ruby files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "hooks": { | |
| "PostToolUse": [ | |
| { | |
| "matcher": "Edit|Write", | |
| "hooks": [ | |
| { | |
| "type": "command", | |
| "command": "FILE_PATH=$(jq -r '.tool_input.file_path // empty'); if [[ \"$FILE_PATH\" =~ \\.(rb|rake)$|Rakefile$|Gemfile$ ]]; then echo \"Running RuboCop on $FILE_PATH\"; bundle exec rubocop --autocorrect \"$FILE_PATH\"; fi" | |
| } | |
| ] | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment