Class: RuboCop::Cop::GraphQL::MaxDepthSchema
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::GraphQL::MaxDepthSchema
- Defined in:
- lib/rubocop/cop/graphql/max_depth_schema.rb
Overview
Detects missing max_depth configuration in schema files
Constant Summary collapse
- MSG =
"max_depth should be configured for schema."
Instance Method Summary collapse
Instance Method Details
#max_depth(node) ⇒ Object
17 18 19 |
# File 'lib/rubocop/cop/graphql/max_depth_schema.rb', line 17 def_node_matcher :max_depth, "`(send nil? :max_depth ...)\n" |
#on_class(node) ⇒ Object
23 24 25 26 27 |
# File 'lib/rubocop/cop/graphql/max_depth_schema.rb', line 23 def on_class(node) return if ::RuboCop::GraphQL::Class.new(node).nested? || max_depth(node) add_offense(node) end |