Skip to content

Commit 735ec34

Browse files
committed
Layout/SpaceInsideBlockBraces
This commit enables the Rubocop Layout/SpaceInsideBlockBraces cop and addresses all offenses.
1 parent b26d640 commit 735ec34

File tree

147 files changed

+324
-331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+324
-331
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ I18n/GetText/DecorateStringFormattingUsingPercent:
2222
I18n/RailsI18n/DecorateString:
2323
Enabled: false
2424

25-
# This cop supports safe auto-correction (--auto-correct).
26-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
27-
# SupportedStyles: space, no_space
28-
# SupportedStylesForEmptyBraces: space, no_space
29-
Layout/SpaceInsideBlockBraces:
30-
Enabled: false
31-
3225
# This cop supports safe auto-correction (--auto-correct).
3326
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
3427
# SupportedStyles: space, no_space, compact

lib/puppet/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def log_runtime_environment(extra_info = nil)
514514
runtime_info['default_encoding'] = Encoding.default_external
515515
runtime_info.merge!(extra_info) unless extra_info.nil?
516516

517-
Puppet.debug 'Runtime environment: ' + runtime_info.map {|k, v| k + '=' + v.to_s}.join(', ')
517+
Puppet.debug 'Runtime environment: ' + runtime_info.map { |k, v| k + '=' + v.to_s }.join(', ')
518518
end
519519

520520
# Options defined with the `option` method are parsed from settings and the command line.

lib/puppet/application/lookup.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def main
283283
unless merge.nil?
284284
strategies = Puppet::Pops::MergeStrategy.strategy_keys
285285
unless strategies.include?(merge.to_sym)
286-
strategies = strategies.map {|k| "'#{k}'"}
286+
strategies = strategies.map { |k| "'#{k}'" }
287287
raise _("The --merge option only accepts %{strategies}, or %{last_strategy}\n%{run_help}") % { strategies: strategies[0...-1].join(', '), last_strategy: strategies.last, run_help: RUN_HELP }
288288
end
289289

lib/puppet/context/trusted_information.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ def self.retrieve_trusted_external(certname)
9393
def self.deep_freeze(object)
9494
case object
9595
when Array
96-
object.each {|v| deep_freeze(v) }
96+
object.each { |v| deep_freeze(v) }
9797
object.freeze
9898
when Hash
99-
object.each {|k, v| deep_freeze(k); deep_freeze(v) }
99+
object.each { |k, v| deep_freeze(k); deep_freeze(v) }
100100
object.freeze
101101
when NilClass, Numeric, TrueClass, FalseClass
102102
# do nothing

lib/puppet/environments.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def get_conf(name)
317317
end
318318

319319
def clear_all
320-
@loaders.each {|loader| loader.clear_all}
320+
@loaders.each { |loader| loader.clear_all }
321321
end
322322
end
323323

@@ -372,7 +372,7 @@ def list
372372
removed_envs = cached_envs - loader_envs
373373

374374
removed_envs.each do |env_name|
375-
Puppet.debug { "Environment no longer exists '#{env_name}'"}
375+
Puppet.debug { "Environment no longer exists '#{env_name}'" }
376376
clear(env_name)
377377
end
378378

@@ -409,7 +409,7 @@ def get_entry(name, check_expired = true)
409409
name = name.to_sym
410410
entry = @cache[name]
411411
if entry
412-
Puppet.debug {"Found in cache #{name.inspect} #{entry.label}"}
412+
Puppet.debug { "Found in cache #{name.inspect} #{entry.label}" }
413413
# found in cache
414414
entry.touch
415415
elsif (env = @loader.get(name))
@@ -423,15 +423,15 @@ def get_entry(name, check_expired = true)
423423

424424
# Adds a cache entry to the cache
425425
def add_entry(name, cache_entry)
426-
Puppet.debug {"Caching environment #{name.inspect} #{cache_entry.label}"}
426+
Puppet.debug { "Caching environment #{name.inspect} #{cache_entry.label}" }
427427
@cache[name] = cache_entry
428428
@cache_expiration_service.created(cache_entry.value)
429429
end
430430
private :add_entry
431431

432432
def clear_entry(name, entry)
433433
@cache.delete(name)
434-
Puppet.debug {"Evicting cache entry for environment #{name.inspect}"}
434+
Puppet.debug { "Evicting cache entry for environment #{name.inspect}" }
435435
@cache_expiration_service.evicted(name.to_sym)
436436
Puppet::GettextConfig.delete_text_domain(name)
437437
Puppet.settings.clear_environment_settings(name)

lib/puppet/face/catalog/select.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
if value.nil? then
4545
_("no matching resources found")
4646
else
47-
value.map {|x| x.to_s }.join("\n")
47+
value.map { |x| x.to_s }.join("\n")
4848
end
4949
end
5050
end

lib/puppet/face/module/list.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
# The modules with fewest things depending on them will be the
8888
# parent of the tree. Can't assume to start with 0 dependencies
8989
# since dependencies may be cyclical.
90-
modules_by_num_requires = modules.sort_by {|m| m.required_by.size}
90+
modules_by_num_requires = modules.sort_by { |m| m.required_by.size }
9191
@seen = {}
9292
tree = list_build_tree(modules_by_num_requires, [], nil,
9393
:label_unmet => true, :path => path, :label_invalid => false)
@@ -117,7 +117,7 @@ def unmet_dependencies(environment)
117117
end
118118

119119
# Prepare the unmet dependencies for display on the console.
120-
environment.modules.sort_by {|mod| mod.name}.each do |mod|
120+
environment.modules.sort_by { |mod| mod.name }.each do |mod|
121121
unmet_grouped = Hash.new { |h, k| h[k] = [] }
122122
unmet_grouped = mod.unmet_dependencies.inject(unmet_grouped) do |acc, dep|
123123
acc[dep[:reason]] << dep

lib/puppet/face/parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
end
6666

6767
unless missing_files.empty?
68-
raise Puppet::Error, _("One or more file(s) specified did not exist:\n%{files}") % { files: missing_files.collect {|f| " " * 3 + f + "\n"} }
68+
raise Puppet::Error, _("One or more file(s) specified did not exist:\n%{files}") % { files: missing_files.collect { |f| " " * 3 + f + "\n" } }
6969
end
7070

7171
parse_errors

lib/puppet/file_system.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def self.readlink(path)
288288
# @api public
289289
#
290290
def self.unlink(*paths)
291-
@impl.unlink(*(paths.map {|p| assert_path(p) }))
291+
@impl.unlink(*(paths.map { |p| assert_path(p) }))
292292
end
293293

294294
# @return [File::Stat] object for the named file.

lib/puppet/functions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ def self.from_to_names(func_info)
797797
end
798798
# Names of parameters, up to 5 are optimized and use frozen version
799799
# Note that (0..count-1) produces expected empty array for count == 0, 0-n for count >= 1
800-
names = count <= 5 ? PARAM_NAMES[count] : (0..count - 1).map {|n| "p#{n}" }
800+
names = count <= 5 ? PARAM_NAMES[count] : (0..count - 1).map { |n| "p#{n}" }
801801
[from, to, names]
802802
end
803803
end

0 commit comments

Comments
 (0)