From 5db764f3cb3d8b3e356cc8f209ff4c52c126362e Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 2 Aug 2020 03:36:09 +0200 Subject: [PATCH] Pass `debug?` and `verbose?` in `brew style`. --- Library/Homebrew/dev-cmd/audit.rb | 2 +- Library/Homebrew/dev-cmd/style.rb | 4 +++- Library/Homebrew/style.rb | 13 +++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 45b24c293d..599c770802 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -103,7 +103,7 @@ module Homebrew only_cops = args.only_cops except_cops = args.except_cops - options = { fix: args.fix? } + options = { fix: args.fix?, debug: args.debug?, verbose: args.verbose? } if only_cops options[:only_cops] = only_cops diff --git a/Library/Homebrew/dev-cmd/style.rb b/Library/Homebrew/dev-cmd/style.rb index 7bb6fe8e75..3c05b73778 100644 --- a/Library/Homebrew/dev-cmd/style.rb +++ b/Library/Homebrew/dev-cmd/style.rb @@ -50,7 +50,9 @@ module Homebrew only_cops = args.only_cops except_cops = args.except_cops - options = { fix: args.fix?, display_cop_names: args.display_cop_names? } + options = { + fix: args.fix?, display_cop_names: args.display_cop_names?, debug: args.debug?, verbose: args.verbose? + } if only_cops options[:only_cops] = only_cops elsif except_cops diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index c7a94df76b..be40a4dd41 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -16,7 +16,9 @@ module Homebrew check_style_impl(files, :json, **options) end - def check_style_impl(files, output_type, fix: false, except_cops: nil, only_cops: nil, display_cop_names: false) + def check_style_impl(files, output_type, + fix: false, except_cops: nil, only_cops: nil, display_cop_names: false, + debug: false, verbose: false) Homebrew.install_bundler_gems! require "rubocop" require "rubocops" @@ -30,7 +32,8 @@ module Homebrew "--parallel" end - args += ["--extra-details", "--display-cop-names"] if Homebrew.args.verbose? + args += ["--extra-details"] if verbose + args += ["--display-cop-names"] if display_cop_names || verbose if except_cops except_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") } @@ -77,15 +80,13 @@ module Homebrew case output_type when :print - args << "--debug" if Homebrew.args.debug? - args << "--display-cop-names" if display_cop_names + args << "--debug" if debug args << "--format" << "simple" if files.present? system(cache_env, "rubocop", *args) rubocop_success = $CHILD_STATUS.success? when :json json, err, status = - Open3.capture3(cache_env, "rubocop", - "--format", "json", *args) + Open3.capture3(cache_env, "rubocop", "--format", "json", *args) # exit status of 1 just means violations were found; other numbers mean # execution errors. # exitstatus can also be nil if RuboCop process crashes, e.g. due to