Skip to content

Instantly share code, notes, and snippets.

@HarlemSquirrel
Last active January 4, 2022 17:58
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 HarlemSquirrel/c4f63e8811804d9d57094499760dce71 to your computer and use it in GitHub Desktop.
Save HarlemSquirrel/c4f63e8811804d9d57094499760dce71 to your computer and use it in GitHub Desktop.
A pre-commit file for Ruby on Rails applications
#!/bin/bash
#
# A set of commands to run as pre-commit hooks for git.
#
# Save this to .git/hooks/pre-commit and make executable to enable
#
# This will run whenever we run `git commit`.
# To skip this, add `-n` or `--no-verify` flag.
#
set -e
printf "Running pre-commit hooks...\n"
##
# Check for lints with stylelint
printf "===> Running stylelint\n"
npx stylelint app/assets/**/*css
##
# Perform static analysis with Rubocop
printf "===> Running rubocop\n"
bundle exec rubocop --parallel --cache true --disable-pending-cops --format quiet
printf "===> OK 👍\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment