Class: Gnurr::Linters::RubyLinter

Inherits:
Gnurr::Linter show all
Includes:
RubyBasedLinters
Defined in:
lib/gnurr/linters/ruby_linter.rb

Overview

Ruby Linter

Instance Attribute Summary

Attributes inherited from Gnurr::Linter

#errors

Instance Method Summary collapse

Methods inherited from Gnurr::Linter

#execute, #files, #filter_messages, #full_range, #initialize, #line_diffs, #relevant_messages, #violation_count

Methods included from Git

#extract_lines, #file_diffs, #full_file_diff

Methods included from Helper

#array_to_ranges, #escaped_filename, #left_bump, #log_error, #severity_color

Methods included from CLI

#print_messages

Constructor Details

This class inherits a constructor from Gnurr::Linter

Instance Method Details

#colorObject



13
14
15
# File 'lib/gnurr/linters/ruby_linter.rb', line 13

def color
  :yellow
end

#commandObject



17
18
19
# File 'lib/gnurr/linters/ruby_linter.rb', line 17

def command
  'rubocop -f json'
end

#eligible_filesObject



25
26
27
# File 'lib/gnurr/linters/ruby_linter.rb', line 25

def eligible_files
  @eligible_files ||= run_command('rubocop -L').split("\n")
end

#filter(file) ⇒ Object



21
22
23
# File 'lib/gnurr/linters/ruby_linter.rb', line 21

def filter(file)
  eligible_files.include?(file)
end

#typeObject



9
10
11
# File 'lib/gnurr/linters/ruby_linter.rb', line 9

def type
  :ruby
end