Simplify return value logic.

This commit is contained in:
Markus Reiter 2019-10-04 09:19:02 +02:00
parent 9df563f25f
commit a49282c318
4 changed files with 6 additions and 6 deletions

View File

@ -62,6 +62,6 @@ module Homebrew
NewFormulaAudit] NewFormulaAudit]
end end
Homebrew.failed = Style.check_style_and_print(target, options) Homebrew.failed = !Style.check_style_and_print(target, options)
end end
end end

View File

@ -102,7 +102,7 @@ module Homebrew
raise "Invalid output_type for check_style_impl: #{output_type}" raise "Invalid output_type for check_style_impl: #{output_type}"
end end
return !rubocop_success if files.present? || !has_non_formula return rubocop_success if files.present? || !has_non_formula
shellcheck = which("shellcheck") shellcheck = which("shellcheck")
shellcheck ||= which("shellcheck", ENV["HOMEBREW_PATH"]) shellcheck ||= which("shellcheck", ENV["HOMEBREW_PATH"])
@ -113,7 +113,7 @@ module Homebrew
end end
unless shellcheck unless shellcheck
opoo "Could not find or install `shellcheck`! Not checking shell style." opoo "Could not find or install `shellcheck`! Not checking shell style."
return !rubocop_success return rubocop_success
end end
shell_files = [ shell_files = [
@ -125,7 +125,7 @@ module Homebrew
# TODO: check, fix completions here too. # TODO: check, fix completions here too.
# TODO: consider using ShellCheck JSON output # TODO: consider using ShellCheck JSON output
shellcheck_success = system shellcheck, "--shell=bash", *shell_files shellcheck_success = system shellcheck, "--shell=bash", *shell_files
!rubocop_success || !shellcheck_success rubocop_success && shellcheck_success
end end
class RubocopResults class RubocopResults

View File

@ -79,7 +79,7 @@ describe "brew style" do
rubocop_result = Homebrew::Style.check_style_and_print([target_file]) rubocop_result = Homebrew::Style.check_style_and_print([target_file])
expect(rubocop_result).to eq false expect(rubocop_result).to eq true
end end
end end
end end

View File

@ -92,7 +92,7 @@ module Homebrew
@bundle_installed ||= begin @bundle_installed ||= begin
bundle = "#{gem_user_bindir}/bundle" bundle = "#{gem_user_bindir}/bundle"
bundle_check_output = `#{bundle} check 2>&1` bundle_check_output = `#{bundle} check 2>&1`
bundle_check_failed = !$CHILD_STATUS.exitstatus.zero? bundle_check_failed = !$CHILD_STATUS.success?
# for some reason sometimes the exit code lies so check the output too. # for some reason sometimes the exit code lies so check the output too.
if bundle_check_failed || bundle_check_output.include?("Install missing gems") if bundle_check_failed || bundle_check_output.include?("Install missing gems")