Class: RuboCop::Cop::GraphQL::UnusedArgument
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::GraphQL::UnusedArgument
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/graphql/unused_argument.rb
Overview
Arguments should either be listed explicitly or **rest should be in the resolve signature (and similar methods, such as #authorized?).
Constant Summary collapse
- MSG =
"Argument%<ending>s `%<unresolved_args>s` should be listed in the %<name>s signature."
Instance Method Summary collapse
Instance Method Details
#on_class(node) ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rubocop/cop/graphql/unused_argument.rb', line 71 def on_class(node) resolve_method_node = find_resolve_method_node(node) return if resolve_method_node.nil? || ignore_arguments_type?(resolve_method_node) declared_arg_nodes = find_declared_arg_nodes(node) return unless declared_arg_nodes.any? unresolved_args = find_unresolved_args(resolve_method_node, declared_arg_nodes) register_offense(resolve_method_node, unresolved_args) if unresolved_args.any? end |