From 3bef28d69af921ca2afed2b595062e1e88dad01f Mon Sep 17 00:00:00 2001 From: Cookstyle Bot Date: Fri, 18 Jun 2021 16:43:15 -0700 Subject: [PATCH] Cookstyle Bot Auto Corrections with Cookstyle 7.13.0 This change is automatically generated by the Cookstyle Bot using the latest version of Cookstyle (7.13.0). Adopting changes suggested by Cookstyle improves cookbook readability, avoids common coding mistakes, and eases upgrades to newer versions of the Chef Infra Client. Signed-off-by: Cookstyle --- files/default/handler/audit_report.rb | 17 ++++++++--------- files/default/vendor/chef-automate/fetcher.rb | 2 +- files/default/vendor/chef-server/fetcher.rb | 3 +-- resources/inspec_gem.rb | 1 + 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/files/default/handler/audit_report.rb b/files/default/handler/audit_report.rb index ce0ba99e..d7ac49e4 100644 --- a/files/default/handler/audit_report.rb +++ b/files/default/handler/audit_report.rb @@ -155,7 +155,7 @@ def get_opts(reporter, quiet, attributes) true end end - opts = { + { 'report' => true, 'format' => reporter, # For compatibility with older versions of inspec. TODO: Remove this line from Q2 2019 'reporter' => [reporter], @@ -167,7 +167,6 @@ def get_opts(reporter, quiet, attributes) reporter_message_truncation: node['audit']['result_message_limit'], reporter_backtrace_inclusion: node['audit']['result_include_backtrace'], } - opts end # run profiles and return report @@ -210,20 +209,20 @@ def call(opts, profiles) # In case InSpec raises a runtime exception without providing a valid report, # we make one up and add two new fields to it: `status` and `status_message` def failed_report(err) - Chef::Log.error "InSpec has raised a runtime exception. Generating a minimal failed report." + Chef::Log.error 'InSpec has raised a runtime exception. Generating a minimal failed report.' Chef::Log.error err { "platform": { - "name": "unknown", - "release": "unknown" + "name": 'unknown', + "release": 'unknown', }, "profiles": [], "statistics": { - "duration": 0.0000001 + "duration": 0.0000001, }, - "version": "4.22.0", - "status": "failed", - "status_message": err + "version": '4.22.0', + "status": 'failed', + "status_message": err, } end diff --git a/files/default/vendor/chef-automate/fetcher.rb b/files/default/vendor/chef-automate/fetcher.rb index 2992820d..6ea754e7 100644 --- a/files/default/vendor/chef-automate/fetcher.rb +++ b/files/default/vendor/chef-automate/fetcher.rb @@ -13,7 +13,7 @@ def self.resolve(target) URI("compliance://#{target[:compliance]}") end - return nil if uri.nil? + return if uri.nil? # we have detailed information available in our lockfile, no need to ask the server if target.respond_to?(:key?) && target.key?(:url) diff --git a/files/default/vendor/chef-server/fetcher.rb b/files/default/vendor/chef-server/fetcher.rb index 287dda0a..0b0666ad 100644 --- a/files/default/vendor/chef-server/fetcher.rb +++ b/files/default/vendor/chef-server/fetcher.rb @@ -1,4 +1,3 @@ -# encoding: utf-8 # author: Christoph Hartmann require 'uri' @@ -28,7 +27,7 @@ def self.resolve(target) URI("compliance://#{target[:compliance]}") end - return nil if uri.nil? + return if uri.nil? profile = uri.host + uri.path profile = uri.user + '@' + profile if uri.user diff --git a/resources/inspec_gem.rb b/resources/inspec_gem.rb index 51c05fb3..9ab540b4 100644 --- a/resources/inspec_gem.rb +++ b/resources/inspec_gem.rb @@ -1,4 +1,5 @@ provides :inspec_gem +unified_mode true resource_name :inspec_gem property :gem_name, String, name_property: true