Class: Gergich::Capture::Flake8Capture

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

def run(output)
  # Example:
  # ./djangogeneric/settings/base.py:73:80: E501 line too long (81 > 79 characters)
  pattern = /
    ^([^:\n]+):(\d+):\d+:\s(.*?)\n
  /mx

  output.scan(pattern).map { |file, line, error|
    { path: file, message: error, source: "flake8",
      position: line.to_i, severity: "error" }
  }.compact
end