diff --git a/pre-commit b/pre-commit deleted file mode 100755 index 84050d4..0000000 --- a/pre-commit +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env ruby - -require 'english' -require 'rubocop' - -ADDED_OR_MODIFIED = /A|AM|^M/.freeze - -changed_files = `git status --porcelain`.split(/\n/). - select { |file_name_with_status| - file_name_with_status =~ ADDED_OR_MODIFIED - }. - map { |file_name_with_status| - file_name_with_status.split(' ')[1] - }. - select { |file_name| - File.extname(file_name) == '.rb' - }.join(' ') - -system("rubocop #{changed_files} -a") unless changed_files.empty? - -exit $CHILD_STATUS.to_s[-1].to_i \ No newline at end of file