Skip to content

Commit

Permalink
Fix for changed RuboCop and FoodCritic rule(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
djoos committed Jul 19, 2017
1 parent eb54711 commit d9a3cee
Show file tree
Hide file tree
Showing 31 changed files with 26 additions and 44 deletions.
12 changes: 6 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -247,23 +247,23 @@ namespace :publish do
end

desc 'Run lint checks'
task :lint => %w(style)
task :lint => %w[style]

desc 'Run unit tests'
task :unit => %w(spec)
task :unit => %w[spec]

desc 'Run Travis CI tests'
task :travis => %w(lint unit)
task :travis => %w[lint unit]

desc 'Run all integration tests'
task :integration => %w(integration:vagrant)
task :integration => %w[integration:vagrant]

desc 'Publish'
task :publish => %w(publish:scm publish:chef:supermarket publish:chef:server)
task :publish => %w[publish:scm publish:chef:supermarket publish:chef:server]

desc 'Release'
task :release do
ReleaseCommands.release(environment)
end

task :default => %w(lint unit integration)
task :default => %w[lint unit integration]
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
version '2.29.0'
chef_version '>= 0.10.0' if respond_to?(:chef_version)

%w(debian ubuntu redhat centos fedora scientific amazon windows smartos oracle).each do |os|
%w[debian ubuntu redhat centos fedora scientific amazon windows smartos oracle].each do |os|
supports os
end

Expand Down
4 changes: 2 additions & 2 deletions providers/agent_php.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def startup_mode_config
# ensure that the daemon isn't currently running
# only stop the daemon if it has not been run by the agent (with a newrelic.cfg)
service 'newrelic-daemon' do
action [:disable, :stop] # stops the service if it's running and disables it from starting at system boot time
action %i[disable stop] # stops the service if it's running and disables it from starting at system boot time
only_if { ::File.exist?('/etc/newrelic/newrelic.cfg') }
end
# ensure that the file /etc/newrelic/newrelic.cfg does not exist if it does, move it aside (or remove it)
Expand Down Expand Up @@ -198,7 +198,7 @@ def startup_mode_config
notifies new_resource.service_action, "service[#{new_resource.service_name}]", :delayed if new_resource.service_name
end
service 'newrelic-daemon' do
action [:enable, :start] # starts the service if it's not running and enables it to start at system boot time
action %i[enable start] # starts the service if it's not running and enables it to start at system boot time
end
else
raise "#{new_resource.startup_mode} is not a valid newrelic-daemon startup mode."
Expand Down
4 changes: 1 addition & 3 deletions providers/deployment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Copyright (c) 2016, David Joos
#

use_inline_resources if defined?(use_inline_resources)
use_inline_resources

def whyrun_supported?
true
Expand Down Expand Up @@ -67,8 +67,6 @@ def whyrun_supported?
command command_curl
action :run
end

new_resource.updated_by_last_action(true)
end
end

Expand Down
4 changes: 1 addition & 3 deletions providers/yml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

require 'uri'

use_inline_resources if defined?(use_inline_resources)
use_inline_resources

def whyrun_supported?
true
Expand Down Expand Up @@ -40,6 +40,4 @@ def whyrun_supported?
sensitive true
action :create
end

new_resource.updated_by_last_action(t.updated_by_last_action?)
end
2 changes: 1 addition & 1 deletion resources/agent_infrastructure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
attribute :proxy, :kind_of => String, :default => nil
attribute :template_cookbook, :kind_of => String, :default => 'newrelic'
attribute :template_source, :kind_of => String, :default => 'agent/infrastructure/newrelic.yml.erb'
attribute :service_actions, :kind_of => Array, :default => %w(enable start)
attribute :service_actions, :kind_of => Array, :default => %w[enable start]
attribute :windows_version, :kind_of => String, :default => '1.0.703'
attribute :windows_checksum, :kind_of => String, :default => '3c9f98325dc484ee8735f01b913803eaef54f06641348b3dd9f3c0b3cd803ace'
4 changes: 1 addition & 3 deletions resources/deployment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
default_action :notify

attribute :url, :kind_of => String, :default => 'https://api.newrelic.com/deployments.xml'
attribute :key_type, :kind_of => String, :equal_to => %w(license_key api_key), :default => 'api_key'
attribute :key_type, :kind_of => String, :equal_to => %w[license_key api_key], :default => 'api_key'
attribute :key, :name_attribute => true, :kind_of => String

# @todo take out deprecated api_key logic
Expand All @@ -24,7 +24,5 @@

def initialize(*args)
super
@action = :notify

@run_context.include_recipe 'curl'
end
2 changes: 1 addition & 1 deletion resources/server_monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

attribute :config_file_user, :kind_of => String, :default => 'root'
attribute :service_notify_action, :kind_of => String, :default => 'restart'
attribute :service_actions, :kind_of => Array, :default => %w(enable start)
attribute :service_actions, :kind_of => Array, :default => %w[enable start]
attribute :windows_version, :kind_of => String, :default => '2.0.0.198'
attribute :windows64_checksum, :kind_of => String, :default => '5a8f3f5e8f15997463430401756d377c321c8899c2790ca85e5587a5b643651e'
attribute :windows32_checksum, :kind_of => String, :default => 'ac2b65eecaad461fdd2e4386e3e4c9f96ea940b35bdf7a8c532c21dbd1c99ff0'
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def stub_node_resources(node)

RSpec.configure do |config|
config.mock_with :rspec do |c|
c.syntax = [:should, :expect]
c.syntax = %i[should expect]
end
config.log_level = :error
config.formatter = :documentation
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/agent_java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
ChefSpec::Runner.new(:log_level => LOG_LEVEL, :platform => 'centos', :version => '6.6', :step_into => ['newrelic_agent_java']) do |node|
stub_node_resources(node)
node.override['newrelic']['java_agent']['class_transformer_config'] = {
'classloader_blacklist' => %w(class1 class2),
'classloader_blacklist' => %w[class1 class2],
'instrumentation_classes' => {
'wildfly-8' => { 'enabled' => false },
'wildfly-8-CAT' => { 'enabled' => false },
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/cookbooks/newrelic_lwrp_test/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
name 'newrelic_lwrp_test'
maintainer 'David Joos'
maintainer_email '[email protected]'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: agent_dotnet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: agent_infrastructure
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: agent_java
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: agent_nodejs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: agent_nodejs_recipe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: agent_php
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: agent_python
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: agent_python_recipe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: agent_java
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: lwrp_yml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Encoding: utf-8
#
# Cookbook Name:: newrelic_lwrp_test
# Recipe:: server_monitor
Expand Down
2 changes: 1 addition & 1 deletion test/integration/default/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
it { is_expected.to be_enabled }
end

describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do
it { is_expected.to be_file }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
it { is_expected.to exist }
it { is_expected.to be_enabled }
end
describe file('/etc/apt/sources.list.d/newrelic-infra.list'), :if => %w(debian ubuntu).include?(os[:family]) do
describe file('/etc/apt/sources.list.d/newrelic-infra.list'), :if => %w[debian ubuntu].include?(os[:family]) do
it { is_expected.to be_file }
end
describe package 'newrelic-infra' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
it { is_expected.to exist }
it { is_expected.to be_enabled }
end
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do
it { is_expected.to be_file }
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/nodejs-agent/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
it { is_expected.to exist }
it { is_expected.to be_enabled }
end
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do
it { is_expected.to be_file }
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'spec_helper'

describe file('/etc/php5/conf.d/newrelic.ini'), :if => %w(12.04).include?(os[:release]) do
describe file('/etc/php5/conf.d/newrelic.ini'), :if => %w[12.04].include?(os[:release]) do
it { is_expected.to be_file }
end

describe file('/etc/php5/mods-available/newrelic.ini'), :if => %w(14.04).include?(os[:release]) do
describe file('/etc/php5/mods-available/newrelic.ini'), :if => %w[14.04].include?(os[:release]) do
it { is_expected.to be_file }
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/php-agent/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
it { is_expected.to exist }
it { is_expected.to be_enabled }
end
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do
it { is_expected.to be_file }
end
describe package 'newrelic-daemon' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
it { is_expected.to be_enabled }
end

describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do
it { is_expected.to be_file }
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/python-agent/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
it { is_expected.to exist }
it { is_expected.to be_enabled }
end
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do
it { is_expected.to be_file }
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/server-monitor/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
it { is_expected.to exist }
it { is_expected.to be_enabled }
end
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w(debian ubuntu).include?(os[:family]) do
describe file('/etc/apt/sources.list.d/newrelic.list'), :if => %w[debian ubuntu].include?(os[:family]) do
it { is_expected.to be_file }
end
describe package 'newrelic-sysmond' do
Expand Down

0 comments on commit d9a3cee

Please sign in to comment.