Skip to content

Commit e298c24

Browse files
committed
Layout/SpaceInsideParens
This commit enables the Rubocop Layout/SpaceInsideParens cop and addresses all offenses.
1 parent f140c82 commit e298c24

Some content is hidden

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

52 files changed

+110
-116
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +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.
27-
# SupportedStyles: space, compact, no_space
28-
Layout/SpaceInsideParens:
29-
Enabled: false
30-
3125
# This cop supports safe auto-correction (--auto-correct).
3226
Layout/SpaceInsidePercentLiteralDelimiters:
3327
Exclude:

lib/hiera/scope.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def safe_lookupvar(key)
4646
# do nothing
4747
when :warning
4848
Puppet.warn_once(Puppet::Parser::Scope::UNDEFINED_VARIABLES_KIND, _("Variable: %{name}") % { name: key },
49-
_("Undefined variable '%{name}'; %{reason}") % { name: key, reason: reason } )
49+
_("Undefined variable '%{name}'; %{reason}") % { name: key, reason: reason })
5050
when :error
5151
raise ArgumentError, _("Undefined variable '%{name}'; %{reason}") % { name: key, reason: reason }
5252
end

lib/puppet/application.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Application
109109
require_relative '../puppet/util'
110110
include Puppet::Util
111111

112-
DOCPATTERN = ::File.expand_path(::File.dirname(__FILE__) + "/util/command_line/*" )
112+
DOCPATTERN = ::File.expand_path(::File.dirname(__FILE__) + "/util/command_line/*")
113113
CommandLineArgs = Struct.new(:subcommand_name, :args)
114114

115115
@loader = Puppet::Util::Autoload.new(self, 'puppet/application')
@@ -178,7 +178,7 @@ def controlled_run(&block)
178178

179179
# used to declare code that handle an option
180180
def option(*options, &block)
181-
long = options.find { |opt| opt =~ /^--/ }.gsub(/^--(?:\[no-\])?([^ =]+).*$/, '\1' ).tr('-', '_')
181+
long = options.find { |opt| opt =~ /^--/ }.gsub(/^--(?:\[no-\])?([^ =]+).*$/, '\1').tr('-', '_')
182182
fname = "handle_#{long}".intern
183183
if (block_given?)
184184
define_method(fname, &block)

lib/puppet/application/device.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,9 @@ def find_resources(type, name)
399399
key = [type, name].join('/')
400400

401401
if name
402-
[Puppet::Resource.indirection.find( key )]
402+
[Puppet::Resource.indirection.find(key)]
403403
else
404-
Puppet::Resource.indirection.search( key, {} )
404+
Puppet::Resource.indirection.search(key, {})
405405
end
406406
end
407407

lib/puppet/application/doc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ module - see https://github.com/puppetlabs/puppetlabs-strings for more informati
116116
HELP
117117
end
118118

119-
def handle_unknown( opt, arg )
119+
def handle_unknown(opt, arg)
120120
@unknown_args << { :opt => opt, :arg => arg }
121121
true
122122
end

lib/puppet/application/resource.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ def find_or_save_resources(type, name, params)
231231
Puppet.override(stringify_rich: true) do
232232
if name
233233
if params.empty?
234-
[Puppet::Resource.indirection.find( key )]
234+
[Puppet::Resource.indirection.find(key)]
235235
else
236-
resource = Puppet::Resource.new( type, name, :parameters => params )
236+
resource = Puppet::Resource.new(type, name, :parameters => params)
237237

238238
# save returns [resource that was saved, transaction log from applying the resource]
239239
save_result = Puppet::Resource.indirection.save(resource, key)
@@ -244,7 +244,7 @@ def find_or_save_resources(type, name, params)
244244
raise _("Listing all file instances is not supported. Please specify a file or directory, e.g. puppet resource file /etc")
245245
end
246246

247-
Puppet::Resource.indirection.search( key, {} )
247+
Puppet::Resource.indirection.search(key, {})
248248
end
249249
end
250250
end

lib/puppet/external/dot.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def initialize(params = {})
165165
end
166166

167167
def to_s
168-
( @name && @name != "" ? "<#{@name}>" : "" ) + "#{@label}"
168+
(@name && @name != "" ? "<#{@name}>" : "") + "#{@label}"
169169
end
170170
end
171171

@@ -204,14 +204,14 @@ def to_s(t = '')
204204
t + $tab2 + "#{stringify(@options['label'])}| \\\n" +
205205
@ports.collect { |i|
206206
t + $tab2 + i.to_s
207-
}.join( "| \\\n" ) + " \\\n" +
207+
}.join("| \\\n") + " \\\n" +
208208
t + $tab + '"' + "\n"
209209

210210
t + "#{@name} [\n" +
211211
@options.to_a.collect { |i|
212212
i[1] && i[0] != 'label' ?
213213
t + $tab + "#{i[0]} = #{i[1]}" : nil
214-
}.compact.join( ",\n" ) + ( label != '' ? ",\n" : "\n" ) +
214+
}.compact.join(",\n") + (label != '' ? ",\n" : "\n") +
215215
label +
216216
t + "]\n"
217217
end
@@ -242,7 +242,7 @@ def <<(thing)
242242
end
243243

244244
def push(thing)
245-
@nodes.push( thing )
245+
@nodes.push(thing)
246246
end
247247

248248
def pop
@@ -256,11 +256,11 @@ def to_s(t = '')
256256
val && name != 'label' ?
257257
t + $tab + "#{name} = #{val}" :
258258
name ? t + $tab + "#{name} = \"#{val}\"" : nil
259-
}.compact.join( "\n" ) + "\n"
259+
}.compact.join("\n") + "\n"
260260

261261
nodes = @nodes.collect { |i|
262-
i.to_s( t + $tab )
263-
}.join( "\n" ) + "\n"
262+
i.to_s(t + $tab)
263+
}.join("\n") + "\n"
264264
hdr + options + nodes + t + "}\n"
265265
end
266266
end
@@ -295,7 +295,7 @@ def to_s(t = '')
295295
i[1] && i[0] != 'label' ?
296296
t + $tab + "#{i[0]} = #{i[1]}" :
297297
i[1] ? t + $tab + "#{i[0]} = \"#{i[1]}\"" : nil
298-
}.compact.join( "\n" ) + "\n#{t}]\n"
298+
}.compact.join("\n") + "\n#{t}]\n"
299299
end
300300
end
301301

lib/puppet/face/parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def validate_manifest(manifest = nil)
213213
env = Puppet.lookup(:current_environment)
214214
loaders = Puppet::Pops::Loaders.new(env)
215215

216-
Puppet.override( { :loaders => loaders }, _('For puppet parser validate')) do
216+
Puppet.override({ :loaders => loaders }, _('For puppet parser validate')) do
217217
begin
218218
validation_environment = manifest ? env.override_with(:manifest => manifest) : env
219219
validation_environment.check_for_reparse

lib/puppet/file_bucket/dipper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def list(fromdate, todate)
177177

178178
private
179179

180-
def absolutize_path( path )
180+
def absolutize_path(path)
181181
Pathname.new(path).realpath
182182
end
183183
end

lib/puppet/file_system/windows.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ def chmod(mode, path)
114114
end
115115

116116
def read_preserve_line_endings(path)
117-
contents = path.read( :mode => 'rb', :encoding => 'bom|utf-8')
118-
contents = path.read( :mode => 'rb', :encoding => "bom|#{Encoding::default_external.name}") unless contents.valid_encoding?
117+
contents = path.read(:mode => 'rb', :encoding => 'bom|utf-8')
118+
contents = path.read(:mode => 'rb', :encoding => "bom|#{Encoding::default_external.name}") unless contents.valid_encoding?
119119
contents = path.read unless contents.valid_encoding?
120120

121121
contents

0 commit comments

Comments
 (0)