RuboCop has to be run inside HOMEBREW_LIBRARY.
This commit is contained in:
parent
21e0a7efb9
commit
ce6994b001
@ -54,20 +54,22 @@ module Homebrew
|
|||||||
args << "--auto-correct" if fix
|
args << "--auto-correct" if fix
|
||||||
args += files
|
args += files
|
||||||
|
|
||||||
case output_type
|
HOMEBREW_LIBRARY.cd do
|
||||||
when :print
|
case output_type
|
||||||
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
|
when :print
|
||||||
system "rubocop", "--format", "simple", *args
|
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
|
||||||
!$?.success?
|
system "rubocop", "--format", "simple", *args
|
||||||
when :json
|
!$?.success?
|
||||||
json = Utils.popen_read_text("rubocop", "--format", "json", *args)
|
when :json
|
||||||
# exit status of 1 just means violations were found; other numbers mean execution errors
|
json = Utils.popen_read_text("rubocop", "--format", "json", *args)
|
||||||
# exitstatus can also be nil if RuboCop process crashes, e.g. due to
|
# exit status of 1 just means violations were found; other numbers mean execution errors
|
||||||
# native extension problems
|
# exitstatus can also be nil if RuboCop process crashes, e.g. due to
|
||||||
raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1
|
# native extension problems
|
||||||
RubocopResults.new(Utils::JSON.load(json))
|
raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1
|
||||||
else
|
RubocopResults.new(Utils::JSON.load(json))
|
||||||
raise "Invalid output_type for check_style_impl: #{output_type}"
|
else
|
||||||
|
raise "Invalid output_type for check_style_impl: #{output_type}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user