class Gergich::Capture::SwiftlintCapture
Constants
- SEVERITY_MAP
See SeverityLevelsConfiguration.swift
Public Instance Methods
run(output)
click to toggle source
# File lib/gergich/capture/swiftlint_capture.rb, line 14 def run(output) # rubocop:disable Layout/LineLength # # Example: # /path/to/My.swift:13:22: warning: Colon Violation: Colons should be next to the identifier when specifying a type. (colon) # /path/to/Fail.swift:80: warning: Line Length Violation: Line should be 100 characters or less: currently 108 characters (line_length) # # rubocop:enable Layout/LineLength pattern = / ^([^:\n]+):(\d+)(?::\d+)?:\s(\w+):\s(.*?)\n /mx output.scan(pattern).map { |file, line, severity, error, _context| { path: file, message: error, source: "swiftlint", position: line.to_i, severity: SEVERITY_MAP[severity] } }.compact end