Use XDG_CACHE_HOME for RuboCop.
This commit is contained in:
parent
803f9cbf7b
commit
54c4580871
@ -11,7 +11,7 @@ module Hbc
|
|||||||
|
|
||||||
def run
|
def run
|
||||||
install_rubocop
|
install_rubocop
|
||||||
system "rubocop", *rubocop_args, "--", *cask_paths
|
system({ "XDG_CACHE_HOME" => HOMEBREW_CACHE }, "rubocop", *rubocop_args, "--", *cask_paths)
|
||||||
raise CaskError, "style check failed" unless $CHILD_STATUS.success?
|
raise CaskError, "style check failed" unless $CHILD_STATUS.success?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
require "utils"
|
require "utils"
|
||||||
require "json"
|
require "json"
|
||||||
|
require "open3"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
@ -104,16 +105,16 @@ module Homebrew
|
|||||||
when :print
|
when :print
|
||||||
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
|
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
|
||||||
args << "--format" << "simple" if files
|
args << "--format" << "simple" if files
|
||||||
system "rubocop", *args
|
system({ "XDG_CACHE_HOME" => HOMEBREW_CACHE }, "rubocop", *args)
|
||||||
!$?.success?
|
!$?.success?
|
||||||
when :json
|
when :json
|
||||||
json = Utils.popen_read_text("rubocop", "--format", "json", *args)
|
json, _, status = Open3.capture3({ "XDG_CACHE_HOME" => HOMEBREW_CACHE }, "rubocop", "--format", "json", *args)
|
||||||
# exit status of 1 just means violations were found; other numbers mean
|
# exit status of 1 just means violations were found; other numbers mean
|
||||||
# execution errors.
|
# execution errors.
|
||||||
# exitstatus can also be nil if RuboCop process crashes, e.g. due to
|
# exitstatus can also be nil if RuboCop process crashes, e.g. due to
|
||||||
# native extension problems.
|
# native extension problems.
|
||||||
# JSON needs to be at least 2 characters.
|
# JSON needs to be at least 2 characters.
|
||||||
if $?.exitstatus.nil? || $?.exitstatus > 1 || json.to_s.length < 2
|
if !status.success? || json.to_s.length < 2
|
||||||
raise "Error running `rubocop --format json #{args.join " "}`"
|
raise "Error running `rubocop --format json #{args.join " "}`"
|
||||||
end
|
end
|
||||||
RubocopResults.new(JSON.parse(json))
|
RubocopResults.new(JSON.parse(json))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user