From 10e1976e6e9fd98e058831e93fbec2eafd9c8167 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 14 Apr 2015 14:53:03 +0100 Subject: [PATCH] Fix style issues found by new rubocop version --- cookbooks/hardware/attributes/default.rb | 2 +- cookbooks/hardware/recipes/default.rb | 2 +- cookbooks/munin/files/default/plugins/api_calls_ | 2 +- cookbooks/munin/files/default/plugins/api_waits_ | 2 +- cookbooks/networking/recipes/default.rb | 2 +- cookbooks/nominatim/recipes/default.rb | 2 +- cookbooks/osqa/recipes/default.rb | 2 +- cookbooks/passenger/attributes/default.rb | 4 ++-- cookbooks/postgresql/libraries/postgresql.rb | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cookbooks/hardware/attributes/default.rb b/cookbooks/hardware/attributes/default.rb index 54c8956a3..174190f3f 100644 --- a/cookbooks/hardware/attributes/default.rb +++ b/cookbooks/hardware/attributes/default.rb @@ -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 diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 551dd5b38..d95825669 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -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}" diff --git a/cookbooks/munin/files/default/plugins/api_calls_ b/cookbooks/munin/files/default/plugins/api_calls_ index 74c5bbe16..158bf9004 100755 --- a/cookbooks/munin/files/default/plugins/api_calls_ +++ b/cookbooks/munin/files/default/plugins/api_calls_ @@ -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 diff --git a/cookbooks/munin/files/default/plugins/api_waits_ b/cookbooks/munin/files/default/plugins/api_waits_ index ba068f1b5..d072b89d5 100755 --- a/cookbooks/munin/files/default/plugins/api_waits_ +++ b/cookbooks/munin/files/default/plugins/api_waits_ @@ -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 diff --git a/cookbooks/networking/recipes/default.rb b/cookbooks/networking/recipes/default.rb index fe01c04e5..477a15b24 100644 --- a/cookbooks/networking/recipes/default.rb +++ b/cookbooks/networking/recipes/default.rb @@ -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] diff --git a/cookbooks/nominatim/recipes/default.rb b/cookbooks/nominatim/recipes/default.rb index 6134c1d76..e8ca87f9c 100644 --- a/cookbooks/nominatim/recipes/default.rb +++ b/cookbooks/nominatim/recipes/default.rb @@ -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] diff --git a/cookbooks/osqa/recipes/default.rb b/cookbooks/osqa/recipes/default.rb index db96e2e79..fe8306fdc 100644 --- a/cookbooks/osqa/recipes/default.rb +++ b/cookbooks/osqa/recipes/default.rb @@ -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 diff --git a/cookbooks/passenger/attributes/default.rb b/cookbooks/passenger/attributes/default.rb index c56843893..9af69741f 100644 --- a/cookbooks/passenger/attributes/default.rb +++ b/cookbooks/passenger/attributes/default.rb @@ -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 diff --git a/cookbooks/postgresql/libraries/postgresql.rb b/cookbooks/postgresql/libraries/postgresql.rb index f80efe15a..6960ec989 100644 --- a/cookbooks/postgresql/libraries/postgresql.rb +++ b/cookbooks/postgresql/libraries/postgresql.rb @@ -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") -- 2.39.5