diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-14 15:08:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-14 15:08:58 +0300 |
commit | c9ca178ba4c9a3e48d9d069f7d7486a29827cc61 (patch) | |
tree | 07a4f84921b80ff967d30229f0d887c152b9b1d8 /rubocop | |
parent | 6035fcc36ead3b415fa2422b0204a795a70f3e2f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/graphql/gid_expected_type.rb | 21 | ||||
-rw-r--r-- | rubocop/cop/migration/create_table_with_foreign_keys.rb | 2 | ||||
-rw-r--r-- | rubocop/rubocop-migrations.yml | 2 |
3 files changed, 23 insertions, 2 deletions
diff --git a/rubocop/cop/graphql/gid_expected_type.rb b/rubocop/cop/graphql/gid_expected_type.rb new file mode 100644 index 00000000000..354c5516752 --- /dev/null +++ b/rubocop/cop/graphql/gid_expected_type.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Graphql + class GIDExpectedType < RuboCop::Cop::Cop + MSG = 'Add an expected_type parameter to #object_from_id calls if possible.' + + def_node_search :id_from_object?, <<~PATTERN + (send ... :object_from_id (...)) + PATTERN + + def on_send(node) + return unless id_from_object?(node) + + add_offense(node) + end + end + end + end +end diff --git a/rubocop/cop/migration/create_table_with_foreign_keys.rb b/rubocop/cop/migration/create_table_with_foreign_keys.rb index 01cab032049..382a2d6f65b 100644 --- a/rubocop/cop/migration/create_table_with_foreign_keys.rb +++ b/rubocop/cop/migration/create_table_with_foreign_keys.rb @@ -9,7 +9,7 @@ module RuboCop include MigrationHelpers MSG = 'Creating a table with more than one foreign key at once violates our migration style guide. ' \ - 'For more details check the https://docs.gitlab.com/ce/development/migration_style_guide.html#examples' + 'For more details check the https://docs.gitlab.com/ee/development/migration_style_guide.html#examples' def_node_matcher :create_table_with_block?, <<~PATTERN (block diff --git a/rubocop/rubocop-migrations.yml b/rubocop/rubocop-migrations.yml index 454bed71833..f8ff6e005f9 100644 --- a/rubocop/rubocop-migrations.yml +++ b/rubocop/rubocop-migrations.yml @@ -1,4 +1,4 @@ -# Make sure to update the docs if this file moves. Docs URL: https://docs.gitlab.com/ce/development/migration_style_guide.html#when-to-use-the-helper-method +# Make sure to update the docs if this file moves. Docs URL: https://docs.gitlab.com/ee/development/migration_style_guide.html#when-to-use-the-helper-method Migration/UpdateLargeTable: Enabled: true HighTrafficTables: &high_traffic_tables # size in GB (>= 10 GB on GitLab.com as of 02/2020) and/or number of records |