Class: Inputs::CoffeeLintRaw

Inherits:
Object
  • Object
show all
Defined in:
lib/stash_pull_request_commenter/inputs/coffeelint_raw.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename = 'coffeelint_report.json') ⇒ CoffeeLintRaw

Returns a new instance of CoffeeLintRaw.



8
9
10
11
12
# 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

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



6
7
8
# File 'lib/stash_pull_request_commenter/inputs/coffeelint_raw.rb', line 6

def filename
  @filename
end

Instance Method Details

#commentsObject



14
15
16
17
18
19
20
21
22
23
24
# 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