class Pronto::Dialyzer::Runner
Constants
- BEAM_EXTENSIONS
Public Instance Methods
affected_lines(patch)
click to toggle source
# File lib/pronto/dialyzer.rb, line 15 def affected_lines(patch) candidate_lines = patch.lines.select { |line| line.addition? } candidate_lines.reduce([]) do |accum, line| affected_line = dialyzer_lines.find do |dline| patch.repo.path.join(dline.path) == patch.new_file_full_path && dline.lineno == line.new_lineno end if affected_line accum << new_message(line, affected_line) else accum end end end
beam_patches()
click to toggle source
# File lib/pronto/dialyzer.rb, line 35 def beam_patches @patches.select do |patch| BEAM_EXTENSIONS.member?(File.extname(patch.new_file_full_path)) end end
dialyzer_lines()
click to toggle source
# File lib/pronto/dialyzer.rb, line 47 def dialyzer_lines @dialyzer_lines ||= matching_lines( dialyzer_output_pathname, /(?<path>.+\.[a-z]{2,3}):(?<lineno>[0-9]+): (?<error_msg>.+)/ ) end
dialyzer_output_pathname()
click to toggle source
# File lib/pronto/dialyzer.rb, line 41 def dialyzer_output_pathname @dialyzer_output_path ||= Pathname.new( ENV["PRONTO_DIALYZER_OUTPUT"] || "dialyzer.out" ) end
new_message(line, dline)
click to toggle source
# File lib/pronto/dialyzer.rb, line 31 def new_message(line, dline) Pronto::Message.new(dline.path, line, :warning, dline.error) end
run()
click to toggle source
# File lib/pronto/dialyzer.rb, line 8 def run return [] unless dialyzer_output_pathname.exist? beam_patches .select { |patch| patch.delta.status != :deleted } .flat_map { |patch| affected_lines(patch) } end
Private Instance Methods
matching_lines(pathname, line_regex)
click to toggle source
# File lib/pronto/dialyzer.rb, line 56 def matching_lines(pathname, line_regex) pathname.readlines.reduce([]) do |accum, line| if match = line.match(line_regex) accum << OpenStruct.new( path: match[:path], lineno: match[:lineno].to_i, error: match[:error_msg] ) else accum end end end