]> git.openstreetmap.org Git - chef.git/commitdiff
Update pre-commit hook to use cookstyle
authorTom Hughes <tom@compton.nu>
Wed, 23 Aug 2023 17:36:48 +0000 (18:36 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 23 Aug 2023 17:37:00 +0000 (18:37 +0100)
hooks/pre-commit

index 60d6659326ff7908b9cf25fa8f9d1553c42523e5..a55ac2a939dc654fe55191696c2be056496d8630 100755 (executable)
@@ -15,11 +15,7 @@ if IO.popen(["git", "ls-files", "--unmerged"]).read.empty?
     file =~ /\.rb$/ || (file !~ /\.erb$/ && %x(file --brief --mime-type #{file}) == "text/x-ruby\n")
   end
 
     file =~ /\.rb$/ || (file !~ /\.erb$/ && %x(file --brief --mime-type #{file}) == "text/x-ruby\n")
   end
 
-  ok &&= system("bundle", "exec", "rubocop", *ruby_files) unless ruby_files.empty?
-
-  cookbooks = files.grep(%r{(cookbooks/[^/]+)/}) { Regexp.last_match(1) }.uniq
-
-  ok &&= system("bundle", "exec", "foodcritic", *cookbooks) unless cookbooks.empty?
+  ok &&= system("bundle", "exec", "cookstyle", *ruby_files) unless ruby_files.empty?
 
   system("git", "stash", "pop", "--quiet") if need_stash
 else
 
   system("git", "stash", "pop", "--quiet") if need_stash
 else