Class: YardJunk::Janitor::HtmlReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- YardJunk::Janitor::HtmlReporter
- Defined in:
- lib/yard-junk/janitor/html_reporter.rb
Overview
Reporter that just outputs everything in HTML format. Useful for usage with Jenkins. See BaseReporter for details about reporters.
Constant Summary collapse
- HEADER =
" <!DOCTYPE html>\n <html lang=\"en\">\n <header>\n <meta charset='UTF-8' />\n <title>YARD-Junk Report</title>\n <style>\n body, html {\n }\n body {\n font-family: \"Helvetica Neue\",Helvetica,Arial,sans-serif;\n margin: 0;\n padding: 20px;\n }\n h2 {\n font-size: 1.6rem;\n }\n h2 small {\n color: gray;\n font-weight: normal;\n }\n span.path {\n font-family: Consolas, \"Liberation Mono\", Menlo, Courier, monospace;\n font-size: 85%;\n }\n .problem { color: red; }\n .notice { color: gray; }\n p.stats {\n padding: 10px;\n font-size: 1.2em;\n border: 1px dotted silver;\n }\n </style>\n </header>\n <body>\n <h1>YARD Validation Report</h1>\n"- FOOTER =
" </body>\n </html>\n"- SECTION =
"<h2 class=\"<%= title == 'Notices' ? 'notice' : 'problem' %>\">\n <%= title %>\n <small>(<%= explanation %>)</small>\n</h2>\n"- ROW =
"<li><span class=\"path\"><%= file %>:<%= line %></span>: <%= message %></li>\n"- STATS =
"<p class=\"stats\">\n <span class=\"<%= 'problem' unless errors.zero? %>\"><%= errors %> failures</span>,\n <span class=\"<%= 'problem' unless problems.zero? %>\"><%= problems %> problems</span>\n (ready in <%= duration %>)\n</p>\n"- Helper =
Class.new(OpenStruct) do def the_binding binding end end
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
Instance Method Summary collapse
- #finalize ⇒ Object
-
#initialize ⇒ HtmlReporter
constructor
A new instance of HtmlReporter.
Methods inherited from BaseReporter
Constructor Details
#initialize ⇒ HtmlReporter
Returns a new instance of HtmlReporter.
82 83 84 85 |
# File 'lib/yard-junk/janitor/html_reporter.rb', line 82 def initialize(*) super @html = HEADER.dup end |
Instance Attribute Details
#html ⇒ Object (readonly)
Returns the value of attribute html.
80 81 82 |
# File 'lib/yard-junk/janitor/html_reporter.rb', line 80 def html @html end |
Instance Method Details
#finalize ⇒ Object
87 88 89 90 |
# File 'lib/yard-junk/janitor/html_reporter.rb', line 87 def finalize @html << FOOTER @io.puts(@html) end |