Class: Gergich::Capture::I18nlinerCapture

Inherits:
BaseCapture
  • Object
show all
Defined in:
lib/gergich/capture/i18nliner_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
# File 'lib/gergich/capture/i18nliner_capture.rb', line 6

def run(output)
  pattern = %r{ # Example:
    ^\d+\)\n    #   1)
    (.*?)\n     #   invalid signature on line 4: <unsupported expression>
    (.*?)\n     #   jsapp/models/user.js
  }mx

  output.scan(pattern).map { |error, file|
    line = 1
    error.sub!(/ on line (\d+)/) do
      line = Regexp.last_match[1]
      ""
    end
    { path: file, message: error, source: "i18n", position: line.to_i, severity: "error" }
  }.compact
end