Skip to content

Commit

Permalink
Automated chefstyle application for rubocop 0.72 compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
  • Loading branch information
clintoncwolfe committed Jul 3, 2019
1 parent 490824e commit e4e7c25
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 122 deletions.
26 changes: 13 additions & 13 deletions lib/inspec/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,19 @@ def validate_config_file_contents!
def validate_reporters!(reporters)
return if reporters.nil?
# TODO: move this into a reporter plugin type system
valid_types = [
"automate",
"cli",
"documentation",
"html",
"json",
"json-automate",
"json-min",
"json-rspec",
"junit",
"progress",
"yaml",
]
valid_types = %w{
automate
cli
documentation
html
json
json-automate
json-min
json-rspec
junit
progress
yaml
}

reporters.each do |reporter_name, reporter_config|
raise NotImplementedError, "'#{reporter_name}' is not a valid reporter type." unless valid_types.include?(reporter_name)
Expand Down
4 changes: 2 additions & 2 deletions lib/inspec/plugin/v2/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ def build_gem_request_universe(extra_request_sets = [], gem_to_force_update = ni

# Combine the Sets, so the resolver has one composite place to look
Gem::Resolver.compose_sets(
installed_plugins_gem_set, # The gems that are in the plugin gem path directory tree
installed_plugins_gem_set, # The gems that are in the plugin gem path directory tree
InstalledVendorSet.new,
*extra_request_sets, # Anything else our caller wanted to include
*extra_request_sets # Anything else our caller wanted to include
)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/inspec/plugin/v2/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Inspec::Plugin::V2
:loaded, # true, false False could mean not attempted or failed
:load_exception, # Exception class if it failed to load
:name, # String name
:version, # three-digit version. Core / bundled plugins use InSpec version here.
:version # three-digit version. Core / bundled plugins use InSpec version here.
) do
def initialize(*)
super
Expand Down
2 changes: 1 addition & 1 deletion lib/inspec/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def initialize(source_reader, options = {})
cli_input_files: options[:runner_conf][:input_file], # From CLI --input-file
profile_metadata: metadata,
# TODO: deprecation checks here
runner_api: options[:runner_conf][:attributes], # This is the route the audit_cookbook and kitchen-inspec take
runner_api: options[:runner_conf][:attributes] # This is the route the audit_cookbook and kitchen-inspec take
)

@runner_context =
Expand Down
2 changes: 1 addition & 1 deletion lib/inspec/resources/apt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def read_debs
components: parse_repo[4].chomp.split(" "),
active: active,
}
next unless ["deb", "deb-src"].include? repo[:type]
next unless %w{deb deb-src}.include? repo[:type]

lines.push(repo)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ def test_search_omit_excluded_inspec_plugins
result = run_inspec_process("plugin search --include-test-fixture inspec-")
assert_equal 0, result.exit_status, "Search should exit 0"
assert_includes result.stdout, "inspec-test-fixture", "Search result should contain the test gem"
[
"inspec-core",
"inspec-multi-server",
].each do |plugin_name|
%w{
inspec-core
inspec-multi-server
}.each do |plugin_name|
refute_includes result.stdout, plugin_name, "Search result should not contain excluded gems"
end
end
Expand Down Expand Up @@ -555,11 +555,11 @@ def test_refuse_install_when_plugin_on_exclusion_list
# are the names of real rubygems. They are not InSpec/Train plugins, though,
# and installing them would be a jam-up.
# This is configured in 'etc/plugin-filter.json'.
[
"inspec-core",
"inspec-multi-server",
"train-tax-calculator",
].each do |plugin_name|
%w{
inspec-core
inspec-multi-server
train-tax-calculator
}.each do |plugin_name|
install_result = run_inspec_process_with_this_plugin("plugin install #{plugin_name}")
assert_empty install_result.stderr
assert_equal 2, install_result.exit_status, "Exit status should be 2"
Expand Down
2 changes: 1 addition & 1 deletion test/unit/dsl/describe_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
end

it "constructs a resource+argument block without a property call" do
obj.qualifier = [["service", "avahi-daemon"]]
obj.qualifier = [%w{service avahi-daemon}]
obj.qualifier.push(["info['properties']['UnitFileState']"])
obj.add_test(nil, "eq", "enabled")
obj.to_ruby.must_equal '
Expand Down
2 changes: 1 addition & 1 deletion test/unit/dsl/objects_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
end

it "constructs a resource+argument block without a property call" do
obj.qualifier = [["service", "avahi-daemon"]]
obj.qualifier = [%w{service avahi-daemon}]
obj.qualifier.push(["info['properties']['UnitFileState']"])
obj.expectation = "enabled"
obj.matcher = "eq"
Expand Down
18 changes: 9 additions & 9 deletions test/unit/plugin/v2/installer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ def test_refuse_to_install_gem_whose_name_is_on_the_reject_list
# are the names of real rubygems. They are not InSpec/Train plugins, though,
# and installing them would be a jam-up.
# This is configured in 'etc/plugin-filter.json'.
[
"inspec-core",
"inspec-multi-server",
"train-tax-calculator",
].each do |plugin_name|
%w{
inspec-core
inspec-multi-server
train-tax-calculator
}.each do |plugin_name|
ex = assert_raises(Inspec::Plugin::V2::InstallError) { @installer.install(plugin_name) }
assert_includes(ex.message, "on the Plugin Exclusion List")
assert_includes(ex.message, "Rationale:")
Expand Down Expand Up @@ -490,10 +490,10 @@ def test_search_omits_inspec_gem_on_the_reject_list
# are the names of real rubygems. They are not InSpec/Train plugins, though,
# and installing them would be a jam-up.
# This is configured in 'etc/plugin_filters.json'.
[
"inspec-core",
"inspec-multi-server",
].each do |plugin_name|
%w{
inspec-core
inspec-multi-server
}.each do |plugin_name|
refute results.key(plugin_name)
end
end
Expand Down
76 changes: 38 additions & 38 deletions test/unit/resources/aws_elb_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ def describe_load_balancers(query = {})
data = Aws::ElasticLoadBalancing::Types::DescribeAccessPointsOutput.new(
load_balancer_descriptions: [
Aws::ElasticLoadBalancing::Types::LoadBalancerDescription.new(
availability_zones: [
"us-east-1a",
"us-east-1c",
],
availability_zones: %w{
us-east-1a
us-east-1c
},
dns_name: "12345678.us-east-1.aws.amazon.com",
load_balancer_name: "kang-the-alien",
listener_descriptions: [
Expand All @@ -174,22 +174,22 @@ def describe_load_balancers(query = {})
Aws::ElasticLoadBalancing::Types::Instance.new(instance_id: "i-12345678"),
Aws::ElasticLoadBalancing::Types::Instance.new(instance_id: "i-aaaabbbb"),
],
security_groups: [
"sg-12345678",
"sg-aaaabbbb",
"sg-99998888",
],
subnets: [
"subnet-12345678",
"subnet-aaaabbbb",
],
security_groups: %w{
sg-12345678
sg-aaaabbbb
sg-99998888
},
subnets: %w{
subnet-12345678
subnet-aaaabbbb
},
vpc_id: "vpc-12345678"
),
Aws::ElasticLoadBalancing::Types::LoadBalancerDescription.new(
availability_zones: [
"us-east-1b",
"us-east-1c",
],
availability_zones: %w{
us-east-1b
us-east-1c
},
dns_name: "12345678.us-east-2.aws.amazon.com",
load_balancer_name: "kangaroo",
listener_descriptions: [
Expand All @@ -205,21 +205,21 @@ def describe_load_balancers(query = {})
instances: [
Aws::ElasticLoadBalancing::Types::Instance.new(instance_id: "i-87654321"),
],
security_groups: [
"sg-12345678",
"sg-99998888",
],
subnets: [
"subnet-12345678",
"subnet-aaaabbbb",
],
security_groups: %w{
sg-12345678
sg-99998888
},
subnets: %w{
subnet-12345678
subnet-aaaabbbb
},
vpc_id: "vpc-12345678"
),
Aws::ElasticLoadBalancing::Types::LoadBalancerDescription.new(
availability_zones: [
"us-east-1a",
"us-east-1e",
],
availability_zones: %w{
us-east-1a
us-east-1e
},
dns_name: "999999.us-east-1.aws.amazon.com",
load_balancer_name: "gamma",
listener_descriptions: [
Expand All @@ -234,15 +234,15 @@ def describe_load_balancers(query = {})
],
instances: [
],
security_groups: [
"sg-12345678",
"sg-99998888",
"sg-01010101",
],
subnets: [
"subnet-ccccdddd",
"subnet-aaaabbbb",
],
security_groups: %w{
sg-12345678
sg-99998888
sg-01010101
},
subnets: %w{
subnet-ccccdddd
subnet-aaaabbbb
},
vpc_id: "vpc-87654321"
)
]
Expand Down
76 changes: 38 additions & 38 deletions test/unit/resources/aws_elbs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ def describe_load_balancers(query = {})
Aws::ElasticLoadBalancing::Types::DescribeAccessPointsOutput.new(
load_balancer_descriptions: [
Aws::ElasticLoadBalancing::Types::LoadBalancerDescription.new(
availability_zones: [
"us-east-1a",
"us-east-1c",
],
availability_zones: %w{
us-east-1a
us-east-1c
},
dns_name: "12345678.us-east-1.aws.amazon.com",
load_balancer_name: "kang-the-alien",
listener_descriptions: [
Expand All @@ -233,22 +233,22 @@ def describe_load_balancers(query = {})
Aws::ElasticLoadBalancing::Types::Instance.new(instance_id: "i-12345678"),
Aws::ElasticLoadBalancing::Types::Instance.new(instance_id: "i-aaaabbbb"),
],
security_groups: [
"sg-12345678",
"sg-aaaabbbb",
"sg-99998888",
],
subnets: [
"subnet-12345678",
"subnet-aaaabbbb",
],
security_groups: %w{
sg-12345678
sg-aaaabbbb
sg-99998888
},
subnets: %w{
subnet-12345678
subnet-aaaabbbb
},
vpc_id: "vpc-12345678"
),
Aws::ElasticLoadBalancing::Types::LoadBalancerDescription.new(
availability_zones: [
"us-east-1b",
"us-east-1c",
],
availability_zones: %w{
us-east-1b
us-east-1c
},
dns_name: "12345678.us-east-2.aws.amazon.com",
load_balancer_name: "kangaroo",
listener_descriptions: [
Expand All @@ -264,21 +264,21 @@ def describe_load_balancers(query = {})
instances: [
Aws::ElasticLoadBalancing::Types::Instance.new(instance_id: "i-87654321"),
],
security_groups: [
"sg-12345678",
"sg-99998888",
],
subnets: [
"subnet-12345678",
"subnet-aaaabbbb",
],
security_groups: %w{
sg-12345678
sg-99998888
},
subnets: %w{
subnet-12345678
subnet-aaaabbbb
},
vpc_id: "vpc-12345678"
),
Aws::ElasticLoadBalancing::Types::LoadBalancerDescription.new(
availability_zones: [
"us-east-1a",
"us-east-1e",
],
availability_zones: %w{
us-east-1a
us-east-1e
},
dns_name: "999999.us-east-1.aws.amazon.com",
load_balancer_name: "gamma",
listener_descriptions: [
Expand All @@ -293,15 +293,15 @@ def describe_load_balancers(query = {})
],
instances: [
],
security_groups: [
"sg-12345678",
"sg-99998888",
"sg-01010101",
],
subnets: [
"subnet-ccccdddd",
"subnet-aaaabbbb",
],
security_groups: %w{
sg-12345678
sg-99998888
sg-01010101
},
subnets: %w{
subnet-ccccdddd
subnet-aaaabbbb
},
vpc_id: "vpc-87654321"
)
]
Expand Down
2 changes: 1 addition & 1 deletion test/unit/resources/aws_iam_user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def list_user_policies(query)
policy_names: []
),
"leslie" => Aws::IAM::Types::ListUserPoliciesResponse.new(
policy_names: ["leslie-inline-01", "leslie-inline-02"]
policy_names: %w{leslie-inline-01 leslie-inline-02}
),
"jared" => Aws::IAM::Types::ListUserPoliciesResponse.new(
policy_names: ["jared-inline-01"]
Expand Down
2 changes: 1 addition & 1 deletion test/unit/resources/aws_iam_users_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def list_user_policies(query)
policy_names: []
),
"bob" => Aws::IAM::Types::ListUserPoliciesResponse.new(
policy_names: ["bob-inline-01", "bob-inline-02"]
policy_names: %w{bob-inline-01 bob-inline-02}
),
"carol" => Aws::IAM::Types::ListUserPoliciesResponse.new(
policy_names: ["carol-inline-01"]
Expand Down

0 comments on commit e4e7c25

Please sign in to comment.