Skip to content

Commit dd55779

Browse files
Merge pull request #8920 from rubygems/deivid-rodriguez/enable-spaces-around-optional-parameters
Use spaces around optional parameter values
2 parents 3a42889 + e81a4c1 commit dd55779

34 files changed

+65
-62
lines changed

.git-blame-ignore-revs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# .git-blame-ignore-revs
2-
# RubyGems
3-
# Enable Style/StringLiterals cop
2+
# [RuboCop] Enable Style/StringLiterals in RubyGems
43
dca5fa728437383428a593644f537aaa1020ee63
5-
# enable Style/MethodDefParentheses in Rubocop
4+
# [RuboCop] Enable Style/MethodDefParentheses in RubyGems
65
79e6bafd945e358480ac2253995e82e229bb4f5c
7-
# Bundler
8-
# [RuboCop] Enable Style/StringLiterals
6+
# [RuboCop] Enable Style/StringLiterals in Bundler
97
b0d532adb80521271fbde4d3955c252f2ee09a5c
10-
# [RuboCop] Enable Style/SymbolProc
8+
# [RuboCop] Enable Style/SymbolProc in Bundler
119
cf58bc4b1ee83b2697fbdbcc76ced09515525141
12-
# [RuboCop] Enable Style/EmptyLines
10+
# [RuboCop] Enable Style/EmptyLines in Bundler
1311
ff426fdbc1bde3582b6e1d5137abd21d74c38f87
14-
# Use modern hashes consistently
12+
# [RuboCop] Use modern hashes consistently in Bundler
1513
bb66253f2ceddee527b82971423348d8bbc1b606
14+
# [RuboCop] Enable Layout/SpaceAroundEqualsInParameterDefault
15+
cf085f1d11e729732657991baa2de010a51f4378

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ Layout/AssignmentIndentation:
290290
Layout/EmptyLinesAroundExceptionHandlingKeywords:
291291
Enabled: true
292292

293+
Layout/SpaceAroundEqualsInParameterDefault:
294+
Enabled: true
295+
293296
Layout/SpaceInsideArrayLiteralBrackets:
294297
Enabled: true
295298

bundler/lib/bundler/resolver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def parse_dependency(package, dependency)
165165
PubGrub::VersionConstraint.new(package, range: range)
166166
end
167167

168-
def versions_for(package, range=VersionRange.any)
168+
def versions_for(package, range = VersionRange.any)
169169
range.select_versions(@sorted_versions[package])
170170
end
171171

bundler/lib/bundler/rubygems_ext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ class NameTuple
417417
unless Gem::NameTuple.new("a", Gem::Version.new("1"), Gem::Platform.new("x86_64-linux")).platform.is_a?(String)
418418
alias_method :initialize_with_platform, :initialize
419419

420-
def initialize(name, version, platform=Gem::Platform::RUBY)
420+
def initialize(name, version, platform = Gem::Platform::RUBY)
421421
if Gem::Platform === platform
422422
initialize_with_platform(name, version, platform.to_s)
423423
else

lib/rubygems.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def self.needs
224224
finish_resolve rs
225225
end
226226

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

@@ -341,7 +341,7 @@ def self.binary_mode
341341
##
342342
# The path where gem executables are to be installed.
343343

344-
def self.bindir(install_dir=Gem.dir)
344+
def self.bindir(install_dir = Gem.dir)
345345
return File.join install_dir, "bin" unless
346346
install_dir.to_s == Gem.default_dir.to_s
347347
Gem.default_bindir
@@ -350,7 +350,7 @@ def self.bindir(install_dir=Gem.dir)
350350
##
351351
# The path were rubygems plugins are to be installed.
352352

353-
def self.plugindir(install_dir=Gem.dir)
353+
def self.plugindir(install_dir = Gem.dir)
354354
File.join install_dir, "plugins"
355355
end
356356

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

537-
def self.find_files(glob, check_load_path=true)
537+
def self.find_files(glob, check_load_path = true)
538538
files = []
539539

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

574-
def self.find_latest_files(glob, check_load_path=true)
574+
def self.find_latest_files(glob, check_load_path = true)
575575
files = []
576576

577577
files = find_files_from_load_path glob if check_load_path

lib/rubygems/command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def self.specific_extra_args_hash
117117
# Unhandled arguments (gem names, files, etc.) are left in
118118
# <tt>options[:args]</tt>.
119119

120-
def initialize(command, summary=nil, defaults={})
120+
def initialize(command, summary = nil, defaults = {})
121121
@command = command
122122
@summary = summary
123123
@program_name = "gem #{command}"

lib/rubygems/command_manager.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def initialize
118118
##
119119
# Register the Symbol +command+ as a gem command.
120120

121-
def register_command(command, obj=false)
121+
def register_command(command, obj = false)
122122
@commands[command] = obj
123123
end
124124

@@ -148,7 +148,7 @@ def command_names
148148
##
149149
# Run the command specified by +args+.
150150

151-
def run(args, build_args=nil)
151+
def run(args, build_args = nil)
152152
process_args(args, build_args)
153153
rescue StandardError, Gem::Timeout::Error => ex
154154
if ex.respond_to?(:detailed_message)
@@ -165,7 +165,7 @@ def run(args, build_args=nil)
165165
terminate_interaction(1)
166166
end
167167

168-
def process_args(args, build_args=nil)
168+
def process_args(args, build_args = nil)
169169
if args.empty?
170170
say Gem::Command::HELP
171171
terminate_interaction 1

lib/rubygems/dependency.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def =~(other)
217217
# NOTE: Unlike #matches_spec? this method does not return true when the
218218
# version is a prerelease version unless this is a prerelease dependency.
219219

220-
def match?(obj, version=nil, allow_prerelease=false)
220+
def match?(obj, version = nil, allow_prerelease = false)
221221
if !version
222222
name = obj.name
223223
version = obj.version

lib/rubygems/dependency_installer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def consider_remote?
127127
# sources. Gems are sorted with newer gems preferred over older gems, and
128128
# local gems preferred over remote gems.
129129

130-
def find_gems_with_sources(dep, best_only=false) # :nodoc:
130+
def find_gems_with_sources(dep, best_only = false) # :nodoc:
131131
set = Gem::AvailableSet.new
132132

133133
if consider_local?

lib/rubygems/dependency_list.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def why_not_ok?(quick = false)
140140
# If removing the gemspec creates breaks a currently ok dependency, then it
141141
# is NOT ok to remove the gemspec.
142142

143-
def ok_to_remove?(full_name, check_dev=true)
143+
def ok_to_remove?(full_name, check_dev = true)
144144
gem_to_remove = find_name full_name
145145

146146
# If the state is inconsistent, at least don't crash

0 commit comments

Comments
 (0)