Pass debug? and verbose? in brew style.
This commit is contained in:
parent
5caafe413e
commit
5db764f3cb
@ -103,7 +103,7 @@ module Homebrew
|
|||||||
|
|
||||||
only_cops = args.only_cops
|
only_cops = args.only_cops
|
||||||
except_cops = args.except_cops
|
except_cops = args.except_cops
|
||||||
options = { fix: args.fix? }
|
options = { fix: args.fix?, debug: args.debug?, verbose: args.verbose? }
|
||||||
|
|
||||||
if only_cops
|
if only_cops
|
||||||
options[:only_cops] = only_cops
|
options[:only_cops] = only_cops
|
||||||
|
|||||||
@ -50,7 +50,9 @@ module Homebrew
|
|||||||
only_cops = args.only_cops
|
only_cops = args.only_cops
|
||||||
except_cops = args.except_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
|
if only_cops
|
||||||
options[:only_cops] = only_cops
|
options[:only_cops] = only_cops
|
||||||
elsif except_cops
|
elsif except_cops
|
||||||
|
|||||||
@ -16,7 +16,9 @@ module Homebrew
|
|||||||
check_style_impl(files, :json, **options)
|
check_style_impl(files, :json, **options)
|
||||||
end
|
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!
|
Homebrew.install_bundler_gems!
|
||||||
require "rubocop"
|
require "rubocop"
|
||||||
require "rubocops"
|
require "rubocops"
|
||||||
@ -30,7 +32,8 @@ module Homebrew
|
|||||||
"--parallel"
|
"--parallel"
|
||||||
end
|
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
|
if except_cops
|
||||||
except_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
except_cops.map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
||||||
@ -77,15 +80,13 @@ module Homebrew
|
|||||||
|
|
||||||
case output_type
|
case output_type
|
||||||
when :print
|
when :print
|
||||||
args << "--debug" if Homebrew.args.debug?
|
args << "--debug" if debug
|
||||||
args << "--display-cop-names" if display_cop_names
|
|
||||||
args << "--format" << "simple" if files.present?
|
args << "--format" << "simple" if files.present?
|
||||||
system(cache_env, "rubocop", *args)
|
system(cache_env, "rubocop", *args)
|
||||||
rubocop_success = $CHILD_STATUS.success?
|
rubocop_success = $CHILD_STATUS.success?
|
||||||
when :json
|
when :json
|
||||||
json, err, status =
|
json, err, status =
|
||||||
Open3.capture3(cache_env, "rubocop",
|
Open3.capture3(cache_env, "rubocop", "--format", "json", *args)
|
||||||
"--format", "json", *args)
|
|
||||||
# exit status of 1 just means violations were found; other numbers mean
|
# exit status of 1 just means violations were found; other numbers mean
|
||||||
# execution errors.
|
# execution errors.
|
||||||
# exitstatus can also be nil if RuboCop process crashes, e.g. due to
|
# exitstatus can also be nil if RuboCop process crashes, e.g. due to
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user