Sha256: 11b64e0091578918958e9fc186e638f89c0ac1583de8c9ce6fb2c6a222c20aa5

Contents?: true

Size: 653 Bytes

Versions: 4

Compression:

Stored size: 653 Bytes

Contents

require 'open3'
require_relative 'output_parser'

module Pronto
  module Credo
    class Wrapper
      attr_reader :patch

      def initialize(patch)
        @patch = patch
      end

      def lint
        return [] if patch.nil?
        path = patch.new_file_full_path.to_s
        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

      def credo_executable(path)
        "mix credo --strict --format=flycheck #{path}"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pronto-credo-0.0.5 lib/pronto/credo/wrapper.rb
pronto-credo-0.0.4 lib/pronto/credo/wrapper.rb
pronto-credo-0.0.3 lib/pronto/credo/wrapper.rb
pronto-credo-0.0.2 lib/pronto/credo/wrapper.rb