diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-19 03:06:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-19 03:06:11 +0300 |
commit | a7706bcb567ee31c6454c4197354b3210839b564 (patch) | |
tree | a1cbc7e3bf93f87ea43cba4300d044510369e544 /rubocop/migration_helpers.rb | |
parent | e4c711546c693fff89b0b1c92f1b0dde927e0c84 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop/migration_helpers.rb')
-rw-r--r-- | rubocop/migration_helpers.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/rubocop/migration_helpers.rb b/rubocop/migration_helpers.rb index c066d424437..577f768da67 100644 --- a/rubocop/migration_helpers.rb +++ b/rubocop/migration_helpers.rb @@ -3,15 +3,17 @@ module RuboCop module MigrationHelpers # Returns true if the given node originated from the db/migrate directory. def in_migration?(node) - dirname = File.dirname(node.location.expression.source_buffer.name) - - dirname.end_with?('db/migrate', 'db/post_migrate') + dirname(node).end_with?('db/migrate', 'db/geo/migrate') || in_post_deployment_migration?(node) end def in_post_deployment_migration?(node) - dirname = File.dirname(node.location.expression.source_buffer.name) + dirname(node).end_with?('db/post_migrate', 'db/geo/post_migrate') + end + + private - dirname.end_with?('db/post_migrate') + def dirname(node) + File.dirname(node.location.expression.source_buffer.name) end end end |