Class: Yard::Lint::Validators::Documentation::MarkdownSyntax::Parser
- Inherits:
-
Parsers::Base
- Object
- Parsers::Base
- Yard::Lint::Validators::Documentation::MarkdownSyntax::Parser
- Defined in:
- lib/yard/lint/validators/documentation/markdown_syntax/parser.rb
Overview
Parses YARD output for markdown syntax violations
Instance Method Summary collapse
-
#call(output) ⇒ Array<Hash>
Parse YARD output into structured violations.
Methods inherited from Parsers::Base
Instance Method Details
#call(output) ⇒ Array<Hash>
Parse YARD output into structured violations
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/yard/lint/validators/documentation/markdown_syntax/parser.rb', line 13 def call(output) return [] if output.nil? || output.empty? violations = [] lines = output.lines.map(&:chomp) i = 0 while i < lines.size line = lines[i] # Match location line: "file:line: object_name" if (location_match = line.match(/^(.+):(\d+): (.+)$/)) file_path = location_match[1] line_number = location_match[2].to_i object_name = location_match[3] # Next line contains error types i += 1 next unless i < lines.size errors = lines[i].split('|') violations << { location: file_path, line: line_number, object_name: object_name, errors: errors } end i += 1 end violations end |