diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-14 15:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-14 15:09:34 +0300 |
commit | 9a5dcad39c5dd81384ae4ec2398435883b944363 (patch) | |
tree | 3c684d30e4500028299d7948171e885b844a1ade /rubocop | |
parent | 0923a94d58cdd15cdb6379330e5eb41d30ccb8cc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/migration/create_table_with_foreign_keys.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rubocop/cop/migration/create_table_with_foreign_keys.rb b/rubocop/cop/migration/create_table_with_foreign_keys.rb index 37096a9352f..01cab032049 100644 --- a/rubocop/cop/migration/create_table_with_foreign_keys.rb +++ b/rubocop/cop/migration/create_table_with_foreign_keys.rb @@ -35,7 +35,7 @@ module RuboCop ) PATTERN - def_node_search :argument_name, <<~PATTERN + def_node_matcher :argument_name?, <<~PATTERN {(sym $...) (str $...)} PATTERN @@ -87,7 +87,11 @@ module RuboCop end def arguments_to_table_names(arguments) - arguments.flat_map { |argument| argument_name(argument).to_a.flatten.first.to_s.pluralize.to_sym } + arguments.select { |argument| argument_name?(argument) } + .map(&:value) + .map(&:to_s) + .map(&:pluralize) + .map(&:to_sym) end end end |