Skip to content

Instantly share code, notes, and snippets.

View gaganawhad's full-sized avatar

Gagan Awhad gaganawhad

  • Desiring God
  • Minneapolis, MN
View GitHub Profile
@gaganawhad
gaganawhad / rubocop_pre_commit_hook
Last active August 29, 2015 14:26 — forked from mpeteuil/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.
#!/usr/bin/env ruby
require 'english'
require 'rubocop'
require 'byebug'
ADDED_OR_MODIFIED = /A|AM|^M/.freeze
changed_files = `git status --porcelain`.split(/\n/).
select { |file_name_with_status|