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