Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-08 18:09:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-08 18:09:10 +0300
commita74cb0526c088bf5868f5aba1aec949800c1d641 (patch)
treee30827d0d46a9b2f35fc86bb9deaa8876b362ba7 /rubocop
parente2f984e14e1fd34e5105669c4306388019e6b5b6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r--rubocop/cop/migration/versioned_migration_class.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/rubocop/cop/migration/versioned_migration_class.rb b/rubocop/cop/migration/versioned_migration_class.rb
index 5a2c4f11ece..f2e4550c691 100644
--- a/rubocop/cop/migration/versioned_migration_class.rb
+++ b/rubocop/cop/migration/versioned_migration_class.rb
@@ -13,7 +13,7 @@ module RuboCop
MSG_INHERIT = 'Don\'t inherit from ActiveRecord::Migration but use Gitlab::Database::Migration[1.0] instead. See https://docs.gitlab.com/ee/development/migration_style_guide.html#migration-helpers-and-versioning.'
MSG_INCLUDE = 'Don\'t include migration helper modules directly. Inherit from Gitlab::Database::Migration[1.0] instead. See https://docs.gitlab.com/ee/development/migration_style_guide.html#migration-helpers-and-versioning.'
- MIGRATION_CLASS = 'Gitlab::Database::Migration'
+ ACTIVERECORD_MIGRATION_CLASS = 'ActiveRecord::Migration'
def_node_search :includes_helpers?, <<~PATTERN
(send nil? :include
@@ -24,8 +24,9 @@ module RuboCop
def on_class(node)
return unless relevant_migration?(node)
+ return unless activerecord_migration_class?(node)
- add_offense(node, location: :expression, message: MSG_INHERIT) unless gitlab_migration_class?(node)
+ add_offense(node, location: :expression, message: MSG_INHERIT)
end
def on_send(node)
@@ -40,8 +41,8 @@ module RuboCop
in_migration?(node) && version(node) >= ENFORCED_SINCE
end
- def gitlab_migration_class?(node)
- superclass(node) == MIGRATION_CLASS
+ def activerecord_migration_class?(node)
+ superclass(node) == ACTIVERECORD_MIGRATION_CLASS
end
def superclass(class_node)