Enforce use of resolving with a method and not the field resolve: keyword argument

About

Where our GraphQL fields have some custom resolving logic, we currently use one of two methods to do this.

1) the resolve: keyword argument:

field :foo, resolve: -> (obj, args, ctx) { ... }

2) or a method:

field :foo

def foo
  # ...
end

Proposal

We enforce the use of the method. This is because:

  1. It would be nice to have consistency
  2. The resolve: proc often ignores most of the arguments passed to it (we generally receive them as (obj, _args, _ctx))

We should:

  1. Convert all resolve: keyword arguments to methods
  2. Document this
  3. Add a cop to enforce this
Edited by 🤖 GitLab Bot 🤖