module Inspec::Reporters
def self.report(reporter, run_data)
def self.report(reporter, run_data) name, config = reporter.dup config[:run_data] = run_data case name when "json" reporter = Inspec::Reporters::Json.new(config) when "json-automate" reporter = Inspec::Reporters::JsonAutomate.new(config) when "yaml" reporter = Inspec::Reporters::Yaml.new(config) else # If we made it here, it might be a plugin begin activator = Inspec::Plugin::V2::Registry.instance.find_activator(plugin_type: :reporter, activator_name: name.to_sym) activator.activate! reporter = activator.implementation_class.new(config) unless reporter.respond_to(:report?) return run_data end rescue Inspec::Plugin::V2::LoadError # Must not have been a plugin - just return the run_data return run_data end end reporter.report end