Class: NdrDevSupport::RakeCI::CommitCop::RenamedMigration

Inherits:
Object
  • Object
show all
Includes:
Deputisable
Defined in:
lib/ndr_dev_support/rake_ci/commit_cop/renamed_migration.rb

Overview

This cop checks for renamed migrations that change timestamp

Instance Method Summary collapse

Instance Method Details

#check(changes) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/ndr_dev_support/rake_ci/commit_cop/renamed_migration.rb', line 10

def check(changes)
  renamed_migrations = changes[:renamed].select(&migration_file?)
  return if renamed_migrations.all? do |old_file, new_file|
    File.basename(old_file)[0, 14] == File.basename(new_file)[0, 14]
  end

  attachment(:danger,
             'Renamed Migration',
             'Migrations should not change timestamp')
end