summaryrefslogtreecommitdiff
path: root/rubocop
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-02 15:09:08 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-02 15:09:08 +0000
commit840d5ecdbbf8da3e03a7f0b8b465a89d1519807c (patch)
tree4e197815c026a947057f7b5cbcb5e3cf106cc22f /rubocop
parentb0107e8756bf3287f8a6221252c800209a9c46f6 (diff)
downloadgitlab-ce-840d5ecdbbf8da3e03a7f0b8b465a89d1519807c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r--rubocop/cop/graphql/authorize_types.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/rubocop/cop/graphql/authorize_types.rb b/rubocop/cop/graphql/authorize_types.rb
index c6dbe447b4a..1dba719cdff 100644
--- a/rubocop/cop/graphql/authorize_types.rb
+++ b/rubocop/cop/graphql/authorize_types.rb
@@ -8,29 +8,29 @@ module RuboCop
'https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#type-authorization'
# We want to exclude our own basetypes and scalars
- WHITELISTED_TYPES = %w[BaseEnum BaseScalar BasePermissionType MutationType
- QueryType GraphQL::Schema BaseUnion].freeze
+ ALLOWED_TYPES = %w[BaseEnum BaseScalar BasePermissionType MutationType
+ QueryType GraphQL::Schema BaseUnion].freeze
def_node_search :authorize?, <<~PATTERN
(send nil? :authorize ...)
PATTERN
def on_class(node)
- return if whitelisted?(class_constant(node))
- return if whitelisted?(superclass_constant(node))
+ return if allowed?(class_constant(node))
+ return if allowed?(superclass_constant(node))
add_offense(node, location: :expression) unless authorize?(node)
end
private
- def whitelisted?(class_node)
+ def allowed?(class_node)
class_const = class_node&.const_name
return false unless class_const
return true if class_const.end_with?('Enum')
- WHITELISTED_TYPES.any? { |whitelisted| class_node.const_name.include?(whitelisted) }
+ ALLOWED_TYPES.any? { |allowed| class_node.const_name.include?(allowed) }
end
def class_constant(node)