From 8aab6dc03d8fa44961eb95e83a48bbda15fe05e9 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 16 Oct 2018 14:54:39 +0200 Subject: [PATCH] Run `rubocop` in temporary directory to skip reading parent config. --- Library/Homebrew/cask/cmd/style.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/cmd/style.rb b/Library/Homebrew/cask/cmd/style.rb index 95ac2b088c..edee1f3c49 100644 --- a/Library/Homebrew/cask/cmd/style.rb +++ b/Library/Homebrew/cask/cmd/style.rb @@ -11,7 +11,9 @@ module Cask install_rubocop cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" } 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? end