Class: FaceControl::Checkers::RuboCop

Inherits:
Object
  • Object
show all
Defined in:
lib/face_control/checkers/rubocop.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#options=(value) ⇒ Object (writeonly)

Sets the attribute options

Parameters:

  • value

    the value to set the attribute options to.



10
11
12
# File 'lib/face_control/checkers/rubocop.rb', line 10

def options=(value)
  @options = value
end

Instance Method Details

#command(filenames) ⇒ Object



24
25
26
# File 'lib/face_control/checkers/rubocop.rb', line 24

def command(filenames)
  "rubocop --format json #{filenames}"
end

#parse(command_output) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/face_control/checkers/rubocop.rb', line 28

def parse(command_output)
  JSON.parse(command_output)['files'].map do |file|
    file['offenses'].reject do |offense|
      ignored_severities.include?(offense['severity'])
    end.map do |offense|
      Comment.new(
        file: file['path'],
        line: offense['location']['line'],
        text: text(offense, file)
      )
    end
  end
end

#relevant_globsObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/face_control/checkers/rubocop.rb', line 12

def relevant_globs
  %w(
    *.gemspec
    *.rb
    *.rake
    Capfile
    Gemfile
    Rakefile
    Vagrantfile
  )
end