Class: CC::Analyzer::Formatters::HTMLFormatter::Issue
- Inherits:
-
Object
- Object
- CC::Analyzer::Formatters::HTMLFormatter::Issue
- Defined in:
- lib/cc/analyzer/formatters/html_formatter.rb
Constant Summary collapse
- MARKDOWN_CONFIG =
{ autolink: true, fenced_code_blocks: true, no_intra_emphasis: true, tables: true }.freeze
Instance Method Summary collapse
- #body ⇒ Object
- #categories ⇒ Object
- #description ⇒ Object
- #engine_name ⇒ Object
-
#initialize(data, filesystem) ⇒ Issue
constructor
A new instance of Issue.
- #location ⇒ Object
- #other_locations ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(data, filesystem) ⇒ Issue
Returns a new instance of Issue.
249 250 251 252 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 249 def initialize(data, filesystem) @data = data @filesystem = filesystem end |
Instance Method Details
#body ⇒ Object
258 259 260 261 262 263 264 265 266 |
# 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 ⇒ Object
292 293 294 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 292 def categories data.fetch("categories", []) end |
#description ⇒ Object
254 255 256 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 254 def description data["description"] end |
#engine_name ⇒ Object
296 297 298 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 296 def engine_name data["engine_name"] end |
#location ⇒ Object
275 276 277 278 279 280 281 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 275 def location @location ||= Location.new( source.buffer, data["location"], ) end |
#other_locations ⇒ Object
283 284 285 286 287 288 289 290 |
# 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 ⇒ Object
268 269 270 271 272 273 |
# File 'lib/cc/analyzer/formatters/html_formatter.rb', line 268 def source @source ||= SourceFile.new( data.fetch("location", {}).fetch("path", ""), filesystem, ) end |