class RuboCop::Cop::Sequel::MigrationName

MigrationName looks for migration files named with a default name.

Constants

MSG

Public Instance Methods

on_new_investigation() click to toggle source
# File lib/rubocop/cop/sequel/migration_name.rb, line 12
def on_new_investigation
  file_path = processed_source.buffer.name
  return if config.file_to_include?(file_path)

  return unless filename_bad?(file_path)

  location = source_range(processed_source.buffer, 1, 0)
  add_offense(location)
end

Private Instance Methods

filename_bad?(path) click to toggle source
# File lib/rubocop/cop/sequel/migration_name.rb, line 24
def filename_bad?(path)
  basename = File.basename(path)
  basename =~ /#{cop_config.fetch('DefaultName', 'new_migration')}/
end