mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
Update to Chefstyle 1.2.1
Update a few cop names Remove redundant returns Signed-off-by: Tim Smith <tsmith@chef.io>
This commit is contained in:
parent
fb0be93a00
commit
303f530850
33 changed files with 19 additions and 39 deletions
|
@ -7,5 +7,5 @@ AllCops:
|
|||
- 'lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/**/*'
|
||||
- 'examples/**/controls/*.rb'
|
||||
- 'vendor/bundle/**/*'
|
||||
Layout/AlignArguments:
|
||||
Layout/ArgumentAlignment:
|
||||
EnforcedStyle: with_first_argument
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -19,7 +19,7 @@ group :omnibus do
|
|||
end
|
||||
|
||||
group :test do
|
||||
gem "chefstyle", "~> 0.13.0"
|
||||
gem "chefstyle", "~> 1.2.1"
|
||||
gem "minitest", "~> 5.5"
|
||||
gem "minitest-sprint", "~> 1.0"
|
||||
gem "rake", ">= 10"
|
||||
|
|
|
@ -60,7 +60,7 @@ module Inspec
|
|||
true
|
||||
end
|
||||
|
||||
def self.target_options # rubocop:disable MethodLength
|
||||
def self.target_options # rubocop:disable Metrics/MethodLength
|
||||
option :target, aliases: :t, type: :string,
|
||||
desc: "Simple targeting option using URIs, e.g. ssh://user:pass@host:port"
|
||||
option :backend, aliases: :b, type: :string,
|
||||
|
|
|
@ -49,14 +49,14 @@ module Inspec::Reporters
|
|||
|
||||
res = http.request(req)
|
||||
if res.is_a?(Net::HTTPSuccess)
|
||||
return true
|
||||
true
|
||||
else
|
||||
Inspec::Log.error "send_report: POST to #{uri.path} returned: #{res.body}"
|
||||
return false
|
||||
false
|
||||
end
|
||||
rescue => e
|
||||
Inspec::Log.error "send_report: POST to #{uri.path} returned: #{e.message}"
|
||||
return false
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ module Inspec::Resources
|
|||
elsif inspec.os.windows?
|
||||
@bridge_provider = WindowsBridge.new(inspec)
|
||||
else
|
||||
return skip_resource "The `bridge` resource is not supported on your OS yet."
|
||||
skip_resource "The `bridge` resource is not supported on your OS yet."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ module Inspec::Resources
|
|||
|
||||
missing_requirements = @host_provider.missing_requirements(protocol)
|
||||
unless missing_requirements.empty?
|
||||
return skip_resource "The following requirements are not met for this resource: " \
|
||||
skip_resource "The following requirements are not met for this resource: " \
|
||||
"#{missing_requirements.join(", ")}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ module Inspec::Resources
|
|||
@conf_path = File.join @conf_dir, "postgresql.conf"
|
||||
else
|
||||
@conf_path = nil
|
||||
return skip_resource "Seems like PostgreSQL is not installed on your system"
|
||||
skip_resource "Seems like PostgreSQL is not installed on your system"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ module Inspec
|
|||
end
|
||||
|
||||
# parse device and type
|
||||
mount_options = { device: mount[0], type: mount[4] }
|
||||
mount_options = { device: mount[0], type: mount[4] }
|
||||
|
||||
if compatibility == false
|
||||
# parse options as array
|
||||
|
|
|
@ -22,7 +22,7 @@ module InspecPlugins
|
|||
# return all compliance profiles available for the user
|
||||
# the user is either specified in the options hash or by default
|
||||
# the username of the account is used that is logged in
|
||||
def self.profiles(config, profile_filter = nil) # rubocop:disable PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
|
||||
def self.profiles(config, profile_filter = nil) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
|
||||
owner = config["owner"] || config["user"]
|
||||
|
||||
# Chef Compliance
|
||||
|
@ -81,13 +81,13 @@ module InspecPlugins
|
|||
mapped_profiles.select! do |p|
|
||||
(!ver || p["version"] == ver) && (!id || p["name"] == id)
|
||||
end
|
||||
return msg, mapped_profiles
|
||||
[msg, mapped_profiles]
|
||||
when "401"
|
||||
msg = "401 Unauthorized. Please check your token."
|
||||
return msg, []
|
||||
[msg, []]
|
||||
else
|
||||
msg = "An unexpected error occurred (HTTP #{response_code}): #{response.message}"
|
||||
return msg, []
|
||||
[msg, []]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ module InspecPlugins
|
|||
desc: "Overwrite existing profile on Server."
|
||||
option :owner, type: :string, required: false,
|
||||
desc: "Owner that should own the profile"
|
||||
def upload(path) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, PerceivedComplexity, Metrics/CyclomaticComplexity
|
||||
def upload(path) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
||||
config = InspecPlugins::Compliance::Configuration.new
|
||||
return unless loggedin(config)
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class AwsIamPolicy < Inspec.resource(1)
|
|||
else
|
||||
# But if there is one statement, it is permissable to degenerate the array,
|
||||
# and place the statement as a hash directly under the 'Statement' key
|
||||
return 1
|
||||
1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ class AwsSecurityGroup < Inspec.resource(1)
|
|||
|
||||
@exists = true
|
||||
@description = dsg_response.security_groups[0].description
|
||||
@group_id = dsg_response.security_groups[0].group_id
|
||||
@group_id = dsg_response.security_groups[0].group_id
|
||||
@group_name = dsg_response.security_groups[0].group_name
|
||||
@vpc_id = dsg_response.security_groups[0].vpc_id
|
||||
@inbound_rules = dsg_response.security_groups[0].ip_permissions.map(&:to_h)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: inspec-test-fixture 0.1.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: inspec-test-fixture 0.1.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: inspec-test-fixture 0.1.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: inspec-test-fixture 0.1.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: ordinal_array 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: inspec-test-fixture 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: ordinal_array 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: ordinal_array 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: inspec-test-fixture 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: ordinal_array 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: ordinal_array 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: inspec-test-fixture 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: ordinal_array 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: ordinal_array 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: inspec-test-fixture 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: ordinal_array 0.2.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: train-test-fixture 0.1.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: train-test-fixture 0.1.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: train-test-fixture 0.1.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: train-test-fixture 0.1.0 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
|
|
|
@ -125,9 +125,9 @@ module AwsMCRSB
|
|||
}),
|
||||
}
|
||||
if query.empty?
|
||||
return recorders["default"]
|
||||
recorders["default"]
|
||||
elsif recorders.key?(query[:configuration_recorder_names][0])
|
||||
return recorders[query[:configuration_recorder_names][0]]
|
||||
recorders[query[:configuration_recorder_names][0]]
|
||||
else
|
||||
raise Aws::ConfigService::Errors::NoSuchConfigurationRecorderException.new(nil, nil)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue