class Pronto::JSCSRunner
Public Instance Methods
run()
click to toggle source
# File lib/pronto/jscs.rb, line 6 def run return [] unless @patches @patches.select { |p| p.additions > 0 } .select { |p| js_file?(p.new_file_full_path) } .map { |p| inspect(p) } .flatten .compact end
Private Instance Methods
inspect(patch)
click to toggle source
# File lib/pronto/jscs.rb, line 17 def inspect(patch) offences = JSCS::Wrapper.new(patch).lint offences.map do |_file_path, violations| violations.map do |offence| patch.added_lines.select { |line| line.new_lineno == offence['line'] } .map { |line| new_message(offence, line) } end end end
js_file?(path)
click to toggle source
# File lib/pronto/jscs.rb, line 33 def js_file?(path) File.extname(path) == '.js' end
new_message(offence, line)
click to toggle source
# File lib/pronto/jscs.rb, line 27 def new_message(offence, line) path = line.patch.delta.new_file[:path] level = :warning Message.new(path, line, level, offence['message'], nil, self.class) end