DmitryTsepelev / rubocop-graphql

Rubocop extension for enforcing graphql-ruby best practices
MIT License
226 stars 50 forks source link

Default config: Support different directory structures #137

Open franzliedke opened 1 year ago

franzliedke commented 1 year ago

Hi and thanks for the excellent package! 👏🏼

We are currently working on breaking down our Rails monolith with some tools from the packs ecosystem. This led us to moving all our GraphQL code to a folder packages/web_graphql.

This clashes with the default Include and Exclude rules in this package, which often hardcode a graphql directory. Example:

https://github.com/DmitryTsepelev/rubocop-graphql/blob/ca4506b159453fd4aea6aae7fd7324ba094afd93/config/default.yml#L3-L4

If this was the only rule, then I wouldn't worry about it so much, and we did override it in our Rubocop config for now. But since there are several other, more specific rules also using similar constructs, I'm worried about quietly and unintentionally skipping a lot of valuable cops.

Would you be open to changing this to *graphql* to make it work with any directory containing the term "graphql"?

DmitryTsepelev commented 1 year ago

Hey @franzliedke, thanks for the warm words 🙂

*graphql* sounds reasonable, but I wonder if we could make it configurable in a single place (cause someone might want something else like gql). For instance, rules will have Include: "**/<gql_folder>/**/*", while somewhere else we'd have something like gql_folder: graphql or gql_folder: web_graphql. Not sure if it's possible though 🤔