Skip to content

Instantly share code, notes, and snippets.

@mculp
Last active September 18, 2020 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mculp/c3e723aaed8f84b830708c3e1dbcb9ec to your computer and use it in GitHub Desktop.
Save mculp/c3e723aaed8f84b830708c3e1dbcb9ec to your computer and use it in GitHub Desktop.
run rubocop as a git precommit hook
#!/bin/bash
files=$(git status -s | grep -E 'A|M' | awk '{print $2}')
files="$files $(git status -s | grep -E 'R' | awk '{print $4}')"
echo $files | xargs $(which rubocop) --display-cop-names --extra-details --parallel --force-exclusion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment