From: Tom Hughes Date: Wed, 23 Aug 2023 17:36:48 +0000 (+0100) Subject: Update pre-commit hook to use cookstyle X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/0fe9d693dc1456e1a032d6ff2301a7c19c705b4a Update pre-commit hook to use cookstyle --- diff --git a/hooks/pre-commit b/hooks/pre-commit index 60d665932..a55ac2a93 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -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 - 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