Class: GLRubocop::GLCops::PreventErbFiles

Inherits:
RuboCop::Cop::Cop
  • Object
show all
Defined in:
lib/gl_rubocop/gl_cops/prevent_erb_files.rb

Constant Summary collapse

MSG =
'File name should not end with .erb'.freeze

Instance Method Summary collapse

Instance Method Details

#investigate(processed_source) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/gl_rubocop/gl_cops/prevent_erb_files.rb', line 6

def investigate(processed_source)
  file_path = processed_source.buffer.name
  return unless File.extname(file_path) == '.erb'

  range = processed_source.buffer.source_range
  add_offense(nil, location: range, message: MSG)
end