From: Tom Hughes Date: Tue, 18 Aug 2015 21:59:13 +0000 (+0100) Subject: Fix new rubocop warnings X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/aff3fbe6802d93a8deae8fa2637589c8d28f6681 Fix new rubocop warnings --- diff --git a/.rubocop.yml b/.rubocop.yml index b6fd6fcc3..2219d6ec6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,9 @@ Style/AlignParameters: Exclude: - '**/metadata.rb' +Style/ExtraSpacing: + AllowForAlignment: true + Style/FileName: Exclude: - 'cookbooks/trac/files/default/trac-authenticate' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d63b1da17..4a5009387 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,31 +1,33 @@ -# This configuration was generated by `rubocop --auto-gen-config` -# on 2015-02-03 10:18:23 +0000 using RuboCop version 0.28.0. +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2015-08-18 22:54:59 +0100 using RuboCop version 0.33.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 +# Offense count: 1 Lint/HandleExceptions: - Enabled: false + Exclude: + - 'cookbooks/networking/definitions/firewall_rule.rb' # Offense count: 22 Metrics/AbcSize: - Max: 83 + Max: 66 -# Offense count: 4 +# Offense count: 3 Metrics/CyclomaticComplexity: Max: 8 -# Offense count: 298 +# Offense count: 338 # Configuration parameters: AllowURI, URISchemes. Metrics/LineLength: Max: 451 -# Offense count: 21 +# Offense count: 23 # Configuration parameters: CountComments. Metrics/MethodLength: - Max: 37 + Max: 28 # Offense count: 1 Metrics/PerceivedComplexity: @@ -33,14 +35,41 @@ Metrics/PerceivedComplexity: # Offense count: 14 Style/Documentation: - Enabled: false + Exclude: + - 'cookbooks/chef/libraries/compare_versions.rb' + - 'cookbooks/chef/libraries/edit_file.rb' + - 'cookbooks/chef/libraries/random_password.rb' + - 'cookbooks/chef/libraries/remote_directory.rb' + - 'cookbooks/chef/libraries/subversion.rb' + - 'cookbooks/hardware/libraries/sensors.rb' + - 'cookbooks/munin/libraries/expand.rb' + - 'cookbooks/mysql/libraries/mysql.rb' + - 'cookbooks/networking/libraries/interfaces.rb' + - 'cookbooks/networking/libraries/ipaddresses.rb' + - 'cookbooks/postgresql/libraries/postgresql.rb' + - 'cookbooks/tile/files/default/ruby/expire.rb' + - 'cookbooks/wordpress/libraries/wordpress.rb' -# Offense count: 15 +# Offense count: 19 +# Cop supports --auto-correct. # Configuration parameters: MaxLineLength. Style/IfUnlessModifier: - Enabled: false + Exclude: + - 'cookbooks/accounts/recipes/default.rb' + - 'cookbooks/apache/providers/conf.rb' + - 'cookbooks/apache/providers/module.rb' + - 'cookbooks/chef/libraries/compare_versions.rb' + - 'cookbooks/exim/recipes/default.rb' + - 'cookbooks/hardware/attributes/default.rb' + - 'cookbooks/hardware/recipes/default.rb' + - 'cookbooks/munin/recipes/default.rb' + - 'cookbooks/nodejs/recipes/default.rb' + - 'cookbooks/tile/files/default/ruby/expire.rb' + - 'cookbooks/tile/recipes/default.rb' + - 'cookbooks/tools/recipes/default.rb' + - 'cookbooks/web/recipes/cgimap.rb' -# Offense count: 29 +# Offense count: 28 # Cop supports --auto-correct. Style/NumericLiterals: MinDigits: 11 diff --git a/cookbooks/apt/metadata.rb b/cookbooks/apt/metadata.rb index ee74103b9..d9661aae2 100644 --- a/cookbooks/apt/metadata.rb +++ b/cookbooks/apt/metadata.rb @@ -1,4 +1,4 @@ -name "apt" +name "apt" maintainer "Tom Hughes" maintainer_email "tom@compton.nu" license "Apache 2.0" diff --git a/cookbooks/apt/providers/source.rb b/cookbooks/apt/providers/source.rb index cce755a63..b6a318634 100644 --- a/cookbooks/apt/providers/source.rb +++ b/cookbooks/apt/providers/source.rb @@ -31,7 +31,7 @@ action :create do end end - template source_path do + template source_path do source new_resource.template owner "root" group "root" diff --git a/cookbooks/devices/metadata.rb b/cookbooks/devices/metadata.rb index 8c7571484..87e069b20 100644 --- a/cookbooks/devices/metadata.rb +++ b/cookbooks/devices/metadata.rb @@ -1,4 +1,4 @@ -name "devices" +name "devices" maintainer "Tom Hughes" maintainer_email "tom@compton.nu" license "Apache 2.0" diff --git a/cookbooks/mediawiki/resources/site.rb b/cookbooks/mediawiki/resources/site.rb index a210e806b..e7838ed0f 100644 --- a/cookbooks/mediawiki/resources/site.rb +++ b/cookbooks/mediawiki/resources/site.rb @@ -34,7 +34,7 @@ attribute :email_contact, :kind_of => String, :default => "" attribute :email_sender, :kind_of => String, :default => "" attribute :email_sender_name, :kind_of => String, :default => "MediaWiki Mail" attribute :commons, :kind_of => [TrueClass, FalseClass], :default => true -attribute :skin, :kind_of => String, :default => "vector" +attribute :skin, :kind_of => String, :default => "vector" attribute :site_notice, :kind_of => String, :default => "" attribute :site_readonly, :kind_of => [TrueClass, FalseClass], :default => false attribute :admin_user, :kind_of => String, :default => "Admin" @@ -75,7 +75,7 @@ def mediawiki_params :site_notice => site_notice, :site_readonly => site_readonly, :ssl_enabled => ssl_enabled, - :extra_file_extensions => extra_file_extensions, + :extra_file_extensions => extra_file_extensions, :private_accounts => private_accounts, :private => private } diff --git a/cookbooks/sysctl/metadata.rb b/cookbooks/sysctl/metadata.rb index 8d12ccdc9..45a9fd574 100644 --- a/cookbooks/sysctl/metadata.rb +++ b/cookbooks/sysctl/metadata.rb @@ -1,14 +1,10 @@ -name "sysctl" +name "sysctl" maintainer "Tom Hughes" maintainer_email "tom@compton.nu" license "Apache 2.0" description "Configures kernel parameters" long_description IO.read(File.join(File.dirname(__FILE__), "README.md")) version "0.1" -%w(redhat centos debian ubuntu).each do |os| - supports os -end -recipe "sysctl", "Configure kernel parameters" attribute "sysctl", :display_name => "Kernel Parameters", diff --git a/cookbooks/sysctl/recipes/default.rb b/cookbooks/sysctl/recipes/default.rb index 7a0ed4357..562504835 100644 --- a/cookbooks/sysctl/recipes/default.rb +++ b/cookbooks/sysctl/recipes/default.rb @@ -42,7 +42,7 @@ end node[:sysctl].each_value do |group| group[:parameters].each do |key, value| - sysctl_file = "/proc/sys/#{key.gsub('.', '/')}" + sysctl_file = "/proc/sys/#{key.tr('.', '/')}" file sysctl_file do content "#{value}\n" diff --git a/cookbooks/sysfs/metadata.rb b/cookbooks/sysfs/metadata.rb index d1853f120..925150b51 100644 --- a/cookbooks/sysfs/metadata.rb +++ b/cookbooks/sysfs/metadata.rb @@ -1,4 +1,4 @@ -name "sysfs" +name "sysfs" maintainer "Tom Hughes" maintainer_email "tom@compton.nu" license "Apache 2.0" diff --git a/cookbooks/web/recipes/gpx.rb b/cookbooks/web/recipes/gpx.rb index 3802cfd7f..51eea1ed4 100644 --- a/cookbooks/web/recipes/gpx.rb +++ b/cookbooks/web/recipes/gpx.rb @@ -61,7 +61,7 @@ template "/etc/init.d/gpx-import" do variables :gpx_directory => gpx_directory, :pid_directory => pid_directory, :log_directory => log_directory, - :database_host => node[:web][:database_host], + :database_host => node[:web][:database_host], :database_name => "openstreetmap", :database_username => "gpximport", :database_password => db_passwords["gpximport"] diff --git a/roles/web-backend.rb b/roles/web-backend.rb index 51d7c477e..3474840e8 100644 --- a/roles/web-backend.rb +++ b/roles/web-backend.rb @@ -16,7 +16,7 @@ default_attributes( ] } }, - :memcached => { + :memcached => { :memory_limit => 4096 }, :passenger => {