From 8f1e607d55fd6a9cc74656b4c62ea58be65479d7 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Thu, 7 Nov 2019 14:29:16 -0800 Subject: [PATCH] Bump chefstyle and fix up flagged code. Very minor. I want to change a default config but I'll do that in a separate commit since it is a bigger diff. Signed-off-by: Ryan Davis --- Gemfile | 2 +- lib/inspec/config.rb | 3 ++- lib/inspec/resources/oracledb_session.rb | 7 +++++-- lib/inspec/resources/sys_info.rb | 4 ++-- lib/inspec/resources/users.rb | 4 ++++ tasks/maintainers.rb | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index a590218d1..1237af85c 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ group :omnibus do end group :test do - gem "chefstyle", "0.13.0" + gem "chefstyle", "~> 0.13.0" gem "coveralls", require: false gem "minitest", "~> 5.5" gem "rake", ">= 10" diff --git a/lib/inspec/config.rb b/lib/inspec/config.rb index 15182c8df..79255b5fe 100644 --- a/lib/inspec/config.rb +++ b/lib/inspec/config.rb @@ -207,7 +207,8 @@ module Inspec end def _utc_find_credset_name(_credentials, transport_name) - return nil unless final_options[:target] + return unless final_options[:target] + match = final_options[:target].match(%r{^#{transport_name}://(?[\w\-]+)$}) match ? match[:credset_name] : nil end diff --git a/lib/inspec/resources/oracledb_session.rb b/lib/inspec/resources/oracledb_session.rb index fb747c99a..c362a35f1 100644 --- a/lib/inspec/resources/oracledb_session.rb +++ b/lib/inspec/resources/oracledb_session.rb @@ -21,6 +21,9 @@ module Inspec::Resources end EXAMPLE + # rubocop:disable Layout/AlignArguments + # going to switch this back off in a separate commit + attr_reader :bin, :db_role, :host, :password, :port, :service, :su_user, :user @@ -58,8 +61,8 @@ module Inspec::Resources command = command_builder(format_options, sql) inspec_cmd = inspec.command(command) - DatabaseHelper::SQLQueryResult.new(inspec_cmd, send(parser, - inspec_cmd.stdout)) + DatabaseHelper::SQLQueryResult.new(inspec_cmd, + send(parser, inspec_cmd.stdout)) end def to_s diff --git a/lib/inspec/resources/sys_info.rb b/lib/inspec/resources/sys_info.rb index 914e2c524..e4189543d 100644 --- a/lib/inspec/resources/sys_info.rb +++ b/lib/inspec/resources/sys_info.rb @@ -45,7 +45,7 @@ module Inspec::Resources end def linux_hostname(opt = nil) - if !opt.nil? + if opt opt = case opt when "f", "long", "fqdn", "full" " -f" @@ -67,7 +67,7 @@ module Inspec::Resources end def mac_hostname(opt = nil) - if !opt.nil? + if opt opt = case opt when "f", "long", "fqdn", "full" " -f" diff --git a/lib/inspec/resources/users.rb b/lib/inspec/resources/users.rb index df85af51c..8a43970ec 100644 --- a/lib/inspec/resources/users.rb +++ b/lib/inspec/resources/users.rb @@ -624,7 +624,9 @@ module Inspec::Resources def meta_info(username) res = identity(username) + return if res.nil? + { home: res[:home], shell: res[:shell], @@ -635,7 +637,9 @@ module Inspec::Resources def credentials(username) res = identity(username) + return if res.nil? + { mindays: res[:mindays], maxdays: res[:maxdays], diff --git a/tasks/maintainers.rb b/tasks/maintainers.rb index 9d5bbe91e..553d1e3cf 100644 --- a/tasks/maintainers.rb +++ b/tasks/maintainers.rb @@ -153,7 +153,7 @@ begin deletions.each do |member| puts "Removing #{member} from #{team}" github.remove_team_membership(gh_teams[team]["id"], member, - accept: "application/vnd.github.ironman-preview+json") + accept: "application/vnd.github.ironman-preview+json") end end