Improve checking Graphql/Descriptions cop for runtime values
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Rubocop can't detect dynamic offenses when a description is generated like
The discussion was started: #239356 (comment 2384805204)
Improvements
We introduced guidelines on how to write descriptions in GraphQL and introduced a Graphql/Descriptions cop to notify about offenses.
The robocop rules worked perfectly in static cases like fields.
This is not enough to catch offenses related to runtime values automatically; they can be caught only by reviewers, which decreases the productivity of developing the GraphQL layer.
Risks
The extra check might slow down existing CI checks
Involved components
-
Documentation related to GraphQL
bundle exec rake gitlab:graphql:compile_docs
- Guidelines
Proposed solutions:
1st Solution. Introduce a spec that will check descriptions against fresh schema dump
2nd Solution. Allow writing this, without ., starting with A or The for enum value description
- Extend
Graphql/Descriptionsto forbid using variables in field descriptions, argument descriptions
UPD:
3rd Solution. Create a helper that will append . to the end of the description and extend cop to force using this method. Other rules will be skipped for enums see: #322827