diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /rubocop/code_reuse_helpers.rb | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'rubocop/code_reuse_helpers.rb')
-rw-r--r-- | rubocop/code_reuse_helpers.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/rubocop/code_reuse_helpers.rb b/rubocop/code_reuse_helpers.rb index 45cfa7ba78d..2769da2389c 100644 --- a/rubocop/code_reuse_helpers.rb +++ b/rubocop/code_reuse_helpers.rb @@ -76,10 +76,15 @@ module RuboCop in_app_directory?(node, 'controllers') end + # Returns true if the given node resides in app/graphql or ee/app/graphql. + def in_graphql?(node) + in_app_directory?(node, 'graphql') + end + # Returns true if the given node resides in app/graphql/types, # ee/app/graphql/types, or ee/app/graphql/ee/types. def in_graphql_types?(node) - in_app_directory?(node, 'graphql/types') || in_app_directory?(node, 'graphql/ee/types') + in_graphql_directory?(node, 'types') end # Returns true if the given node resides in lib/api or ee/lib/api. @@ -113,6 +118,13 @@ module RuboCop ) end + # Returns true if the given node resides in app/graphql/{directory}, + # ee/app/graphql/{directory}, or ee/app/graphql/ee/{directory}. + def in_graphql_directory?(node, directory) + in_app_directory?(node, "graphql/#{directory}") || + in_app_directory?(node, "graphql/ee/#{directory}") + end + # Returns the receiver name of a send node. # # For the AST node `(send (const nil? :Foo) ...)` this would return |