Class: DartAnalyzeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/dart_linter/dart_analyze_parser.rb

Class Method Summary collapse

Class Method Details

.violations(input) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dart_linter/dart_analyze_parser.rb', line 5

def violations(input)
  filtered_input = filter_input(input)

  return [] if filtered_input.detect { |element| element.include? "No issues found!" }

  # Check if the line starts with error, warning or info
  level_pattern = /^(?:error|warning|info)/
  
  filtered_input
    .select { |line| line.match?(level_pattern) }
    .map(&method(:parse_line))
end