From: Tom Hughes Date: Sat, 4 Mar 2017 12:12:48 +0000 (+0000) Subject: Don't check erb templates with rubocop X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/a8f63f70a72d3c11397614f7960fd39685ce8b9a Don't check erb templates with rubocop --- diff --git a/hooks/pre-commit b/hooks/pre-commit index 4ad3c1576..7c7655e5d 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -12,7 +12,7 @@ if IO.popen(["git", "ls-files", "--unmerged"]).read.empty? end.compact ruby_files = files.select do |file| - file =~ /\.rb$/ || `file --brief --mime-type #{file}` == "text/x-ruby\n" + file =~ /\.rb$/ || (file !~ /\.erb$/ && `file --brief --mime-type #{file}` == "text/x-ruby\n") end ok &&= system("bundle", "exec", "rubocop", *ruby_files) unless ruby_files.empty?