Skip to content

Instantly share code, notes, and snippets.

View SamGerber-zz's full-sized avatar

Sam Gerber SamGerber-zz

View GitHub Profile
@SamGerber-zz
SamGerber-zz / rubocop_pre_commit_hook
Last active September 1, 2017 21:50 — forked from timheilman/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified. Itself passes rubocop with default settings.
#!/usr/bin/env ruby
# Source: https://gist.github.com/timheilman/1bb8da91be4b79425d67314c9ae23f6b
# credit to https://www.github.com/joneshf
require 'rubocop'
changed_files =
`git diff --name-only --cached -- '*.rb' '*.rake'`
.split("\n").join(' ')