class Pronto::BundlerAudit::Scanner
Pronto::BundlerAudit::Scanner
runs runs Bundler::Audit::Scanner#scan and then instantiates and calls an appropriate {Pronto::BundlerAudit::BaseResult} object for the given scan result type.
Public Class Methods
# File lib/pronto/bundler_audit/scanner.rb, line 13 def self.call(*args) new(*args).call end
Public Instance Methods
@return [Array<>] if no issues were found @return [Array<Pronto::BundlerAudit::Results::BaseResult>] if unpatched
gem sources or if advisories were found
# File lib/pronto/bundler_audit/scanner.rb, line 20 def call run_scan end
Private Instance Methods
Convert the passed in `scan_result` class/value into a local Results::* class/value.
@param scan_result [::Bundler::Audit::Scanner::*] from the bundler-audit
Gem
@return [Pronto::BundlerAudit::Results::BaseResult]
# File lib/pronto/bundler_audit/scanner.rb, line 58 def match_result(scan_result) case scan_result when ::Bundler::Audit::Results::InsecureSource Pronto::BundlerAudit::Results::InsecureSource.new(scan_result) when ::Bundler::Audit::Results::UnpatchedGem Pronto::BundlerAudit::Results::UnpatchedGem.new(scan_result) else raise ArgumentError, "Unexpected type: #{scan_result.class}" end end
@return [Array<>] if no issues were found @return [Array<Pronto::BundlerAudit::Results::BaseResult>]
# File lib/pronto/bundler_audit/scanner.rb, line 28 def run_scan run_scanner.map do |scan_result| match_result(scan_result) end end
Invoke the 3rd-party bundler-audit Gem.
@param ignore_advisories [Array<String>] the advisories to be ignored
by the bundler_audit scan
@return [Array] if insecure sources are found or if gems with an
advisory are found, the Array will contain ::Bundler::Audit::Scanner::InsecureSource or ::Bundler::Audit::Scanner::UnpatchedGem objects, respectively. - Bundler::Audit::Scanner::InsecureSource = Struct.new(:source) - Bundler::Audit::Scanner::UnpatchedGem = Struct.new(:gem, :advisory)
# File lib/pronto/bundler_audit/scanner.rb, line 45 def run_scanner( ignored_advisories: Pronto::BundlerAudit.configuration.ignored_advisories) ::Bundler::Audit::Scanner.new.scan(ignore: ignored_advisories) end