Skip to content

Instantly share code, notes, and snippets.

@tngranados
Created December 16, 2020 08:17
Show Gist options
  • Save tngranados/645f9f05062be26c8f31a3976e8d276f to your computer and use it in GitHub Desktop.
Save tngranados/645f9f05062be26c8f31a3976e8d276f to your computer and use it in GitHub Desktop.
Run every check before merging a PR
lgtm() {
yarn lint || { echo -e '\n\n \e[31mSomething went wrong: javascript linting\e[m \n\n' && return false }
rubocop -a || { echo -e '\n\n \e[31mSomething went wrong: ruby linting\e[m \n\n' && return false }
yarn test || { echo -e '\n\n \e[31mSomething went wrong: javascript testing\e[m \n\n' && return false }
rspec || { echo -e '\n\n \e[31mSomething went wrong: ruby testing\e[m \n\n' && return false }
if [[ -n $(git status -s) ]]; then
git status
echo -e '\n\n \e[33mAll good, but git status is dirty\e[m \n\n'
else
echo -e '\n\n \e[32mAll good, LGTM!\e[m \n\n'
fi
return true
}
@jamielaff
Copy link

rubocop -a -> rubocop, so it forces failure similar to CI

@johnmcauley
Copy link

cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment