class Gergich::Capture::TscCapture

Public Instance Methods

run(output) click to toggle source
# 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