Class: AxR::Formatters::Default

Inherits:
Base
  • Object
show all
Defined in:
lib/axr/formatters/default.rb

Constant Summary collapse

DOT =
'.'
STAR =
'*'

Instance Method Summary collapse

Instance Method Details

#single_file(scanner, _file_path) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/axr/formatters/default.rb', line 13

def single_file(scanner, _file_path)
  if scanner.warnings.any?
    STDOUT.print ColorizedString[STAR].colorize(:yellow)
  else
    STDOUT.print ColorizedString[DOT].colorize(:green)
  end
end

#summary(scanned_files, files_with_warnings) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/axr/formatters/default.rb', line 21

def summary(scanned_files, files_with_warnings)
  STDOUT.puts
  STDOUT.puts

  issues_amount = 0

  files_with_warnings.each_pair do |file_path, warnings|
    warnings.each do |warning|
      issues_amount += 1
      msg = "#{file_path}:#{warning.loc_num} # => #{warning.message}"
      STDOUT.puts ColorizedString[msg].colorize(:yellow)
    end
  end

  STDOUT.puts
  STDOUT.puts
  STDOUT.puts("#{scanned_files.size} files scanned. #{issues_amount} issues detected")
end