Parent

Methods

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::FileName

This cop makes sure that Ruby source files have snake_case names.

Constants

MSG
SNAKE_CASE

Public Instance Methods

investigate(processed_source) click to toggle source
# File lib/rubocop/cop/style/file_name.rb, line 11
def investigate(processed_source)
  file_path = processed_source.buffer.name
  return if config.file_to_include?(file_path)

  basename = File.basename(file_path).sub(/\.[^\.]+$/, '')
  return if snake_case?(basename)

  add_offense(nil,
              source_range(processed_source.buffer,
                           processed_source[0..0],
                           0, 1))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.