Run rubocop in temporary directory to skip reading parent config.

This commit is contained in:
Markus Reiter 2018-10-16 14:54:39 +02:00
parent 5f20f76f36
commit 8aab6dc03d

View File

@ -11,7 +11,9 @@ module Cask
install_rubocop install_rubocop
cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" } cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" }
hide_warnings = debug? ? [] : [ENV["HOMEBREW_RUBY_PATH"], "-W0", "-S"] hide_warnings = debug? ? [] : [ENV["HOMEBREW_RUBY_PATH"], "-W0", "-S"]
system(cache_env, *hide_warnings, "rubocop", *rubocop_args, "--", *cask_paths) Dir.mktmpdir do |tmpdir|
system(cache_env, *hide_warnings, "rubocop", *rubocop_args, "--", *cask_paths, chdir: tmpdir)
end
raise CaskError, "style check failed" unless $CHILD_STATUS.success? raise CaskError, "style check failed" unless $CHILD_STATUS.success?
end end