Fix style issues found by new rubocop version
authorTom Hughes <tom@compton.nu>
Tue, 14 Apr 2015 13:53:03 +0000 (14:53 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 14 Apr 2015 13:53:03 +0000 (14:53 +0100)
cookbooks/hardware/attributes/default.rb
cookbooks/hardware/recipes/default.rb
cookbooks/munin/files/default/plugins/api_calls_
cookbooks/munin/files/default/plugins/api_waits_
cookbooks/networking/recipes/default.rb
cookbooks/nominatim/recipes/default.rb
cookbooks/osqa/recipes/default.rb
cookbooks/passenger/attributes/default.rb
cookbooks/postgresql/libraries/postgresql.rb

index 54c8956a3b502c600714ffa9eb6ef5d1f3886079..174190f3fc42b923883708d833bd5dbf2cf16b65 100644 (file)
@@ -8,7 +8,7 @@ if node[:dmi] && node[:dmi][:system]
 
     case dmi.system.product_name
     when "ProLiant DL360 G6", "ProLiant DL360 G7"
-      default[:hardware][:sensors][:"power_meter-*"][:power][:"power1"] = { :ignore => true }
+      default[:hardware][:sensors][:"power_meter-*"][:power][:power1] = { :ignore => true }
     end
   end
 end
index 551dd5b382b43b311233fd06cdca08e27b793c81..d95825669fbf030c8d25ff35104a8fda11d020b1 100644 (file)
@@ -368,7 +368,7 @@ if tools_packages.include?("areca")
 end
 
 disks.each do |disk|
-  if disk[:device] =~ /^cciss\/(.*)$/
+  if disk[:device] =~ %r{^cciss/(.*)$}
     id = File.read("/sys/bus/cciss/devices/#{Regexp.last_match[1]}/unique_id").chomp
 
     disk[:munin] = "cciss-3#{id.downcase}"
index 74c5bbe16895dc53d5e28f6656edbc8f22242b57..158bf90040bb3e2b722de77ad5a63ccada50df1d 100755 (executable)
@@ -10,7 +10,7 @@ def uris_from_status(server)
   doc = Hpricot.parse(file)
   tables = doc / "table"
   rows = (tables[1] / "tr")[1..-1]
-  data = rows.collect { |r| (r  / "td").collect(&:inner_html) }
+  data = rows.collect { |r| (r / "td").collect(&:inner_html) }
   # filter where the PID is numeric, status is 'W' and host matches the server
   matching_data = data.select { |r| r[1].to_i > 0 && r[3].match(/W/) && r[11].match(server) }
   # return only the URI part
index ba068f1b5938d88d3693ab47988596b413cd03cb..d072b89d58f8f6be2ca306162df62849e5044d3e 100755 (executable)
@@ -10,7 +10,7 @@ def uri_and_times_from_status(server)
   doc = Hpricot.parse(file)
   tables = doc / "table"
   rows = (tables[1] / "tr")[1..-1]
-  data = rows.collect { |r| (r  / "td").collect(&:inner_html) }
+  data = rows.collect { |r| (r / "td").collect(&:inner_html) }
   # filter where the PID is numeric, status is 'W' and host matches the server
   matching_data = data.select { |r| r[1].to_i > 0 && r[3].match(/W/) && r[11].match(server) }
   # return URI and number of seconds processing for each request
index fe01c04e5634919c7d15c04c41b524805e535d20..477a15b240741795c392b88d10db8d0a5365a092 100644 (file)
@@ -23,7 +23,7 @@
 require "ipaddr"
 
 node[:networking][:interfaces].each do |name, interface|
-  if interface[:role] && role = node[:networking][:roles][interface[:role]]
+  if interface[:role] && (role = node[:networking][:roles][interface[:role]])
     if role[interface[:family]]
       node.set[:networking][:interfaces][name][:prefix] = role[interface[:family]][:prefix]
       node.set[:networking][:interfaces][name][:gateway] = role[interface[:family]][:gateway]
index 6134c1d7674cc27d10d9fe744d731838ab9bea54..e8ca87f9c242526ebadf0bf0138dc069f809dc3c 100644 (file)
@@ -37,7 +37,7 @@ source_directory = "#{home_directory}/nominatim"
 email_errors = data_bag_item("accounts", "lonvia")["email"]
 
 database_cluster = node[:nominatim][:database][:cluster]
-database_version = database_cluster.sub(/\/.*/, "")
+database_version = database_cluster.sub(%r{/.*}, "")
 database_name = node[:nominatim][:database][:dbname]
 
 postgis_version = node[:nominatim][:database][:postgis]
index db96e2e7921427b6ccb4ed18a8d8faa2f2ee05e8..fe8306fdc7dfb0c192eff61b136bda1c45ef76af 100644 (file)
@@ -102,7 +102,7 @@ node[:osqa][:sites].each do |site|
     line.gsub!(/^ALLOWED_HOSTS = .*/, "ALLOWED_HOSTS = ('help.openstreetmap.org',)")
     line.gsub!(/^CACHE_BACKEND = .*/, "CACHE_BACKEND = 'memcached://127.0.0.1:11211/'")
     line.gsub!(%r{^APP_URL = 'http://'}, "APP_URL = 'http://#{name}'")
-    line.gsub!(/^TIME_ZONE = 'America\/New_York'/, "TIME_ZONE = 'Europe/London'")
+    line.gsub!(%r{^TIME_ZONE = 'America/New_York'}, "TIME_ZONE = 'Europe/London'")
     line.gsub!(/^DISABLED_MODULES = \[([^\]]+)\]/, "DISABLED_MODULES = [\\1, 'localauth', 'facebookauth', 'oauthauth']")
 
     line
index c56843893029fcafd5c896a4a34fcd2c97cfe95a..9af69741f1e0f3714b1ee51deaed211a533b7f9c 100644 (file)
@@ -4,7 +4,7 @@ default[:passenger][:max_pool_size] = 6
 default[:passenger][:pool_idle_time] = 300
 
 if node[:passenger][:version] == 4
-  default[:apt][:sources] = node[:apt][:sources] |  ["brightbox-ruby-ng", "passenger4"]
+  default[:apt][:sources] = node[:apt][:sources] | ["brightbox-ruby-ng", "passenger4"]
 else
-  default[:apt][:sources] = node[:apt][:sources] |  ["brightbox-ruby-ng", "passenger"]
+  default[:apt][:sources] = node[:apt][:sources] | ["brightbox-ruby-ng", "passenger"]
 end
index f80efe15a669dac45f988c89e838c4d07094b555..6960ec9890b9db2c6d69855b52b0c9235f4466bb 100644 (file)
@@ -109,7 +109,7 @@ class Chef
 
     def parse_acl(acl)
       acl.sub(/^\{(.*)\}$/, "\\1").split(",").each_with_object({}) do |entry, permissions|
-        entry = entry.sub(/^"(.*)"$/) { Regexp.last_match[1].gsub(/\\"/, '"') }.sub(/\/.*$/, "")
+        entry = entry.sub(/^"(.*)"$/) { Regexp.last_match[1].gsub(/\\"/, '"') }.sub(%r{/.*$}, "")
         user, privileges = entry.split("=")
 
         user = user.sub(/^"(.*)"$/, "\\1")