Class: Gergich::Capture::TscCapture

Inherits:
BaseCapture show all
Defined in:
lib/gergich/capture/tsc_capture.rb

Instance Method Summary collapse

Methods inherited from BaseCapture

inherited, normalize_captor_class_name

Instance Method Details

#run(output) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gergich/capture/tsc_capture.rb', line 6

def run(output)
  pattern = /([^(\n]+)\((\d+),(\d+)\): (\w+) (\w+): (.*(\n  .*)*)/

  output.scan(pattern).map { |file, line, pos, severity, code, error|
    {
      path: file,
      message: error,
      source: "tsc",
      rule: code,
      position: {
        start_line: line.to_i,
        start_character: pos.to_i,
        end_line: line.to_i,
        end_character: pos.to_i
      },
      severity: severity
    }
  }
end