class Pronto::Credo::Wrapper

Attributes

patch[R]

Public Class Methods

new(patch) click to toggle source
# File lib/pronto/credo/wrapper.rb, line 9
def initialize(patch)
  @patch = patch
end

Public Instance Methods

lint() click to toggle source
# File lib/pronto/credo/wrapper.rb, line 13
def lint
  return [] if patch.nil?
  path = patch.delta.new_file[:path]
  stdout, stderr, _ = Open3.capture3(credo_executable(path))
  puts "WARN: pronto-credo: #{stderr}" if stderr && stderr.size > 0
  return {} if stdout.nil? || stdout == 0
  OutputParser.new(path, stdout).parse
end

Private Instance Methods

credo_executable(path) click to toggle source
# File lib/pronto/credo/wrapper.rb, line 24
def credo_executable(path)
  "mix credo --strict --format=flycheck #{path}"
end