diff options
| author | Markus Reiter | 2016-09-21 12:43:05 +0200 |
|---|---|---|
| committer | Markus Reiter | 2016-09-23 15:30:06 +0200 |
| commit | ce6994b001520b8e5d26e5e15b410c9146072104 (patch) | |
| tree | c08d131a668ac02a93fe358c0f41c4b3a212d276 /Library | |
| parent | 21e0a7efb998b65c921885858969503513cad14b (diff) | |
| download | brew-ce6994b001520b8e5d26e5e15b410c9146072104.tar.bz2 | |
RuboCop has to be run inside `HOMEBREW_LIBRARY`.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/style.rb | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index c598e9062..db61116be 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -54,20 +54,22 @@ module Homebrew args << "--auto-correct" if fix args += files - case output_type - when :print - args << "--display-cop-names" if ARGV.include? "--display-cop-names" - system "rubocop", "--format", "simple", *args - !$?.success? - when :json - json = Utils.popen_read_text("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 - # native extension problems - raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1 - RubocopResults.new(Utils::JSON.load(json)) - else - raise "Invalid output_type for check_style_impl: #{output_type}" + HOMEBREW_LIBRARY.cd do + case output_type + when :print + args << "--display-cop-names" if ARGV.include? "--display-cop-names" + system "rubocop", "--format", "simple", *args + !$?.success? + when :json + json = Utils.popen_read_text("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 + # native extension problems + raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1 + RubocopResults.new(Utils::JSON.load(json)) + else + raise "Invalid output_type for check_style_impl: #{output_type}" + end end end |
