Class: Pronto::SlimLint
- Inherits:
-
Runner
- Object
- Runner
- Pronto::SlimLint
- Defined in:
- lib/pronto/slim_lint.rb
Overview
Pronto runner for the SlimLint linter
Instance Method Summary collapse
- #inspect(patch) ⇒ Object
- #new_message(lint, line) ⇒ Object
- #run ⇒ Object
- #slim_file?(path) ⇒ Boolean
Instance Method Details
#inspect(patch) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/pronto/slim_lint.rb', line 17 def inspect(patch) runner = ::SlimLint::Runner.new lints = runner.run(files: [patch.new_file_full_path.to_s]).lints lints.map do |lint| patch.added_lines.select { |line| line.new_lineno == lint.line } .map { |line| (lint, line) } end end |
#new_message(lint, line) ⇒ Object
26 27 28 29 30 |
# File 'lib/pronto/slim_lint.rb', line 26 def (lint, line) path = line.patch.delta.new_file[:path] Message.new(path, line, lint.severity, lint., nil, self.class) end |
#run ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/pronto/slim_lint.rb', line 8 def run return [] unless @patches @patches.select { |patch| patch.additions.positive? } .select { |patch| slim_file?(patch.new_file_full_path) } .map { |patch| inspect(patch) } .flatten.compact end |
#slim_file?(path) ⇒ Boolean
32 33 34 |
# File 'lib/pronto/slim_lint.rb', line 32 def slim_file?(path) '.slim' == File.extname(path) end |