class Inputs::CoffeeLintRaw

Attributes

filename[RW]

Public Class Methods

new(filename = 'coffeelint_report.json') click to toggle source
# File lib/stash_pull_request_commenter/inputs/coffeelint_raw.rb, line 8
def initialize(filename = 'coffeelint_report.json')
  self.filename = filename

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

Public Instance Methods

comments() click to toggle source
# File lib/stash_pull_request_commenter/inputs/coffeelint_raw.rb, line 14
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 Instance Methods

report() click to toggle source
# File lib/stash_pull_request_commenter/inputs/coffeelint_raw.rb, line 28
def report
  JSON.parse(File.read(filename))
end