Skip to content

Commit 9f8fb93

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

Some content is hidden

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

72 files changed

+161
-167
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: AllowForAlignment, EnforcedStyleForExponentOperator.
27-
# SupportedStylesForExponentOperator: space, no_space
28-
Layout/SpaceAroundOperators:
29-
Enabled: false
30-
3125
# This cop supports safe auto-correction (--auto-correct).
3226
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
3327
# SupportedStyles: space, no_space

lib/hiera/puppet_function.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ def lookup(scope, key, default, has_default, override, &default_block)
6464
unless Puppet[:strict] == :off
6565
# TRANSLATORS 'lookup' is a puppet function and should not be translated
6666
message = _("The function '%{class_name}' is deprecated in favor of using 'lookup'.") % { class_name: self.class.name }
67-
message += ' '+ _("See https://puppet.com/docs/puppet/%{minor_version}/deprecated_language.html") %
68-
{ minor_version: Puppet.minor_version }
67+
message += ' ' + _("See https://puppet.com/docs/puppet/%{minor_version}/deprecated_language.html") %
68+
{ minor_version: Puppet.minor_version }
6969
Puppet.warn_once('deprecations', self.class.name, message)
7070
end
7171
lookup_invocation = Puppet::Pops::Lookup::Invocation.new(scope, {}, {})

lib/puppet.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ def self.clear
101101

102102
def self.debug=(value)
103103
if value
104-
Puppet::Util::Log.level=(:debug)
104+
Puppet::Util::Log.level = (:debug)
105105
else
106-
Puppet::Util::Log.level=(:notice)
106+
Puppet::Util::Log.level = (:notice)
107107
end
108108
end
109109

lib/puppet/application/doc.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def preinit
3333

3434
option("--mode MODE", "-m") do |arg|
3535
require_relative '../../puppet/util/reference'
36-
if Puppet::Util::Reference.modes.include?(arg) or arg.intern==:rdoc
36+
if Puppet::Util::Reference.modes.include?(arg) or arg.intern == :rdoc
3737
options[:mode] = arg.intern
3838
else
3939
raise _("Invalid output mode %{arg}") % { arg: arg }
@@ -217,7 +217,7 @@ def setup_rdoc
217217
if @unknown_args.size > 0
218218
@unknown_args.each do |option|
219219
# force absolute path for modulepath when passed on commandline
220-
if option[:opt]=="--modulepath"
220+
if option[:opt] == "--modulepath"
221221
option[:arg] = option[:arg].split(::File::PATH_SEPARATOR).collect { |p| ::File.expand_path(p) }.join(::File::PATH_SEPARATOR)
222222
end
223223
Puppet.settings.handlearg(option[:opt], option[:arg])

lib/puppet/application/face_base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def main
248248
# --daniel 2011-04-27
249249
if (arity = @action.positional_arg_count) > 0
250250
unless (count = arguments.length) == arity then
251-
raise ArgumentError, n_("puppet %{face} %{action} takes %{arg_count} argument, but you gave %{given_count}", "puppet %{face} %{action} takes %{arg_count} arguments, but you gave %{given_count}", arity - 1) % { face: @face.name, action: @action.name, arg_count: arity-1, given_count: count-1 }
251+
raise ArgumentError, n_("puppet %{face} %{action} takes %{arg_count} argument, but you gave %{given_count}", "puppet %{face} %{action} takes %{arg_count} arguments, but you gave %{given_count}", arity - 1) % { face: @face.name, action: @action.name, arg_count: arity - 1, given_count: count - 1 }
252252
end
253253
end
254254

lib/puppet/file_bucket/dipper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def restore(file, sum)
141141
changed = Puppet::FileSystem.stat(file_handle).mode
142142
::File.chmod(changed | 0200, file)
143143
end
144-
::File.open(file, ::File::WRONLY|::File::TRUNC|::File::CREAT) { |of|
144+
::File.open(file, ::File::WRONLY | ::File::TRUNC | ::File::CREAT) { |of|
145145
of.binmode
146146
newcontents.stream do |source_stream|
147147
FileUtils.copy_stream(source_stream, of)

lib/puppet/file_system/file_impl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def exclusive_open(path, mode, options = 'r', timeout = 300, &block)
5454
written = false
5555
while !written
5656
::File.open(path, options, mode) do |rf|
57-
if rf.flock(::File::LOCK_EX|::File::LOCK_NB)
57+
if rf.flock(::File::LOCK_EX | ::File::LOCK_NB)
5858
Puppet.debug{ _("Locked '%{path}'") % { path: path } }
5959
yield rf
6060
written = true

lib/puppet/file_system/uniquefile.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def self.open_tmp(identifier)
2828

2929
def initialize(basename, *rest)
3030
create_tmpname(basename, *rest) do |tmpname, _n, opts|
31-
mode = File::RDWR|File::CREAT|File::EXCL
31+
mode = File::RDWR | File::CREAT | File::EXCL
3232
perm = 0600
3333
if opts
3434
mode |= opts.delete(:mode) || 0
@@ -41,7 +41,7 @@ def initialize(basename, *rest)
4141
@tmpfile = File.open(tmpname, mode, opts)
4242
@tmpname = tmpname
4343
end
44-
@mode = mode & ~(File::CREAT|File::EXCL)
44+
@mode = mode & ~(File::CREAT | File::EXCL)
4545
perm or opts.freeze
4646
@opts = opts
4747
end

lib/puppet/forge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
2020
USER_AGENT = "PMT/1.1.1 (v3; Net::HTTP)"
2121

2222
# From https://forgeapi.puppet.com/#!/release/getReleases
23-
MODULE_RELEASE_EXCLUSIONS=%w[readme changelog license uri module tags supported file_size downloads created_at updated_at deleted_at].join(',').freeze
23+
MODULE_RELEASE_EXCLUSIONS = %w[readme changelog license uri module tags supported file_size downloads created_at updated_at deleted_at].join(',').freeze
2424

2525
attr_reader :host, :repository
2626

lib/puppet/functions.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def internal_param(type, name, repeat = false)
547547
if repeat
548548
@weaving << -@names.size()
549549
else
550-
@weaving << @names.size()-1
550+
@weaving << @names.size() - 1
551551
end
552552
else
553553
raise ArgumentError, _("Parameter 'type' must be a String reference to a Puppet Data Type. Got %{type_class}") % { type_class: type.class }
@@ -644,7 +644,7 @@ def type(assignment_string)
644644
end
645645
unless result.body.kind_of?(Puppet::Pops::Model::TypeAlias)
646646
rb_location = rb_location.gsub(/:in.*$/, '')
647-
raise ArgumentError, _("Expected a type alias assignment on the form 'AliasType = T', got '%{assignment_string}'.\n"+
647+
raise ArgumentError, _("Expected a type alias assignment on the form 'AliasType = T', got '%{assignment_string}'.\n" +
648648
"Called from <%{ruby_file_location}>") % {
649649
assignment_string: assignment_string,
650650
ruby_file_location: rb_location
@@ -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
@@ -857,7 +857,7 @@ def pal_compiler_param
857857
def inject(injection_name)
858858
@injections << injection_name
859859
# mark what should be picked for this position when dispatching
860-
@weaving << [@injections.size()-1]
860+
@weaving << [@injections.size() - 1]
861861
end
862862
end
863863
end

0 commit comments

Comments
 (0)