Skip to content

Instantly share code, notes, and snippets.

@jppommet
Created August 3, 2017 23:41
Show Gist options
  • Save jppommet/6ae749bf5a9cb71c0d1e284fad4f561c to your computer and use it in GitHub Desktop.
Save jppommet/6ae749bf5a9cb71c0d1e284fad4f561c to your computer and use it in GitHub Desktop.
git pre-commit hook rubocop ruby modified/staged files
#!/bin/sh
#TODO: add exclude <file>.rb in rubocop.yml ?
git status --porcelain | egrep "^(A|AM|^M).+\.rb$" | awk '{print $NF}' | xargs rubocop -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment