Giuseppe Lavagetto has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/359478 )

Change subject: Fix more whitespace-related RuboCop across the tree
......................................................................


Fix more whitespace-related RuboCop across the tree

- Layout/LeadingCommentSpace
- Layout/SpaceAroundEqualsInParameterDefault
- Layout/SpaceInsideBrackets
- Layout/DotPosition

Change-Id: Idd4eeeefd19daa55ba01dbe96b0f913bc9e48103
---
M .rubocop_todo.yml
M modules/bacula/spec/defines/fileset_spec.rb
M modules/base/spec/defines/service_unit_spec.rb
M modules/postgresql/spec/classes/postgresql_master_spec.rb
M modules/postgresql/spec/classes/postgresql_slave_spec.rb
M modules/raid/lib/facter/raid.rb
M modules/scap/lib/puppet/provider/package/scap3.rb
M modules/scap/spec/types/package/scap3_spec.rb
M modules/wmflib/lib/hiera/backend/proxy_backend.rb
M modules/wmflib/lib/puppet/parser/functions/array_concat.rb
M modules/wmflib/lib/puppet/parser/functions/cron_splay.rb
M modules/wmflib/lib/puppet/parser/functions/hash_deselect_re.rb
M modules/wmflib/lib/puppet/parser/functions/hash_select_re.rb
M modules/wmflib/lib/puppet/parser/functions/htpasswd.rb
M rake_modules/taskgen.rb
M utils/expanderb.rb
M utils/hiera_lookup
17 files changed, 51 insertions(+), 68 deletions(-)

Approvals:
  Giuseppe Lavagetto: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 56f72db..681b2a0 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -16,9 +16,6 @@
   Exclude:
     - 'modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb'
 
-Layout/DotPosition:
-  Enabled: false
-
 Style/EmptyLiteral:
   Exclude:
     - 'modules/admin/lib/puppet/parser/functions/unique_users.rb'
@@ -40,10 +37,6 @@
 
 Layout/IndentationWidth:
   Enabled: false
-
-Layout/LeadingCommentSpace:
-  Exclude:
-    - 'modules/base/spec/defines/service_unit_spec.rb'
 
 Style/MethodCallWithoutArgsParentheses:
   Exclude:
@@ -67,18 +60,8 @@
   Exclude:
     - 'modules/wmflib/lib/puppet/parser/functions/require_package.rb'
 
-Layout/SpaceAroundEqualsInParameterDefault:
-  Enabled: false
-
-Layout/SpaceInsideBrackets:
-  Enabled: false
-
 Layout/SpaceInsideHashLiteralBraces:
   Enabled: false
-
-Layout/SpaceInsideParens:
-  Exclude:
-    - 'utils/expanderb.rb'
 
 Style/SpecialGlobalVars:
   Exclude:
diff --git a/modules/bacula/spec/defines/fileset_spec.rb 
b/modules/bacula/spec/defines/fileset_spec.rb
index c069c27..7bea6cd 100644
--- a/modules/bacula/spec/defines/fileset_spec.rb
+++ b/modules/bacula/spec/defines/fileset_spec.rb
@@ -2,7 +2,7 @@
 
 describe 'bacula::director::fileset', :type => :define do
     let(:title) { 'something' }
-    let(:params) { { :includes => [ "/", "/var", ], } }
+    let(:params) { { :includes => ["/", "/var",], } }
 
     it 'should create /etc/bacula/conf.d/fileset-something.conf' do
         should contain_file('/etc/bacula/conf.d/fileset-something.conf').with({
@@ -23,8 +23,8 @@
 
     context 'with excludes' do
         let(:params) { {
-            :includes    => [ "/", "/var",],
-            :excludes    => [ "/tmp", ],
+            :includes    => ["/", "/var",],
+            :excludes    => ["/tmp",],
             }
         }
         it 'should create valid content for 
/etc/bacula/conf.d/fileset-something.conf' do
diff --git a/modules/base/spec/defines/service_unit_spec.rb 
b/modules/base/spec/defines/service_unit_spec.rb
index 0800e9c..2c79374 100644
--- a/modules/base/spec/defines/service_unit_spec.rb
+++ b/modules/base/spec/defines/service_unit_spec.rb
@@ -85,6 +85,6 @@
       end
     end
 
-    #MARK
+    # MARK
   end
 end
diff --git a/modules/postgresql/spec/classes/postgresql_master_spec.rb 
b/modules/postgresql/spec/classes/postgresql_master_spec.rb
index 6b693e3..06ba903 100644
--- a/modules/postgresql/spec/classes/postgresql_master_spec.rb
+++ b/modules/postgresql/spec/classes/postgresql_master_spec.rb
@@ -11,16 +11,16 @@
     context 'ensure present' do
         it { should contain_class('postgresql::server') }
         it do
-            should contain_file('/etc/postgresql/9.4/main/postgresql.conf').
-                with_ensure('present').
-                with_content(/include 'master.conf'/)
+            should contain_file('/etc/postgresql/9.4/main/postgresql.conf')
+                .with_ensure('present')
+                .with_content(/include 'master.conf'/)
         end
         it do
-            should contain_file('/etc/postgresql/9.4/main/master.conf').
-                with_ensure('present').
-                with_content(/max_wal_senders = 5/).
-                with_content(/checkpoint_segments = 64/).
-                with_content(/wal_keep_segments = 128/)
+            should contain_file('/etc/postgresql/9.4/main/master.conf')
+                .with_ensure('present')
+                .with_content(/max_wal_senders = 5/)
+                .with_content(/checkpoint_segments = 64/)
+                .with_content(/wal_keep_segments = 128/)
         end
     end
 end
diff --git a/modules/postgresql/spec/classes/postgresql_slave_spec.rb 
b/modules/postgresql/spec/classes/postgresql_slave_spec.rb
index 8fa865a..f1bc112 100644
--- a/modules/postgresql/spec/classes/postgresql_slave_spec.rb
+++ b/modules/postgresql/spec/classes/postgresql_slave_spec.rb
@@ -12,15 +12,15 @@
     context 'ensure present' do
         it { should contain_class('postgresql::server') }
         it do
-            should contain_file('/etc/postgresql/9.4/main/postgresql.conf').
-                with_ensure('present').
-                with_content(/include 'slave.conf'/)
+            should contain_file('/etc/postgresql/9.4/main/postgresql.conf')
+                .with_ensure('present')
+                .with_content(/include 'slave.conf'/)
         end
         it { should 
contain_file('/etc/postgresql/9.4/main/slave.conf').with_ensure('present') }
         it do
-            should contain_file('/var/lib/postgresql/9.4/main/recovery.conf').
-                with_ensure('present').
-                with_content(/host=test user=replication password=pass/)
+            should contain_file('/var/lib/postgresql/9.4/main/recovery.conf')
+                .with_ensure('present')
+                .with_content(/host=test user=replication password=pass/)
         end
         it { should contain_exec('pg_basebackup-test').with_command(/-h test 
-U replication -w/)}
     end
@@ -39,15 +39,15 @@
     context 'ensure present' do
         it { should contain_class('postgresql::server') }
         it do
-            should contain_file('/etc/postgresql/9.4/main/postgresql.conf').
-                with_ensure('present').
-                with_content(/include 'slave.conf'/)
+            should contain_file('/etc/postgresql/9.4/main/postgresql.conf')
+                .with_ensure('present')
+                .with_content(/include 'slave.conf'/)
         end
         it { should 
contain_file('/etc/postgresql/9.4/main/slave.conf').with_ensure('present') }
         it do
-            should contain_file('/srv/postgres/9.4/main/recovery.conf').
-                with_ensure('present').
-                with_content(/host=test user=replication password=pass/)
+            should contain_file('/srv/postgres/9.4/main/recovery.conf')
+                .with_ensure('present')
+                .with_content(/host=test user=replication password=pass/)
         end
         it { should contain_exec('pg_basebackup-test')
                         .with_command(/-h test -U replication -w/)
diff --git a/modules/raid/lib/facter/raid.rb b/modules/raid/lib/facter/raid.rb
index 9170d4d..404e104 100644
--- a/modules/raid/lib/facter/raid.rb
+++ b/modules/raid/lib/facter/raid.rb
@@ -30,7 +30,7 @@
       end
     end
 
-    supported_devs = [ 'aac', 'twe' ]
+    supported_devs = ['aac', 'twe']
     dev_re = Regexp.new(/^\s*\d+\s+(\w+)/)
     IO.foreach('/proc/devices') do |x|
       m = x.match(dev_re)
diff --git a/modules/scap/lib/puppet/provider/package/scap3.rb 
b/modules/scap/lib/puppet/provider/package/scap3.rb
index 4a28799..a0dc9ba 100644
--- a/modules/scap/lib/puppet/provider/package/scap3.rb
+++ b/modules/scap/lib/puppet/provider/package/scap3.rb
@@ -73,7 +73,7 @@
   #
   # Note: package_settings would be a cleaner solution for this, however,
   # that feature requires puppet >= 3.5 and we must support version 3.4
-  def install_option(key, default=nil)
+  def install_option(key, default = nil)
     return unless install_options
     install_options.each do |val|
       case val
diff --git a/modules/scap/spec/types/package/scap3_spec.rb 
b/modules/scap/spec/types/package/scap3_spec.rb
index 82cf391..7e4deab 100644
--- a/modules/scap/spec/types/package/scap3_spec.rb
+++ b/modules/scap/spec/types/package/scap3_spec.rb
@@ -19,17 +19,17 @@
     allow(Etc).to 
receive(:getpwnam).with('mwdeploy').and_return(OpenStruct.new(uid: 666))
 
     # Stub the existance of our deploy-local command
-    allow(@provider.class).to receive(:command).
-      with(:scap).
-      and_return('/usr/bin/scap')
+    allow(@provider.class).to receive(:command)
+      .with(:scap)
+      .and_return('/usr/bin/scap')
   end
 
   describe '#install' do
     it 'should specify the right repo' do
       allow(FileUtils).to receive(:cd)
-      expect(@provider).to receive(:execute).
-        with(['/usr/bin/scap', 'deploy-local', '--repo', 'foo/deploy', '-D', 
'log_json:False'],
-             uid: 666, failonfail: true)
+      expect(@provider).to receive(:execute)
+        .with(['/usr/bin/scap', 'deploy-local', '--repo', 'foo/deploy', '-D', 
'log_json:False'],
+              uid: 666, failonfail: true)
       @provider.install
     end
   end
@@ -39,9 +39,9 @@
 
     context 'when the package is installed' do
       before do
-        expect(@provider).to receive(:git).
-          with('-C', '/srv/deployment/foo/deploy', 'tag', '--points-at', 
'HEAD').
-          and_return(tag)
+        expect(@provider).to receive(:git)
+          .with('-C', '/srv/deployment/foo/deploy', 'tag', '--points-at', 
'HEAD')
+          .and_return(tag)
       end
 
       context 'and the tag exists' do
diff --git a/modules/wmflib/lib/hiera/backend/proxy_backend.rb 
b/modules/wmflib/lib/hiera/backend/proxy_backend.rb
index 77ba195..d73fbb1 100644
--- a/modules/wmflib/lib/hiera/backend/proxy_backend.rb
+++ b/modules/wmflib/lib/hiera/backend/proxy_backend.rb
@@ -55,16 +55,16 @@
             plugin = @config[:default_plugin]
           end
           unless @plugins.include? plugin
-            Hiera.
-              warn "Hierarchy specifies to use plugin '#{plugin}' but can't 
find it"
+            Hiera
+              .warn "Hierarchy specifies to use plugin '#{plugin}' but can't 
find it"
             next
           end
           # We look up onto a foreign backend by limiting us to a
           # single element of hierarchy.
           Config[:hierarchy] = [source]
-          new_answer = @plugins[plugin].
-                       lookup(key, scope, order_override,
-                              resolution_type)
+          new_answer = @plugins[plugin]
+                       .lookup(key, scope, order_override,
+                               resolution_type)
           Config[:hierarchy] = hierarchy
 
           next if new_answer.nil?
diff --git a/modules/wmflib/lib/puppet/parser/functions/array_concat.rb 
b/modules/wmflib/lib/puppet/parser/functions/array_concat.rb
index df9f60b..89b9212 100644
--- a/modules/wmflib/lib/puppet/parser/functions/array_concat.rb
+++ b/modules/wmflib/lib/puppet/parser/functions/array_concat.rb
@@ -20,7 +20,7 @@
         if arg.is_a? Array
             retval += arg
         else
-            retval += [ arg ]
+            retval += [arg]
         end
     end
     retval
diff --git a/modules/wmflib/lib/puppet/parser/functions/cron_splay.rb 
b/modules/wmflib/lib/puppet/parser/functions/cron_splay.rb
index 7da142b..88df67d 100644
--- a/modules/wmflib/lib/puppet/parser/functions/cron_splay.rb
+++ b/modules/wmflib/lib/puppet/parser/functions/cron_splay.rb
@@ -78,7 +78,7 @@
     end
 
     # split hosts into N lists based the first digit of /NNNN/, defaulting to 
zero
-    sublists = [ [], [], [], [], [], [], [], [], [], [] ]
+    sublists = [[], [], [], [], [], [], [], [], [], []]
     for h in hosts
       match = /([1-9])[0-9]{3}/.match(h)
       if match
diff --git a/modules/wmflib/lib/puppet/parser/functions/hash_deselect_re.rb 
b/modules/wmflib/lib/puppet/parser/functions/hash_deselect_re.rb
index 8f0597f..db280e8 100644
--- a/modules/wmflib/lib/puppet/parser/functions/hash_deselect_re.rb
+++ b/modules/wmflib/lib/puppet/parser/functions/hash_deselect_re.rb
@@ -30,7 +30,7 @@
     end
 
     # 
https://bibwild.wordpress.com/2012/04/12/ruby-hash-select-1-8-7-and-1-9-3-simultaneously-compatible/
-    Hash[ in_hash.select { |k, _v| !pattern.match(k) } ]
+    Hash[in_hash.select { |k, _v| !pattern.match(k) }]
   end
 end
 
diff --git a/modules/wmflib/lib/puppet/parser/functions/hash_select_re.rb 
b/modules/wmflib/lib/puppet/parser/functions/hash_select_re.rb
index 5bfdf6a..3fcfd6e 100644
--- a/modules/wmflib/lib/puppet/parser/functions/hash_select_re.rb
+++ b/modules/wmflib/lib/puppet/parser/functions/hash_select_re.rb
@@ -30,7 +30,7 @@
     end
 
     # 
https://bibwild.wordpress.com/2012/04/12/ruby-hash-select-1-8-7-and-1-9-3-simultaneously-compatible/
-    Hash[ in_hash.select { |k, _v| pattern.match(k) } ]
+    Hash[in_hash.select { |k, _v| pattern.match(k) }]
   end
 end
 
diff --git a/modules/wmflib/lib/puppet/parser/functions/htpasswd.rb 
b/modules/wmflib/lib/puppet/parser/functions/htpasswd.rb
index 7438d92..645fa74 100644
--- a/modules/wmflib/lib/puppet/parser/functions/htpasswd.rb
+++ b/modules/wmflib/lib/puppet/parser/functions/htpasswd.rb
@@ -90,7 +90,7 @@
     l = (pd[3] << 16) | (pd[9] << 8) | pd[15]
     encoded_password << to_64(l, 4)
 
-    l = (pd[4] << 16) | (pd[10] << 8) | pd[ 5]
+    l = (pd[4] << 16) | (pd[10] << 8) | pd[5]
     encoded_password << to_64(l, 4)
     encoded_password << to_64(pd[11], 2)
 
diff --git a/rake_modules/taskgen.rb b/rake_modules/taskgen.rb
index c2e2aaa..76ebae0 100644
--- a/rake_modules/taskgen.rb
+++ b/rake_modules/taskgen.rb
@@ -41,7 +41,7 @@
     end
   end
 
-  def print_wmf_style_violations(problems, other=nil, format='%{path}:%{line} 
%{message}')
+  def print_wmf_style_violations(problems, other = nil, format = 
'%{path}:%{line} %{message}')
     # Prints the wmf style violations
     other ||= {}
     events = problems.select do |p|
@@ -66,7 +66,7 @@
     tasks
   end
 
-  def puppet_changed_files(files=@changed_files)
+  def puppet_changed_files(files = @changed_files)
     files.select{ |x| File.fnmatch("*.pp", x) }
   end
 
diff --git a/utils/expanderb.rb b/utils/expanderb.rb
index fccc4a9..431c26a 100755
--- a/utils/expanderb.rb
+++ b/utils/expanderb.rb
@@ -20,11 +20,11 @@
 optparse = OptionParser.new do |opts|
   opts.banner = "Usage: expanderb.rb -f FILENAME [key=val [key2=val]]"
 
-  opts.on( '-f', '--filename FILENAME', 'ERB filename to expand') do |f|
+  opts.on('-f', '--filename FILENAME', 'ERB filename to expand') do |f|
     $filename = f
   end
 
-  opts.on_tail( '-h', '--help', 'Show this message' ) do
+  opts.on_tail('-h', '--help', 'Show this message') do
     puts opts
     exit
   end
@@ -48,7 +48,7 @@
 
 template_values = {}
 ARGV.each do |val|
-  key, value = val.split( '=' )
+  key, value = val.split('=')
   template_values[key] = value
 end
 p template_values
diff --git a/utils/hiera_lookup b/utils/hiera_lookup
index 5db1659..3d80ff3 100755
--- a/utils/hiera_lookup
+++ b/utils/hiera_lookup
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 # hiera_lookup: hiera lookup tool
 
-def usage(error='')
+def usage(error = '')
   msg = <<-end
 hiera_lookup: hiera lookup tool
 

-- 
To view, visit https://gerrit.wikimedia.org/r/359478
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idd4eeeefd19daa55ba01dbe96b0f913bc9e48103
Gerrit-PatchSet: 6
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to