Sha256: fe10dac5a0066539f8854466e1e754924a12f18399f77be44e7b5bb313b628b2
Contents?: true
Size: 1005 Bytes
Versions: 1
Compression:
Stored size: 1005 Bytes
Contents
require 'pronto' require 'jshintrb' module Pronto class JSHint < Runner def run 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 = if File.exist?('.jshintrc') Jshintrb.lint(patch.new_file_full_path, :jshintrc) else Jshintrb.lint(patch.new_file_full_path) end.compact 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'], nil, self.class) 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.6.0 | lib/pronto/jshint.rb |