Class: Crawlscope::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/crawlscope/reporter.rb

Constant Summary collapse

MAX_ISSUES_PER_GROUP =
20

Instance Method Summary collapse

Constructor Details

#initialize(io:) ⇒ Reporter

Returns a new instance of Reporter.



9
10
11
# File 'lib/crawlscope/reporter.rb', line 9

def initialize(io:)
  @io = io
end

Instance Method Details

#report(result) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/crawlscope/reporter.rb', line 13

def report(result)
  @io.puts("Crawlscope validation")
  @io.puts("Base URL: #{result.base_url}")
  @io.puts("Sitemap: #{result.sitemap_path}")
  @io.puts("URLs: #{result.urls.size}")
  @io.puts("Pages: #{result.pages.size}")

  if result.issues.size.zero?
    @io.puts("Status: OK")
    return
  end

  @io.puts("Status: #{status_for(result.issues)}")
  @io.puts("Issues: #{result.issues.size} total (#{severity_summary(result.issues)})")
  @io.puts("")

  report_summary(result.issues)
  @io.puts("")
  report_issue_groups(result.issues, base_url: result.base_url)
end