[rubygems/rubygems] util/rubocop -A --only Lint/UnderscorePrefixedVariableName

https://github.com/rubygems/rubygems/commit/6dc4bc3a5b
This commit is contained in:
Hiroshi SHIBATA 2023-03-22 12:47:40 +09:00
parent ec131071b9
commit 01be518eba
Notes: git 2023-03-23 08:19:26 +00:00
3 changed files with 24 additions and 24 deletions

View File

@ -164,14 +164,14 @@ class Gem::Request
# environment variables.
def self.get_proxy_from_env(scheme = "http")
_scheme = scheme.downcase
_SCHEME = scheme.upcase
env_proxy = ENV["#{_scheme}_proxy"] || ENV["#{_SCHEME}_PROXY"]
downcase_scheme = scheme.downcase
upcase_scheme = scheme.upcase
env_proxy = ENV["#{downcase_scheme}_proxy"] || ENV["#{upcase_scheme}_PROXY"]
no_env_proxy = env_proxy.nil? || env_proxy.empty?
if no_env_proxy
return ["https", "http"].include?(_scheme) ?
return ["https", "http"].include?(downcase_scheme) ?
:no_proxy : get_proxy_from_env("http")
end
@ -179,8 +179,8 @@ class Gem::Request
uri = URI(Gem::UriFormatter.new(env_proxy).normalize)
if uri && uri.user.nil? && uri.password.nil?
user = ENV["#{_scheme}_proxy_user"] || ENV["#{_SCHEME}_PROXY_USER"]
password = ENV["#{_scheme}_proxy_pass"] || ENV["#{_SCHEME}_PROXY_PASS"]
user = ENV["#{downcase_scheme}_proxy_user"] || ENV["#{upcase_scheme}_PROXY_USER"]
password = ENV["#{downcase_scheme}_proxy_pass"] || ENV["#{upcase_scheme}_PROXY_PASS"]
uri.user = Gem::UriFormatter.new(user).escape
uri.password = Gem::UriFormatter.new(password).escape

View File

@ -1150,8 +1150,8 @@ class Gem::Specification < Gem::BasicSpecification
def self.load(file)
return unless file
_spec = @load_cache_mutex.synchronize { @load_cache[file] }
return _spec if _spec
spec = @load_cache_mutex.synchronize { @load_cache[file] }
return spec if spec
file = file.dup.tap(&Gem::UNTAINT)
return unless File.file?(file)
@ -1161,22 +1161,22 @@ class Gem::Specification < Gem::BasicSpecification
code.tap(&Gem::UNTAINT)
begin
_spec = eval code, binding, file
spec = eval code, binding, file
if Gem::Specification === _spec
_spec.loaded_from = File.expand_path file.to_s
if Gem::Specification === spec
spec.loaded_from = File.expand_path file.to_s
@load_cache_mutex.synchronize do
prev = @load_cache[file]
if prev
_spec = prev
spec = prev
else
@load_cache[file] = _spec
@load_cache[file] = spec
end
end
return _spec
return spec
end
warn "[#{file}] isn't a Gem::Specification (#{_spec.class} instead)."
warn "[#{file}] isn't a Gem::Specification (#{spec.class} instead)."
rescue SignalException, SystemExit
raise
rescue SyntaxError, StandardError => e

View File

@ -1556,8 +1556,8 @@ class TestGem < Gem::TestCase
[:dir1, [Gem.user_dir, Gem.dir], m1],
]
tests.each do |_name, _paths, expected|
Gem.use_paths _paths.first, _paths
tests.each do |name, paths, expected|
Gem.use_paths paths.first, paths
Gem::Specification.reset
Gem.searcher = nil
@ -1567,25 +1567,25 @@ class TestGem < Gem::TestCase
assert_equal \
[expected.gem_dir],
Gem::Dependency.new("m","1").to_specs.map(&:gem_dir).sort,
"Wrong specs for #{_name}"
"Wrong specs for #{name}"
spec = Gem::Dependency.new("m","1").to_spec
assert_equal \
File.join(_paths.first, "gems", "m-1"),
File.join(paths.first, "gems", "m-1"),
spec.gem_dir,
"Wrong spec before require for #{_name}"
refute spec.activated?, "dependency already activated for #{_name}"
"Wrong spec before require for #{name}"
refute spec.activated?, "dependency already activated for #{name}"
gem "m"
spec = Gem::Dependency.new("m","1").to_spec
assert spec.activated?, "dependency not activated for #{_name}"
assert spec.activated?, "dependency not activated for #{name}"
assert_equal \
File.join(_paths.first, "gems", "m-1"),
File.join(paths.first, "gems", "m-1"),
spec.gem_dir,
"Wrong spec after require for #{_name}"
"Wrong spec after require for #{name}"
spec.instance_variable_set :@activated, false
Gem.loaded_specs.delete(spec.name)