Skip to content

Commit 22e071a

Browse files
committed
Layout/SpaceAroundBlockParameters
This commit enables the Rubocop Layout/SpaceAroundBlockParameters cop and addresses all offenses.
1 parent 75a68f1 commit 22e071a

File tree

15 files changed

+16
-37
lines changed

15 files changed

+16
-37
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +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: EnforcedStyleInsidePipes.
27-
# SupportedStylesInsidePipes: space, no_space
28-
Layout/SpaceAroundBlockParameters:
29-
Exclude:
30-
- 'lib/puppet/functions/dig.rb'
31-
- 'lib/puppet/functions/filter.rb'
32-
- 'lib/puppet/node/environment.rb'
33-
- 'lib/puppet/pal/pal_impl.rb'
34-
- 'lib/puppet/pops/evaluator/compare_operator.rb'
35-
- 'lib/puppet/pops/evaluator/evaluator_impl.rb'
36-
- 'lib/puppet/pops/functions/dispatcher.rb'
37-
- 'lib/puppet/pops/types/string_converter.rb'
38-
- 'lib/puppet/provider/package/openbsd.rb'
39-
- 'lib/puppet/provider/package/pkg.rb'
40-
- 'lib/puppet/provider/package/yum.rb'
41-
- 'lib/puppet/resource/catalog.rb'
42-
- 'lib/puppet/type.rb'
43-
- 'lib/puppet/util.rb'
44-
- 'lib/puppet/util/docs.rb'
45-
4625
# This cop supports safe auto-correction (--auto-correct).
4726
# Configuration parameters: EnforcedStyle.
4827
# SupportedStyles: space, no_space

lib/puppet/functions/dig.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
def dig(data, *args)
3939
walked_path = []
40-
args.reduce(data) do | d, k |
40+
args.reduce(data) do |d, k|
4141
return nil if d.nil? || k.nil?
4242

4343
if !(d.is_a?(Array) || d.is_a?(Hash))

lib/puppet/functions/filter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def filter_Enumerable_2(enumerable)
123123
enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
124124
if enum.hash_style?
125125
result = {}
126-
enum.each {| k, v| result[k] = v if yield(k, v) }
126+
enum.each {|k, v| result[k] = v if yield(k, v) }
127127
result
128128
else
129129
result = []

lib/puppet/node/environment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def perform_initial_import
597597
elsif File.directory?(file)
598598
# JRuby does not properly perform Dir.glob operations with wildcards, (see PUP-11788 and https://github.com/jruby/jruby/issues/7836).
599599
# We sort the results because Dir.glob order is inconsistent in Ruby < 3 (see PUP-10115).
600-
parse_results = Puppet::FileSystem::PathPattern.absolute(File.join(file, '**/*')).glob.select {|globbed_file| globbed_file.end_with?('.pp')}.sort.map do | file_to_parse |
600+
parse_results = Puppet::FileSystem::PathPattern.absolute(File.join(file, '**/*')).glob.select {|globbed_file| globbed_file.end_with?('.pp')}.sort.map do |file_to_parse|
601601
parser.file = file_to_parse
602602
parser.parse
603603
end

lib/puppet/pal/pal_impl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ def self.main(
480480
# TODO: The compiler instances should be available under non PAL use as well!
481481
# TRANSLATORS: Do not translate, symbolic name
482482
Puppet.override(overrides, "PAL::with_#{internal_compiler_class}_compiler") do
483-
compiler.compile do | _compiler_yield |
483+
compiler.compile do |_compiler_yield|
484484
# In case the variables passed to the compiler are PCore types defined in modules, they
485485
# need to be deserialized and added from within the this scope, so that loaders are
486486
# available during deserizlization.

lib/puppet/pops/evaluator/compare_operator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def match_Array(array, left, scope)
248248
return false unless left.is_a?(Array)
249249
return false unless left.length == array.length
250250

251-
array.each_with_index.all? { | pattern, index| match(left[index], pattern, scope) }
251+
array.each_with_index.all? { |pattern, index| match(left[index], pattern, scope) }
252252
end
253253

254254
def match_Hash(hash, left, scope)

lib/puppet/pops/evaluator/evaluator_impl.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ def eval_ResourceExpression(o, scope)
819819
body_to_params = {}
820820

821821
# titles are evaluated before attribute operations
822-
o.bodies.map do | body |
822+
o.bodies.map do |body|
823823
titles = evaluate(body.title, scope)
824824

825825
# Title may not be nil
@@ -879,7 +879,7 @@ def eval_ResourceExpression(o, scope)
879879
# evaluating the ResourceExpression.
880880
#
881881
defaults_hash = body_to_params[titles_to_body[:default]] || {}
882-
o.bodies.map do | body |
882+
o.bodies.map do |body|
883883
titles = body_to_titles[body]
884884
params = defaults_hash.merge(body_to_params[body] || {})
885885
create_resources(o, scope, virtual, exported, type_name, titles, params.values)

lib/puppet/pops/functions/dispatcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def to_type()
6262
# make a copy to make sure it can be contained by someone else (even if it is not contained here, it
6363
# should be treated as immutable).
6464
#
65-
callables = dispatchers.map { | dispatch | dispatch.type }
65+
callables = dispatchers.map { |dispatch| dispatch.type }
6666

6767
# multiple signatures, produce a Variant type of Callable1-n (must copy them)
6868
# single signature, produce single Callable

lib/puppet/pops/types/string_converter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def validate_input(fmt)
535535
raise ArgumentError, "expected a hash with type to format mappings, got instance of '#{fmt.class}'"
536536
end
537537

538-
fmt.reduce({}) do | result, entry|
538+
fmt.reduce({}) do |result, entry|
539539
key, value = entry
540540
unless key.is_a?(Types::PAnyType)
541541
raise ArgumentError, "top level keys in the format hash must be data types, got instance of '#{key.class}'"
@@ -968,7 +968,7 @@ def string_PArrayType(val_type, val, format_map, indentation)
968968
# compute widest run in the array, skip nested arrays and hashes
969969
# then if size > width, set flag if a break on each element should be performed
970970
if format.alt? && format.width
971-
widest = val.each_with_index.reduce([0]) do | memo, v_i |
971+
widest = val.each_with_index.reduce([0]) do |memo, v_i|
972972
# array or hash breaks
973973
if is_a_or_h?(v_i[0])
974974
memo << 0

lib/puppet/provider/package/openbsd.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def latest
104104
return match[2]
105105
end
106106

107-
vcmp = version.split('.').map{|s|s.to_i} <=> match[2].split('.').map{|s|s.to_i}
107+
vcmp = version.split('.').map{|s| s.to_i} <=> match[2].split('.').map{|s| s.to_i}
108108
if vcmp > 0
109109
# The locally installed package may actually be newer than what a mirror
110110
# has. Log it at debug, but ignore it otherwise.

0 commit comments

Comments
 (0)