Class: Rails::Guarddog::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/guarddog/scanner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ Scanner

Returns a new instance of Scanner.



6
7
8
9
# File 'lib/rails/guarddog/scanner.rb', line 6

def initialize(config = nil)
  @configuration = config || Configuration.new
  @findings = []
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



4
5
6
# File 'lib/rails/guarddog/scanner.rb', line 4

def configuration
  @configuration
end

#findingsObject

Returns the value of attribute findings.



4
5
6
# File 'lib/rails/guarddog/scanner.rb', line 4

def findings
  @findings
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
# File 'lib/rails/guarddog/scanner.rb', line 11

def run
  load_checkers.each do |checker_class|
    checker = checker_class.new(@configuration.root)
    checker.run
    @findings.concat(checker.findings)
  end
  @findings.sort_by { |f| severity_order(f.severity) }
end