Class: Policial::StyleGuides::Ruby

Inherits:
Base
  • Object
show all
Defined in:
lib/policial/style_guides/ruby.rb

Overview

Public: Determine Ruby style guide violations per-line.

Constant Summary collapse

KEY =
:ruby

Instance Method Summary collapse

Methods inherited from Base

#config_file, #initialize, #investigate?

Constructor Details

This class inherits a constructor from Policial::StyleGuides::Base

Instance Method Details

#default_config_fileObject



27
28
29
# File 'lib/policial/style_guides/ruby.rb', line 27

def default_config_file
  RuboCop::ConfigLoader::DOTFILE
end

#exclude_file?(filename) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/policial/style_guides/ruby.rb', line 19

def exclude_file?(filename)
  config.file_to_exclude?(filename)
end

#filename_patternObject



23
24
25
# File 'lib/policial/style_guides/ruby.rb', line 23

def filename_pattern
  /.+\.rb\z/
end

#violations_in_file(file) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/policial/style_guides/ruby.rb', line 11

def violations_in_file(file)
  offenses = team.inspect_file(parsed_source(file))

  offenses.reject(&:disabled?).map do |offense|
    Violation.new(file, offense.line, offense.message, offense.cop_name)
  end
end