aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/style.rb
diff options
context:
space:
mode:
authorMike McQuaid2017-05-28 16:59:53 +0100
committerMike McQuaid2017-05-29 18:42:02 +0100
commit4356016b4a1c2eaba02680b4ad7f1747d2df53bf (patch)
tree9932f9c8fd87d9bdb4d36770012748782e5a497c /Library/Homebrew/cmd/style.rb
parent3165fd2519c41a2be7e12442a5098d3b699fda04 (diff)
downloadbrew-4356016b4a1c2eaba02680b4ad7f1747d2df53bf.tar.bz2
Use parallel RuboCop
This requires updating to Rubocop 0.49.0 which will require some fixes to rules, in Homebrew/brew and Homebrew/homebrew-core but opening this for now so I remember.
Diffstat (limited to 'Library/Homebrew/cmd/style.rb')
-rw-r--r--Library/Homebrew/cmd/style.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index 228aa360e..e469c47bb 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -73,7 +73,11 @@ module Homebrew
args = %w[
--force-exclusion
]
- args << "--auto-correct" if fix
+ if fix
+ args << "--auto-correct"
+ else
+ args << "--parallel"
+ end
if options[:except_cops]
options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
@@ -101,14 +105,16 @@ module Homebrew
args += files
end
+ cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" }
+
case output_type
when :print
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
args << "--format" << "simple" if files
- system({ "XDG_CACHE_HOME" => HOMEBREW_CACHE }, "rubocop", *args)
+ system(cache_env, "rubocop", *args)
!$?.success?
when :json
- json, _, status = Open3.capture3({ "XDG_CACHE_HOME" => HOMEBREW_CACHE }, "rubocop", "--format", "json", *args)
+ json, _, status = 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