Skip to content

Instantly share code, notes, and snippets.

View Lokideos's full-sized avatar

George Asfour Lokideos

View GitHub Profile
@Lokideos
Lokideos / rubocop_pre_commit_hook
Created September 25, 2018 15:15 — forked from palkan/rubocop_pre_commit_hook
Rubocop pre-commit hook
#!/usr/bin/env ruby
ADDED_OR_MODIFIED = /^\s*(A|AM|M)/.freeze
changed_files = `git status --porcelain`.split(/\n/)
unstaged_files = `git ls-files -m`.split(/\n/)
changed_files = changed_files.select { |f| f =~ ADDED_OR_MODIFIED }
changed_files = changed_files.map { |f| f.split(" ")[1] }