Skip to content

Commit 5a1b67d

Browse files
committed
Layout/SpaceBeforeBlockBraces
This commit enables the Rubocop Layout/SpaceBeforeBlockBraces cop and addresses all offenses.
1 parent 9f8fb93 commit 5a1b67d

32 files changed

+49
-56
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.
27-
# SupportedStyles: space, no_space
28-
# SupportedStylesForEmptyBraces: space, no_space
29-
Layout/SpaceBeforeBlockBraces:
30-
Enabled: false
31-
3225
# This cop supports safe auto-correction (--auto-correct).
3326
Layout/SpaceBeforeComma:
3427
Exclude:

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/external/dot.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,18 @@ def initialize(params = {}, option_list = [])
138138
@name = params['name'] ? params['name'] : nil
139139
@parent = params['parent'] ? params['parent'] : nil
140140
@options = {}
141-
option_list.each{ |i|
141+
option_list.each { |i|
142142
@options[i] = params[i] if params[i]
143143
}
144144
@options['label'] ||= @name if @name != 'node'
145145
end
146146

147147
def each_option
148-
@options.each{ |i| yield i }
148+
@options.each { |i| yield i }
149149
end
150150

151151
def each_option_pair
152-
@options.each_pair{ |key, val| yield key, val }
152+
@options.each_pair { |key, val| yield key, val }
153153
end
154154
end
155155

@@ -202,13 +202,13 @@ def to_s(t = '')
202202
'' :
203203
t + $tab + 'label = "' + " \\\n" +
204204
t + $tab2 + "#{stringify(@options['label'])}| \\\n" +
205-
@ports.collect{ |i|
205+
@ports.collect { |i|
206206
t + $tab2 + i.to_s
207207
}.join( "| \\\n" ) + " \\\n" +
208208
t + $tab + '"' + "\n"
209209

210210
t + "#{@name} [\n" +
211-
@options.to_a.collect{ |i|
211+
@options.to_a.collect { |i|
212212
i[1] && i[0] != 'label' ?
213213
t + $tab + "#{i[0]} = #{i[1]}" : nil
214214
}.compact.join( ",\n" ) + ( label != '' ? ",\n" : "\n" ) +
@@ -234,7 +234,7 @@ def initialize(params = {}, option_list = GRAPH_OPTS)
234234
end
235235

236236
def each_node
237-
@nodes.each{ |i| yield i }
237+
@nodes.each { |i| yield i }
238238
end
239239

240240
def <<(thing)
@@ -252,13 +252,13 @@ def pop
252252
def to_s(t = '')
253253
hdr = t + "#{@dot_string} #{@name} {\n"
254254

255-
options = @options.to_a.collect{ |name, val|
255+
options = @options.to_a.collect { |name, val|
256256
val && name != 'label' ?
257257
t + $tab + "#{name} = #{val}" :
258258
name ? t + $tab + "#{name} = \"#{val}\"" : nil
259259
}.compact.join( "\n" ) + "\n"
260260

261-
nodes = @nodes.collect{ |i|
261+
nodes = @nodes.collect { |i|
262262
i.to_s( t + $tab )
263263
}.join( "\n" ) + "\n"
264264
hdr + options + nodes + t + "}\n"
@@ -291,7 +291,7 @@ def edge_link
291291

292292
def to_s(t = '')
293293
t + "#{@from} #{edge_link} #{to} [\n" +
294-
@options.to_a.collect{ |i|
294+
@options.to_a.collect { |i|
295295
i[1] && i[0] != 'label' ?
296296
t + $tab + "#{i[0]} = #{i[1]}" :
297297
i[1] ? t + $tab + "#{i[0]} = \"#{i[1]}\"" : nil

lib/puppet/file_system/file_impl.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ def exclusive_open(path, mode, options = 'r', timeout = 300, &block)
5555
while !written
5656
::File.open(path, options, mode) do |rf|
5757
if rf.flock(::File::LOCK_EX | ::File::LOCK_NB)
58-
Puppet.debug{ _("Locked '%{path}'") % { path: path } }
58+
Puppet.debug { _("Locked '%{path}'") % { path: path } }
5959
yield rf
6060
written = true
61-
Puppet.debug{ _("Unlocked '%{path}'") % { path: path } }
61+
Puppet.debug { _("Unlocked '%{path}'") % { path: path } }
6262
else
63-
Puppet.debug{ "Failed to lock '%s' retrying in %.2f milliseconds" % [path, wait * 1000] }
63+
Puppet.debug { "Failed to lock '%s' retrying in %.2f milliseconds" % [path, wait * 1000] }
6464
sleep wait
6565
timeout -= wait
6666
wait *= 2

lib/puppet/forge/cache.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def read_retrieve(uri)
4343

4444
# Return Pathname for repository's cache directory, create it if needed.
4545
def path
46-
(self.class.base_path + @repository.cache_key).tap{ |o| o.mkpath }
46+
(self.class.base_path + @repository.cache_key).tap { |o| o.mkpath }
4747
end
4848

4949
# Return the base Pathname for all the caches.

lib/puppet/graph/simple_graph.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def paths_in_cycle(cycle, max_paths = 1)
205205
# Calculate our filtered outbound vertex lists...
206206
adj = {}
207207
cycle.each do |vertex|
208-
adj[vertex] = adjacent(vertex).select{|s| cycle.member? s}
208+
adj[vertex] = adjacent(vertex).select {|s| cycle.member? s}
209209
end
210210

211211
found = []
@@ -236,7 +236,7 @@ def report_cycles_in_graph
236236

237237
cycles.each do |cycle|
238238
paths = paths_in_cycle(cycle)
239-
message += paths.map{ |path| '(' + path.join(' => ') + ')'}.join('\n') + '\n'
239+
message += paths.map { |path| '(' + path.join(' => ') + ')'}.join('\n') + '\n'
240240
end
241241

242242
if Puppet[:graph] then

lib/puppet/interface/documentation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def author=(value)
233233
raise ArgumentError, _('author should be a single line; use multiple statements')
234234
end
235235

236-
@authors = Array(value).map{|x| Puppet::Interface::DocGen.strip_whitespace(x) }
236+
@authors = Array(value).map {|x| Puppet::Interface::DocGen.strip_whitespace(x) }
237237
end
238238
alias :authors= :author=
239239

lib/puppet/network/formats.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def render(datum)
159159
# Simple hash to table
160160
if datum.is_a?(Hash) && datum.keys.all? { |x| x.is_a?(String) || x.is_a?(Numeric) }
161161
output = ''.dup
162-
column_a = datum.empty? ? 2 : datum.map{ |k, _v| k.to_s.length }.max + 2
162+
column_a = datum.empty? ? 2 : datum.map { |k, _v| k.to_s.length }.max + 2
163163
datum.sort_by { |k, _v| k.to_s }.each do |key, value|
164164
output << key.to_s.ljust(column_a)
165165
output << json.render(value)

lib/puppet/network/http/handler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def register(routes)
2121
routes.each { |r| dupes[r.path_matcher] = (dupes[r.path_matcher] || 0) + 1 }
2222
dupes = dupes.collect { |pm, count| pm if count > 1 }.compact
2323
if dupes.count > 0
24-
raise ArgumentError, _("Given multiple routes with identical path regexes: %{regexes}") % { regexes: dupes.map{ |rgx| rgx.inspect }.join(', ') }
24+
raise ArgumentError, _("Given multiple routes with identical path regexes: %{regexes}") % { regexes: dupes.map { |rgx| rgx.inspect }.join(', ') }
2525
end
2626

2727
@routes = routes

lib/puppet/parser/scope.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def variable_not_found(name, reason = nil)
535535
Puppet.warn_once(UNDEFINED_VARIABLES_KIND, _("Variable: %{name}") % { name: name },
536536
_("Undefined variable '%{name}'; %{reason}") % { name: name, reason: reason } )
537537
when :error
538-
if Puppet.lookup(:avoid_hiera_interpolation_errors){false}
538+
if Puppet.lookup(:avoid_hiera_interpolation_errors) {false}
539539
Puppet.warn_once(UNDEFINED_VARIABLES_KIND, _("Variable: %{name}") % { name: name },
540540
_("Interpolation failed with '%{name}', but compilation continuing; %{reason}") % { name: name, reason: reason } )
541541
else

0 commit comments

Comments
 (0)