sketch-hq / nicene

Additional Credo checks
MIT License
39 stars 7 forks source link

Add check for documenting GraphQL schemas #5

Closed devonestes closed 4 years ago

devonestes commented 4 years ago

This is a first take a a check to require documentation for graphql schemas. Right now it assumes that the following functions are only used for defining parts of a GraphQL schema:

[:field, :scalar, :arg, :object, :input_object, :directive, :interface,
:union, :enum, :value]

If we end up with functions that have the same names then we can ingore just the calls to those specific functions, or we can make this check a bit more robust, but it would be good to get the context for the real-world failure before making those changes.

This one is the first that has some abstraction around patterns that we're matching on in ASTs, which does make things a bit more convoluted, but also saves us a boatload of repetition, so I decided to go that route at the expense of making the code a bit harder to comprehend.

devonestes commented 4 years ago

@mz2 I've updated the message to make it clear that we want description, and also bumped the version to 0.2.0, so once this is merged I'll push up a new release to Hex with this check and the Ecto schema check.