diff --git a/chef-handler-sns.gemspec b/chef-handler-sns.gemspec index d626421..116cf4f 100644 --- a/chef-handler-sns.gemspec +++ b/chef-handler-sns.gemspec @@ -1,8 +1,8 @@ $LOAD_PATH.push File.expand_path('../lib', __FILE__) require 'chef/handler/sns/version' -chef_version = - ENV.key?('CHEF_VERSION') ? "#{ENV['CHEF_VERSION']}" : ['>= 0.9.0'] +chef_version = ENV.key?('CHEF_VERSION') ? ENV['CHEF_VERSION'] : ['>= 0.9.0'] +# rubocop:disable Metrics/BlockLength Gem::Specification.new do |s| s.name = 'chef-handler-sns' s.version = ::Chef::Handler::Sns::VERSION @@ -31,11 +31,12 @@ Gem::Specification.new do |s| s.add_development_dependency 'mocha', '~> 1.1' s.add_development_dependency 'coveralls', '~> 0.7' s.add_development_dependency 'simplecov', '~> 0.9' - s.add_development_dependency 'rubocop', '~> 0.35.0' + s.add_development_dependency 'rubocop', '~> 0.47.0' s.add_development_dependency 'should_not', '~> 1.1' s.add_development_dependency 'yard', '~> 0.8' if Gem::Requirement.new('< 2.2.2') - .satisfied_by?(Gem::Version.new(RUBY_VERSION)) + .satisfied_by?(Gem::Version.new(RUBY_VERSION)) s.add_development_dependency 'rack', '~> 1.0' end end +# rubocop:enable Metrics/BlockLength diff --git a/lib/chef/handler/sns/config.rb b/lib/chef/handler/sns/config.rb index 6d5ed75..f50797c 100644 --- a/lib/chef/handler/sns/config.rb +++ b/lib/chef/handler/sns/config.rb @@ -42,7 +42,7 @@ module Config # # Required configuration options. # - REQUIRED = %w(access_key secret_key topic_arn) + REQUIRED = %w(access_key secret_key topic_arn).freeze # # Reads some configuration options from Ohai information. @@ -108,13 +108,13 @@ def config_check(node = nil) config_from_ohai(node) if node REQUIRED.each do |key| next unless send(key).nil? - fail Exceptions::ValidationFailed, - "Required argument #{key} is missing!" + raise Exceptions::ValidationFailed, + "Required argument #{key} is missing!" end return unless body_template && !::File.exist?(body_template) - fail Exceptions::ValidationFailed, - "Template file not found: #{body_template}." + raise Exceptions::ValidationFailed, + "Template file not found: #{body_template}." end # diff --git a/lib/chef/handler/sns/version.rb b/lib/chef/handler/sns/version.rb index edac59a..7b57097 100644 --- a/lib/chef/handler/sns/version.rb +++ b/lib/chef/handler/sns/version.rb @@ -30,7 +30,7 @@ class Sns < ::Chef::Handler # # chef-handler-sns Ruby Gem version. # - VERSION = '2.1.0.dev' + VERSION = '2.1.0.dev'.freeze end end end diff --git a/test/test_chef_handler_sns.rb b/test/test_chef_handler_sns.rb index 7b4e589..75a2e42 100644 --- a/test/test_chef_handler_sns.rb +++ b/test/test_chef_handler_sns.rb @@ -40,6 +40,7 @@ def config end end +# rubocop:disable Metrics/BlockLength describe Chef::Handler::Sns do let(:data_dir) { ::File.join(::File.dirname(__FILE__), 'data') } let(:node) do @@ -301,3 +302,4 @@ def config sns_handler.run_report_safely(run_status) end end +# rubocop:enable Metrics/BlockLength diff --git a/test/test_chef_handler_sns_config.rb b/test/test_chef_handler_sns_config.rb index e09f2f7..505fc74 100644 --- a/test/test_chef_handler_sns_config.rb +++ b/test/test_chef_handler_sns_config.rb @@ -25,10 +25,10 @@ class SnsConfig end class ChefFakeOhai < Chef::Handler::Sns::Config::Ohai - def intialize - end + def intialize; end end +# rubocop:disable Metrics/BlockLength describe Chef::Handler::Sns::Config do let(:node) do node = Chef::Node.new @@ -166,3 +166,4 @@ def intialize end end end +# rubocop:enable Metrics/BlockLength diff --git a/test/test_chef_handler_sns_config_ohai.rb b/test/test_chef_handler_sns_config_ohai.rb index cf43f3a..5e9dd3d 100644 --- a/test/test_chef_handler_sns_config_ohai.rb +++ b/test/test_chef_handler_sns_config_ohai.rb @@ -19,6 +19,7 @@ require 'helper' +# rubocop:disable Metrics/BlockLength describe Chef::Handler::Sns::Config::Ohai do let(:node) do Chef::Node.new.tap do |node| @@ -85,3 +86,4 @@ end end end +# rubocop:enable Metrics/BlockLength