Class: RuboCop::Cop::Gusto::Graphql::PaginateArrays
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Gusto::Graphql::PaginateArrays
- Defined in:
- lib/rubocop/cop/gusto/graphql/paginate_arrays.rb
Constant Summary collapse
- MSG =
"Field returns an unbounded array of `%{field_type}`. Paginate it, or declare it " \ "a deliberately bounded list."
- RESTRICT_ON_SEND =
i(field).freeze
- ARRAY_FIELD =
RuboCop::AST::NodePattern.new("(send nil? :field (sym ...) $(array $...) ...)\n")
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
16 17 18 19 20 |
# File 'lib/rubocop/cop/gusto/graphql/paginate_arrays.rb', line 16 def on_send(node) ARRAY_FIELD.match(node) do |unbounded_list, field| add_offense(unbounded_list, message: format(MSG, field_type: field.first&.const_name)) end end |