Class: Pronto::Haml

Inherits:
Runner
  • Object
show all
Defined in:
lib/pronto/haml.rb

Instance Method Summary collapse

Instance Method Details

#inspect(patch) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/pronto/haml.rb', line 15

def inspect(patch)
  lints = runner.run(files: [patch.new_file_full_path.to_s], reporter: reporter).lints
  lints.map do |lint|
    patch.added_lines.select { |line| line.new_lineno == lint.line }
      .map { |line| new_message(lint, line) }
  end
end

#new_message(lint, line) ⇒ Object



23
24
25
26
# File 'lib/pronto/haml.rb', line 23

def new_message(lint, line)
  path = line.patch.delta.new_file[:path]
  Message.new(path, line, lint.severity.name, lint.message, nil, self.class)
end

#runObject



6
7
8
9
10
11
12
13
# File 'lib/pronto/haml.rb', line 6

def run
  return [] unless @patches

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