Sha256: a0a9ff30afd9bd7d73e95b14cdd3de902dce63827b091070c4cd371ab8555513

Contents?: true

Size: 724 Bytes

Versions: 6

Compression:

Stored size: 724 Bytes

Contents

require 'json'
require 'face_control/comment'

module FaceControl
  module Inputs
    class CoffeeLintRaw
      attr_accessor :filename

      def initialize(filename = 'coffeelint_report.json')
        self.filename = filename

        fail "#{filename} does not exist" unless File.exist?(filename)
      end

      def comments
        report.map do |file, problems|
          problems.map do |problem|
            Comment.new(
              file: file,
              line: problem['lineNumber'],
              text: "(#{problem['level']}) #{problem['message']}"
            )
          end
        end.flatten
      end

      private

      def report
        JSON.parse(File.read(filename))
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
face_control-0.6.0 lib/face_control/inputs/coffeelint_raw.rb
face_control-0.5.1 lib/face_control/inputs/coffeelint_raw.rb
face_control-0.5.0 lib/face_control/inputs/coffeelint_raw.rb
face_control-0.4.0 lib/face_control/inputs/coffeelint_raw.rb
face_control-0.3.0 lib/face_control/inputs/coffeelint_raw.rb
face_control-0.2.1 lib/face_control/inputs/coffeelint_raw.rb