Skip to content

Instantly share code, notes, and snippets.

View sudoaza's full-sized avatar

aza sudoaza

  • Buenos Aires, Argentina
View GitHub Profile
@sudoaza
sudoaza / pre-commit
Last active February 14, 2023 13:50 — forked from edisonywh/pre-commit
Run Rubocop in Git's pre-commit hook
```
#!/bin/sh
echo "\nRunning rubocop...\n"
declare -a ERRORS=()
ERRORS=("$(rubocop $(git diff --cached --name-only | tr -s "\n" " ") | grep -e 'C:' -e 'E:')")
if [[ "$ERRORS" != "" ]]; then
echo "\n BEE-BOP! There are some things that you need to fix before commiting!\n"