class CC::Analyzer::Formatters::HTMLFormatter::Issue
Constants
- MARKDOWN_CONFIG
Attributes
data[R]
filesystem[R]
Public Class Methods
new(data, filesystem)
click to toggle source
# File lib/cc/analyzer/formatters/html_formatter.rb, line 249 def initialize(data, filesystem) @data = data @filesystem = filesystem end
Public Instance Methods
body()
click to toggle source
# File lib/cc/analyzer/formatters/html_formatter.rb, line 258 def body @body ||= begin text = data.fetch("content", {}).fetch("body", "").strip unless text.empty? markdown(text) end end end
categories()
click to toggle source
# File lib/cc/analyzer/formatters/html_formatter.rb, line 292 def categories data.fetch("categories", []) end
description()
click to toggle source
# File lib/cc/analyzer/formatters/html_formatter.rb, line 254 def description data["description"] end
engine_name()
click to toggle source
# File lib/cc/analyzer/formatters/html_formatter.rb, line 296 def engine_name data["engine_name"] end
location()
click to toggle source
# File lib/cc/analyzer/formatters/html_formatter.rb, line 275 def location @location ||= Location.new( source.buffer, data["location"], ) end
other_locations()
click to toggle source
# File lib/cc/analyzer/formatters/html_formatter.rb, line 283 def other_locations @other_locations ||= begin data.fetch("other_locations", []).map do |loc| [SourceFile.new(loc["path"], filesystem), loc] end.to_h end end
source()
click to toggle source
# File lib/cc/analyzer/formatters/html_formatter.rb, line 268 def source @source ||= SourceFile.new( data.fetch("location", {}).fetch("path", ""), filesystem, ) end
Private Instance Methods
markdown(text)
click to toggle source
# File lib/cc/analyzer/formatters/html_formatter.rb, line 304 def markdown(text) html = Redcarpet::Render::HTML.new( escape_html: false, link_attributes: { target: "_blank" }, ) redcarpet = Redcarpet::Markdown.new(html, MARKDOWN_CONFIG) redcarpet.render(text) end