lib/inspec/runner.rb in inspec-4.7.3 vs lib/inspec/runner.rb in inspec-4.7.18
- old
+ new
@@ -134,11 +134,11 @@
def report
Inspec::Reporters.report(@conf["reporter"].first, @run_data)
end
def write_lockfile(profile)
- return false if !profile.writable?
+ return false unless profile.writable?
if profile.lockfile_exists?
Inspec::Log.debug "Using existing lockfile #{profile.lockfile_path}"
else
Inspec::Log.debug "Creating lockfile: #{profile.lockfile_path}"
@@ -180,20 +180,21 @@
#
# @eturns [Inspec::ProfileContext]
#
def add_target(target, _opts = [])
profile = Inspec::Profile.for_target(target,
- vendor_cache: @cache,
- backend: @backend,
- controls: @controls,
- runner_conf: @conf)
+ vendor_cache: @cache,
+ backend: @backend,
+ controls: @controls,
+ runner_conf: @conf)
raise "Could not resolve #{target} to valid input." if profile.nil?
+
@target_profiles << profile if supports_profile?(profile)
end
def supports_profile?(profile)
- if !profile.supports_runtime?
+ unless profile.supports_runtime?
raise "This profile requires #{Inspec::Dist::PRODUCT_NAME} version "\
"#{profile.metadata.inspec_requirement}. You are running "\
"#{Inspec::Dist::PRODUCT_NAME} v#{Inspec::VERSION}.\n"
end
@@ -209,10 +210,11 @@
def register_rules(ctx)
new_tests = false
ctx.rules.each do |rule_id, rule|
next if block_given? && !(yield rule_id, rule)
+
new_tests = true
register_rule(rule)
end
new_tests
end
@@ -236,9 +238,10 @@
private
def block_source_info(block)
return {} if block.nil? || !block.respond_to?(:source_location)
+
opts = {}
file_path, line = block.source_location
opts["file_path"] = file_path
opts["line_number"] = line
opts