Skip to content

Commit

Permalink
ENV["HOME"] and Dir.home seems not to be equivalent
Browse files Browse the repository at this point in the history
because Ruby 2.5 CI passes with the former but fails with the latter.
I don't want to introduce any new bug just for conforming RuboCop,
so let me disable the cop and revert the code back to what used to work.

This reverts 862c937 and partially
reverts 4480718.
  • Loading branch information
amatsuda committed Aug 30, 2024
1 parent 98f7382 commit 9e8ac14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ Style/DocumentDynamicEvalDefinition:
Style/EndlessMethod:
Enabled: true

Style/EnvHome:
Enabled: false

Style/ExplicitBlockArgument:
# capturing as a proc has a performance hit, so is a case by case choice
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion lib/simplecov/load_global_config.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require "etc"
home_dir = Dir.home || File.expand_path("~") || Etc.getpwuid.dir || (ENV.fetch("USER", nil) && File.expand_path("~#{ENV.fetch('USER', nil)}"))
home_dir = (ENV["HOME"] && File.expand_path("~")) || Etc.getpwuid.dir || (ENV["USER"] && File.expand_path("~#{ENV['USER']}"))
if home_dir
global_config_path = File.join(home_dir, ".simplecov")
load global_config_path if File.exist?(global_config_path)
Expand Down

0 comments on commit 9e8ac14

Please sign in to comment.