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>2023-01-24 18:07:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-24 18:07:34 +0300
commitdf9890e9a702e2f12bbc8f022b916ca72820a292 (patch)
tree26ff255cfb6843fe963fcafea9ee70121ee5e913 /rubocop/migration_helpers.rb
parent17c1c66eefd05243dd8ed2c8fd49d17ab1a52522 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop/migration_helpers.rb')
-rw-r--r--rubocop/migration_helpers.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/rubocop/migration_helpers.rb b/rubocop/migration_helpers.rb
index 50d7b198931..d14b1bdd6bb 100644
--- a/rubocop/migration_helpers.rb
+++ b/rubocop/migration_helpers.rb
@@ -61,11 +61,16 @@ module RuboCop
File.basename(node.location.expression.source_buffer.name).split('_').first.to_i
end
- # Returns true if a column definition is for an array
+ # Returns true if a column definition is for an array, like { array: true }
+ #
+ # @example
+ # add_column :table, :ids, :integer, array: true, default: []
+ #
# rubocop:disable Lint/BooleanSymbol
def array_column?(node)
node.each_descendant(:pair).any? do |pair_node|
- pair_node.child_nodes[0].value == :array && # Searching for a (pair (sym :array) (true)) node
+ pair_node.child_nodes[0].sym_type? && # Searching for a RuboCop::AST::SymbolNode
+ pair_node.child_nodes[0].value == :array && # Searching for a (pair (sym :array) (true)) node
pair_node.child_nodes[1].type == :true # RuboCop::AST::Node uses symbols for types, even when that is a :true
end
end