diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-05 06:09:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-05 06:09:10 +0300 |
commit | 335dc0be1feec6e3f37be353a630576119c75e75 (patch) | |
tree | 507a9d6a3b01e695a4caacaf1cf1a3bf5df301dc /rubocop/code_reuse_helpers.rb | |
parent | c9cfe41bb2b933b83324cfc975a24c548fbdb63b (diff) |
Add latest changes from gitlab-org/gitlab@master
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 |