From f6e9337df99579c966543e5aaa287977fa67e1dd Mon Sep 17 00:00:00 2001 From: Grant Ridder Date: Fri, 29 Jul 2016 00:25:01 -0700 Subject: [PATCH 1/2] Fix tests per rubocop and foodcritic --- .rubocop.yml | 3 +++ metadata.rb | 19 +++++++++++++++---- recipes/default.rb | 4 ++-- recipes/nginx.rb | 14 +++++++------- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index c15f877..6a01222 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,3 +14,6 @@ MethodLength: Enabled: false NumericLiterals: Enabled: false + +Style/NumericLiteralPrefix: + EnforcedOctalStyle: zero_only diff --git a/metadata.rb b/metadata.rb index 8e74607..00cfa5f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,4 +1,3 @@ -# rubocop:disable Style/SingleSpaceBeforeFirstArg name 'ice' maintainer 'Medidata Solutions' maintainer_email 'cookbooks@mdsol.com' @@ -6,16 +5,28 @@ description 'Installs/Configures ice' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.2.14' -# rubocop:enable Style/SingleSpaceBeforeFirstArg -%w( ubuntu centos ).each do |os| +%w( + centos + ubuntu +).each do |os| supports os end # Cookbook dependencies -%w( java apt nginx openssl logrotate chef-sugar ).each do |cb| +%w( + apt + chef-sugar + java + logrotate + nginx + openssl +).each do |cb| depends cb end depends 'artifact', '>= 1.9.0' depends 'tomcat', '>= 0.14.0' + +source_url 'https://github.com/mdsol/ice_cookbook' if respond_to?(:source_url) +issues_url 'https://github.com/mdsol/ice_cookbook/issues' if respond_to?(:issues_url) diff --git a/recipes/default.rb b/recipes/default.rb index f232c83..31d4891 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -56,7 +56,7 @@ end # Workaround for https://github.com/Netflix/ice/issues/100 - %w( tagdb usage_daily usage_monthly usage_weekly cost_daily cost_monthly cost_weekly usage_hourly cost_hourly ).each do |dir| + %w(tagdb usage_daily usage_monthly usage_weekly cost_daily cost_monthly cost_weekly usage_hourly cost_hourly).each do |dir| directory "#{node['ice']['processor']['local_dir']}/#{dir}_AWS Import" do owner node['tomcat']['user'] group node['tomcat']['group'] @@ -104,7 +104,7 @@ frequency node['ice']['logrotate_frequency'] rotate node['ice']['logrotate_rotate'] create "640 #{node['tomcat']['base_instance']} adm" - options %w( copytruncate compress missingok ) + options %w(copytruncate compress missingok) end include_recipe 'ice::nginx' if node['ice']['reader']['enabled'] == true && node['ice']['nginx_enabled'] diff --git a/recipes/nginx.rb b/recipes/nginx.rb index e14475e..703e49f 100644 --- a/recipes/nginx.rb +++ b/recipes/nginx.rb @@ -9,13 +9,13 @@ # Configure nginx site reverse proxy if node['ice']['public_hostname'].nil? - if node.attribute?('ec2') - node.override['ice']['public_hostname'] = node['ec2']['public_hostname'] - elsif node.attribute?('cloud') - node.override['ice']['public_hostname'] = node['cloud']['public_hostname'] - else - node.override['ice']['public_hostname'] = node['fqdn'] - end + node.override['ice']['public_hostname'] = if node.attribute?('ec2') + node['ec2']['public_hostname'] + elsif node.attribute?('cloud') + node['cloud']['public_hostname'] + else + node['fqdn'] + end if node['ice']['nginx_port'] != 80 node.override['ice']['public_hostname'] += ":#{node['ice']['nginx_port']}" From 1ea4a16b1c5f1f58b8a6aff25a5c5b918524dc9d Mon Sep 17 00:00:00 2001 From: Grant Ridder Date: Fri, 14 Oct 2016 09:19:48 -0700 Subject: [PATCH 2/2] Update more rubocop --- .rubocop.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 6a01222..56eaac1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,5 @@ AllCops: + DisplayCopNames: true Exclude: - vendor/** @@ -17,3 +18,6 @@ NumericLiterals: Style/NumericLiteralPrefix: EnforcedOctalStyle: zero_only + +Metrics/BlockLength: + Enabled: false