diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-24 15:07:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-24 15:07:34 +0000 |
commit | df9890e9a702e2f12bbc8f022b916ca72820a292 (patch) | |
tree | 26ff255cfb6843fe963fcafea9ee70121ee5e913 /rubocop | |
parent | 17c1c66eefd05243dd8ed2c8fd49d17ab1a52522 (diff) | |
download | gitlab-ce-df9890e9a702e2f12bbc8f022b916ca72820a292.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/migration_helpers.rb | 9 |
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 |