From 966189d07db604c953855e97c97377006e4ce8dd Mon Sep 17 00:00:00 2001 From: XuehaiPan Date: Thu, 16 Sep 2021 23:42:30 +0800 Subject: [PATCH] style: add shfmt exit status to `brew style` --- Library/Homebrew/style.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 5ea6f3d47e..2f98c357c5 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -65,12 +65,16 @@ module Homebrew run_shellcheck(shell_files, output_type) end - run_shfmt(shell_files, fix: fix) if ruby_files.none? || shell_files.any? + shfmt_result = if ruby_files.any? && shell_files.none? + true + else + run_shfmt(shell_files, fix: fix) + end if output_type == :json Offenses.new(rubocop_result + shellcheck_result) else - rubocop_result && shellcheck_result + rubocop_result && shellcheck_result && shfmt_result end end