Sha256: bd4b2a3dcffde92920b3725811e4e1512eccf2c7416e006daabc84bee0fd4da8
Contents?: true
Size: 865 Bytes
Versions: 1
Compression:
Stored size: 865 Bytes
Contents
require 'pronto' require 'jshintrb' module Pronto class JSHint < Runner def run(patches, commit) return [] unless patches patches.select { |patch| patch.additions > 0 } .select { |patch| js_file?(patch.new_file_full_path) } .map { |patch| inspect(patch) } .flatten.compact end def inspect(patch) offences = Jshintrb.lint(patch.new_file_full_path) offences.map do |offence| patch.added_lines.select { |line| line.new_lineno == offence['line'] } .map { |line| new_message(offence, line) } end end def new_message(offence, line) path = line.patch.delta.new_file[:path] level = :warning Message.new(path, line, level, offence['reason']) end def js_file?(path) File.extname(path) == '.js' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pronto-jshint-0.2.0 | lib/pronto/jshint.rb |