aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/style.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cmd/style.rb')
-rw-r--r--Library/Homebrew/cmd/style.rb32
1 files changed, 17 insertions, 15 deletions
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index f28d50cc1..db61116be 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -45,7 +45,7 @@ module Homebrew
def check_style_impl(files, output_type, options = {})
fix = options[:fix]
- Homebrew.install_gem_setup_path! "rubocop", "0.41.2"
+ Homebrew.install_gem_setup_path! "rubocop", "0.43.0"
args = %W[
--force-exclusion
@@ -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