Add a rule to enforce resolver type annotations
What does this MR do?
This MR adds a new Rubocop rule: Graphql/ResolverType
.
This rule enforces that every resolver declares its type explicitly using a top level DSL method.
The reasons for this are:
- Executable documentation: developers can see what a resolver returns
- SSOT for field metadata. We currently are being wasteful in this regard, since fields that have resolver classes can inherit the resolver's field options. There is never a reason for a field to override the type, so we should encourage fields with resolvers to delegate to the resolver for all metadata. For this to work, the resolvers will need to have this metadata defined in all cases, so this cop is the first step.
- Enable better testing of resolvers. To test resolvers properly we need to generate fields for them. To do this we need a type definition.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Merge request reports
Activity
- Resolved by Luke Duncalfe
assigned to @mwoolf
added backend label
Reviewer roulette
Changes that require review have been detected! A merge request is normally reviewed by both a reviewer and a maintainer in its primary category (e.g. frontend or backend), and by a maintainer in all other categories.
To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited, or the chosen person is unavailable.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, mention them as you normally would! Danger does not automatically notify them for you.
Category Reviewer Maintainer backend John Hope ( @johnhope
) (UTC+0, same timezone as@alexkalderimis
)Luke Duncalfe ( @.luke
) (UTC+13, 13 hours ahead of@alexkalderimis
)If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerEdited by 🤖 GitLab Bot 🤖added 1 commit
- 025abf41 - Add a rule to enforce resolver type annotations
mentioned in merge request !40088 (merged)
mentioned in issue gitlab-com/www-gitlab-com#8135 (closed)
added 60 commits
-
025abf41...8c644ff8 - 57 commits from branch
master
- 646b2e38 - Add a rule to enforce resolver type annotations
- 80fd90f1 - wip
- 31359c2a - Add manual exclusions
Toggle commit list-
025abf41...8c644ff8 - 57 commits from branch
marked this merge request as draft from 80fd90f1
added 49 commits
-
f568e72a...d545a0cd - 48 commits from branch
master
- f44aa6eb - Add a rule to enforce resolver type annotations
-
f568e72a...d545a0cd - 48 commits from branch
- Resolved by Alex Kalderimis
- Resolved by Alex Kalderimis
- Resolved by Alex Kalderimis
- Resolved by Alex Kalderimis
- Resolved by Alex Kalderimis
- Resolved by Alex Kalderimis
- Resolved by Alex Kalderimis
added tooling (archive) label
added groupecosystem [DEPRECATED] label
@alexkalderimis Thank you for this!
Some suggestions for you to chew over!
unassigned @.luke
assigned to @.luke and unassigned @alexkalderimis
- Resolved by Luke Duncalfe
Setting label(s) devopscreate sectiondev based on ~"group::ecosystem".
added devopscreate sectiondev labels
changed milestone to %13.6
enabled an automatic merge when the pipeline for b77bc1d8 succeeds
Thanks, @alexkalderimis! Looks great!
This will merge when the pipeline succeeds
(I applied !47375 (comment 445940477) and set to squash commits).mentioned in commit df48e12c
mentioned in issue #281697 (closed)
added workflowstaging label
added workflowcanary label and removed workflowstaging label
added workflowproduction label and removed workflowcanary label
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label
added 1 deleted label and removed devopscreate label
added typemaintenance label and removed tooling (archive) label
added devopsmanage label and removed 1 deleted label
- Resolved by 🤖 GitLab Bot 🤖
Changes detected for the following files that might break JiHu:
-
.rubocop.yml
(NewRuboCop)
This message was generated automatically. You're welcome to improve it.
-
mentioned in merge request !147148 (merged)