Class: Yard::Lint::Parsers::TwoLineBase

Inherits:
Base
  • Object
show all
Defined in:
lib/yard/lint/parsers/two_line_base.rb

Overview

Base class for all two line warnings parsers

Instance Method Summary collapse

Methods inherited from Base

#match

Instance Method Details

#call(yard_stats) ⇒ Array<Hash>

Returns array with all warnings informations from yard stats analysis.

Parameters:

  • yard_stats (String)

    raw yard stats results string

Returns:

  • (Array<Hash>)

    array with all warnings informations from yard stats analysis



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/yard/lint/parsers/two_line_base.rb', line 10

def call(yard_stats)
  # Not all the lines from the yard_stats output are valuable, that's why we filter
  # them out, preprocess and leave only those against which we should match
  rows = classify(yard_stats.split("\n"))

  rows.map do |warning|
    {
      name: self.class.to_s.split('::').last,
      message: match(warning[0], :message).last,
      location: match(warning[1], :location).last,
      line: match(warning[1], :line).last.to_i
    }
  end
end