class Pronto::Coffeelint

Public Instance Methods

coffee_file?(path) click to toggle source
# File lib/pronto/coffeelint.rb, line 37
def coffee_file?(path)
  File.extname(path) == '.coffee'
end
inspect(patch) click to toggle source
# File lib/pronto/coffeelint.rb, line 15
def inspect(patch)
  offences = ::Coffeelint.lint_file(patch.new_file_full_path).compact

  offences.map do |offence|
    patch.added_lines
      .select { |line| line.new_lineno == offence['lineNumber'] }
      .map { |line| new_message(offence, line) }
  end
end
new_message(offence, line) click to toggle source
# File lib/pronto/coffeelint.rb, line 25
def new_message(offence, line)
  path = line.patch.delta.new_file[:path]
  level = {
    'info' => :info,
    'warn' => :warning,
    'error' => :error,
    'fatal' => :fatal
  }[offence['level']]

  Message.new(path, line, level, offence['message'], nil, self.class)
end
run() click to toggle source
# File lib/pronto/coffeelint.rb, line 6
def run
  return [] unless @patches

  @patches.select { |patch| patch.additions > 0 }
         .select { |patch| coffee_file?(patch.new_file_full_path) }
         .map { |patch| inspect(patch) }
         .flatten.compact
end