Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# .git-blame-ignore-revs
# RubyGems
# Enable Style/StringLiterals cop
# [RuboCop] Enable Style/StringLiterals in RubyGems
dca5fa728437383428a593644f537aaa1020ee63
# enable Style/MethodDefParentheses in Rubocop
# [RuboCop] Enable Style/MethodDefParentheses in RubyGems
79e6bafd945e358480ac2253995e82e229bb4f5c
# Bundler
# [RuboCop] Enable Style/StringLiterals
# [RuboCop] Enable Style/StringLiterals in Bundler
b0d532adb80521271fbde4d3955c252f2ee09a5c
# [RuboCop] Enable Style/SymbolProc
# [RuboCop] Enable Style/SymbolProc in Bundler
cf58bc4b1ee83b2697fbdbcc76ced09515525141
# [RuboCop] Enable Style/EmptyLines
# [RuboCop] Enable Style/EmptyLines in Bundler
ff426fdbc1bde3582b6e1d5137abd21d74c38f87
# Use modern hashes consistently
# [RuboCop] Use modern hashes consistently in Bundler
bb66253f2ceddee527b82971423348d8bbc1b606
# [RuboCop] Enable Layout/SpaceAroundEqualsInParameterDefault
cf085f1d11e729732657991baa2de010a51f4378
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ Layout/AssignmentIndentation:
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Enabled: true

Layout/SpaceAroundEqualsInParameterDefault:
Enabled: true

Layout/SpaceInsideArrayLiteralBrackets:
Enabled: true

Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def parse_dependency(package, dependency)
PubGrub::VersionConstraint.new(package, range: range)
end

def versions_for(package, range=VersionRange.any)
def versions_for(package, range = VersionRange.any)
range.select_versions(@sorted_versions[package])
end

Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/rubygems_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class NameTuple
unless Gem::NameTuple.new("a", Gem::Version.new("1"), Gem::Platform.new("x86_64-linux")).platform.is_a?(String)
alias_method :initialize_with_platform, :initialize

def initialize(name, version, platform=Gem::Platform::RUBY)
def initialize(name, version, platform = Gem::Platform::RUBY)
if Gem::Platform === platform
initialize_with_platform(name, version, platform.to_s)
else
Expand Down
10 changes: 5 additions & 5 deletions lib/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def self.needs
finish_resolve rs
end

def self.finish_resolve(request_set=Gem::RequestSet.new)
def self.finish_resolve(request_set = Gem::RequestSet.new)
request_set.import Gem::Specification.unresolved_deps.values
request_set.import Gem.loaded_specs.values.map {|s| Gem::Dependency.new(s.name, s.version) }

Expand Down Expand Up @@ -341,7 +341,7 @@ def self.binary_mode
##
# The path where gem executables are to be installed.

def self.bindir(install_dir=Gem.dir)
def self.bindir(install_dir = Gem.dir)
return File.join install_dir, "bin" unless
install_dir.to_s == Gem.default_dir.to_s
Gem.default_bindir
Expand All @@ -350,7 +350,7 @@ def self.bindir(install_dir=Gem.dir)
##
# The path were rubygems plugins are to be installed.

def self.plugindir(install_dir=Gem.dir)
def self.plugindir(install_dir = Gem.dir)
File.join install_dir, "plugins"
end

Expand Down Expand Up @@ -534,7 +534,7 @@ def self.extension_api_version # :nodoc:
# Note that find_files will return all files even if they are from different
# versions of the same gem. See also find_latest_files

def self.find_files(glob, check_load_path=true)
def self.find_files(glob, check_load_path = true)
files = []

files = find_files_from_load_path glob if check_load_path
Expand Down Expand Up @@ -571,7 +571,7 @@ def self.find_files_from_load_path(glob) # :nodoc:
# Unlike find_files, find_latest_files will return only files from the
# latest version of a gem.

def self.find_latest_files(glob, check_load_path=true)
def self.find_latest_files(glob, check_load_path = true)
files = []

files = find_files_from_load_path glob if check_load_path
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def self.specific_extra_args_hash
# Unhandled arguments (gem names, files, etc.) are left in
# <tt>options[:args]</tt>.

def initialize(command, summary=nil, defaults={})
def initialize(command, summary = nil, defaults = {})
@command = command
@summary = summary
@program_name = "gem #{command}"
Expand Down
6 changes: 3 additions & 3 deletions lib/rubygems/command_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def initialize
##
# Register the Symbol +command+ as a gem command.

def register_command(command, obj=false)
def register_command(command, obj = false)
@commands[command] = obj
end

Expand Down Expand Up @@ -148,7 +148,7 @@ def command_names
##
# Run the command specified by +args+.

def run(args, build_args=nil)
def run(args, build_args = nil)
process_args(args, build_args)
rescue StandardError, Gem::Timeout::Error => ex
if ex.respond_to?(:detailed_message)
Expand All @@ -165,7 +165,7 @@ def run(args, build_args=nil)
terminate_interaction(1)
end

def process_args(args, build_args=nil)
def process_args(args, build_args = nil)
if args.empty?
say Gem::Command::HELP
terminate_interaction 1
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def =~(other)
# NOTE: Unlike #matches_spec? this method does not return true when the
# version is a prerelease version unless this is a prerelease dependency.

def match?(obj, version=nil, allow_prerelease=false)
def match?(obj, version = nil, allow_prerelease = false)
if !version
name = obj.name
version = obj.version
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/dependency_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def consider_remote?
# sources. Gems are sorted with newer gems preferred over older gems, and
# local gems preferred over remote gems.

def find_gems_with_sources(dep, best_only=false) # :nodoc:
def find_gems_with_sources(dep, best_only = false) # :nodoc:
set = Gem::AvailableSet.new

if consider_local?
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/dependency_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def why_not_ok?(quick = false)
# If removing the gemspec creates breaks a currently ok dependency, then it
# is NOT ok to remove the gemspec.

def ok_to_remove?(full_name, check_dev=true)
def ok_to_remove?(full_name, check_dev = true)
gem_to_remove = find_name full_name

# If the state is inconsistent, at least don't crash
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/deprecate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def deprecate(name, repl, year, month)
# telling the user of +repl+ (unless +repl+ is :none) and the
# Rubygems version that it is planned to go away.

def rubygems_deprecate(name, replacement=:none, version=nil)
def rubygems_deprecate(name, replacement = :none, version = nil)
class_eval do
old = "_deprecated_#{name}"
alias_method old, name
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LoadError < ::LoadError
# system. Instead of rescuing from this class, make sure to rescue from the
# superclass Gem::LoadError to catch all types of load errors.
class MissingSpecError < Gem::LoadError
def initialize(name, requirement, extra_message=nil)
def initialize(name, requirement, extra_message = nil)
@name = name
@requirement = requirement
@extra_message = extra_message
Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Gem::SpecificGemNotFoundException < Gem::GemNotFoundException
# and +version+. Any +errors+ encountered when attempting to find the gem
# are also stored.

def initialize(name, version, errors=nil)
def initialize(name, version, errors = nil)
super "Could not find a valid gem '#{name}' (#{version}) locally or in a repository"

@name = name
Expand Down Expand Up @@ -261,7 +261,7 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
# Creates a new UnsatisfiableDependencyError for the unsatisfiable
# Gem::Resolver::DependencyRequest +dep+

def initialize(dep, platform_mismatch=nil)
def initialize(dep, platform_mismatch = nil)
if platform_mismatch && !platform_mismatch.empty?
plats = platform_mismatch.map {|x| x.platform.to_s }.sort.uniq
super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(", ")}"
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/ext/cargo_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize
end

def build(extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd,
target_rbconfig=Gem.target_rbconfig)
target_rbconfig = Gem.target_rbconfig)
require "tempfile"
require "fileutils"

Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/ext/cmake_builder.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd,
target_rbconfig=Gem.target_rbconfig)
def self.build(extension, dest_path, results, args = [], lib_dir = nil, cmake_dir = Dir.pwd,
target_rbconfig = Gem.target_rbconfig)
if target_rbconfig.path
warn "--target-rbconfig is not yet supported for CMake extensions. Ignoring"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/ext/configure_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#++

class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd,
target_rbconfig=Gem.target_rbconfig)
def self.build(extension, dest_path, results, args = [], lib_dir = nil, configure_dir = Dir.pwd,
target_rbconfig = Gem.target_rbconfig)
if target_rbconfig.path
warn "--target-rbconfig is not yet supported for configure-based extensions. Ignoring"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/ext/ext_conf_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#++

class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd,
target_rbconfig=Gem.target_rbconfig)
def self.build(extension, dest_path, results, args = [], lib_dir = nil, extension_dir = Dir.pwd,
target_rbconfig = Gem.target_rbconfig)
require "fileutils"
require "tempfile"

Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/ext/rake_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#++

class Gem::Ext::RakeBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd,
target_rbconfig=Gem.target_rbconfig)
def self.build(extension, dest_path, results, args = [], lib_dir = nil, extension_dir = Dir.pwd,
target_rbconfig = Gem.target_rbconfig)
if target_rbconfig.path
warn "--target-rbconfig is not yet supported for Rake extensions. Ignoring"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def self.for_spec(spec, options = {})
# process. If not set, then Gem::Command.build_args is used
# :post_install_message:: Print gem post install message if true

def initialize(package, options={})
def initialize(package, options = {})
require "fileutils"

@options = options
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/name_tuple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# wrap the data returned from the indexes.

class Gem::NameTuple
def initialize(name, version, platform=Gem::Platform::RUBY)
def initialize(name, version, platform = Gem::Platform::RUBY)
@name = name
@version = version

Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/package/tar_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def initialize(io)
# Gem.source_date_epoch if not specified), and yields an IO for
# writing the file to

def add_file(name, mode, mtime=nil) # :yields: io
def add_file(name, mode, mtime = nil) # :yields: io
check_closed

name, prefix = split_name name
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/remote_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def self.fetcher
# +headers+: A set of additional HTTP headers to be sent to the server when
# fetching the gem.

def initialize(proxy=nil, dns=nil, headers={})
def initialize(proxy = nil, dns = nil, headers = {})
require_relative "core_ext/tcpsocket_init" if Gem.configuration.ipv4_fallback_enabled
require_relative "vendored_net_http"
require_relative "vendor/uri/lib/uri"
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def activation_request(dep, possible) # :nodoc:
[spec, activation_request]
end

def requests(s, act, reqs=[]) # :nodoc:
def requests(s, act, reqs = []) # :nodoc:
return reqs if @ignore_dependencies

s.fetch_development_dependencies if @development
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/resolver/conflict.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Gem::Resolver::Conflict
# Creates a new resolver conflict when +dependency+ is in conflict with an
# already +activated+ specification.

def initialize(dependency, activated, failed_dep=dependency)
def initialize(dependency, activated, failed_dep = dependency)
@dependency = dependency
@activated = activated
@failed_dep = failed_dep
Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def load_specs(type)
# Downloads +spec+ and writes it to +dir+. See also
# Gem::RemoteFetcher#download.

def download(spec, dir=Dir.pwd)
def download(spec, dir = Dir.pwd)
fetcher = Gem::RemoteFetcher.fetcher
fetcher.download spec, uri.to_s, dir
end
Expand All @@ -210,7 +210,7 @@ def pretty_print(q) # :nodoc:
end
end

def typo_squatting?(host, distance_threshold=4)
def typo_squatting?(host, distance_threshold = 4)
return if @uri.host.nil?
levenshtein_distance(@uri.host, host).between? 1, distance_threshold
end
Expand Down
8 changes: 4 additions & 4 deletions lib/rubygems/spec_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def initialize(sources = nil)
#
# If +matching_platform+ is false, gems for all platforms are returned.

def search_for_dependency(dependency, matching_platform=true)
def search_for_dependency(dependency, matching_platform = true)
found = {}

rejected_specs = {}
Expand Down Expand Up @@ -130,7 +130,7 @@ def search_for_dependency(dependency, matching_platform=true)
##
# Return all gem name tuples who's names match +obj+

def detect(type=:complete)
def detect(type = :complete)
tuples = []

list, _ = available_specs(type)
Expand All @@ -150,7 +150,7 @@ def detect(type=:complete)
#
# If +matching_platform+ is false, gems for all platforms are returned.

def spec_for_dependency(dependency, matching_platform=true)
def spec_for_dependency(dependency, matching_platform = true)
tuples, errors = search_for_dependency(dependency, matching_platform)

specs = []
Expand Down Expand Up @@ -280,7 +280,7 @@ def available_specs(type)
# Retrieves NameTuples from +source+ of the given +type+ (:prerelease,
# etc.). If +gracefully_ignore+ is true, errors are ignored.

def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
def tuples_for(source, type, gracefully_ignore = false) # :nodoc:
@caches[type][source.uri] ||=
source.load_specs(type).sort_by(&:name)
rescue Gem::RemoteFetcher::FetchError
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,7 @@ def dependencies
#
# [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]

def dependent_gems(check_dev=true)
def dependent_gems(check_dev = true)
out = []
Gem::Specification.each do |spec|
deps = check_dev ? spec.dependencies : spec.runtime_dependencies
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def truncate_text(text, description, max_length = 100_000)
# Wraps +text+ to +wrap+ characters and optionally indents by +indent+
# characters

def format_text(text, wrap, indent=0)
def format_text(text, wrap, indent = 0)
result = []
work = clean_text(text)

Expand Down
Loading
Loading