Pass args in style instead of using global args.

This commit is contained in:
Markus Reiter 2020-07-26 09:44:46 +02:00
parent bd0346e083
commit 291eee74c4
2 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,7 @@ module Homebrew
only_cops = args.only_cops
except_cops = args.except_cops
options = { fix: args.fix? }
options = { fix: args.fix?, display_cop_names: args.display_cop_names? }
if only_cops
options[:only_cops] = only_cops
elsif except_cops

View File

@ -16,7 +16,7 @@ module Homebrew
check_style_impl(files, :json, **options)
end
def check_style_impl(files, output_type, fix: false, except_cops: nil, only_cops: nil)
def check_style_impl(files, output_type, fix: false, except_cops: nil, only_cops: nil, display_cop_names: false)
Homebrew.install_bundler_gems!
require "rubocop"
require "rubocops"
@ -78,7 +78,7 @@ module Homebrew
case output_type
when :print
args << "--debug" if Homebrew.args.debug?
args << "--display-cop-names" if Homebrew.args.display_cop_names?
args << "--display-cop-names" if display_cop_names
args << "--format" << "simple" if files.present?
system(cache_env, "rubocop", *args)
rubocop_success = $CHILD_STATUS.success?