Skip to content
Snippets Groups Projects
Commit 5db764f3 authored by Markus Reiter's avatar Markus Reiter
Browse files

Pass `debug?` and `verbose?` in `brew style`.

parent 5caafe41
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment