Class: Pronto::ESLintNpm

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

Instance Method Summary collapse

Instance Method Details

#inspect(patch) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pronto/eslint_npm.rb', line 14

def inspect(patch)
  @_repo_path ||= @patches.first.repo.path

  offences = run_eslint(patch)
  clean_up_eslint_output(offences)
    .map do |offence|
      patch
        .added_lines
        .select { |line| line.new_lineno == offence['line'] }
        .map { |line| new_message(offence, line) }
    end
end

#runObject



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

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