class RuboCop::Migration::StrongMigrationsChecker

Constants

SAFETY_ASSURED_WARNINGS

StrongMigrations raises errors for potentially unsafe code, and relies on the user to add a `safety_assured { }` block to supress this warning. These warnings are unsupported by rubocop-migration for now.

Public Instance Methods

check_operation(method_name, *args) click to toggle source
# File lib/rubocop/migration/strong_migrations_checker.rb, line 25
def check_operation(method_name, *args)
  send(method_name, *args)
rescue StrongMigrations::UnsafeMigration => e
  strip_wait_message(e.message)
rescue NoMethodError
  # Do nothing, this method is unrecognized by StrongMigrations unsafe
  # operations and is likely safe.
end
postgresql?() click to toggle source
# File lib/rubocop/migration/strong_migrations_checker.rb, line 21
def postgresql?
  true
end
version_safe?() click to toggle source
# File lib/rubocop/migration/strong_migrations_checker.rb, line 17
def version_safe?
  false
end

Private Instance Methods

raise_error(message_key) click to toggle source
Calls superclass method
# File lib/rubocop/migration/strong_migrations_checker.rb, line 36
def raise_error(message_key)
  return if SAFETY_ASSURED_WARNINGS.include?(message_key)
  super(message_key)
end
strip_wait_message(error_message) click to toggle source

Strip large “WAIT!” ASCII art from the StrongMigrations error message.

# File lib/rubocop/migration/strong_migrations_checker.rb, line 42
def strip_wait_message(error_message)
  error_message.split("\n\n", 2).last
end