Closed patch0 closed 1 year ago
Hey hey, makes a lot of sense, thank you! Could you please at these rubocop offences and I'll merge it?
Hey hey, makes a lot of sense, thank you! Could you please at these rubocop offences and I'll merge it?
Thanks! All done :)
Closes #142
If I add Types::BaseUserType to SafeBaseClasses I'd expect all of following to pass the cop:
The only one that currently passes the cop is case 2.
These are all valid ruby, but could lead to confusion/frustration when trying to sort out GraphQL authorization. I'd propose checking a list of possible parent classes in this instance.
In case 1 we can just check
Types::BaseUserType
is ourSafeBaseClasses
list.In case 2 we need to check if either
Types::BaseUserType
orTypes::Types::BaseUserType
is in our list.Finally in case 3 we need to check if either
BaseUserType
orTypes::BaseUserType
is in our list.I don't think we can see from the AST which other classes have been defined in the code, so checking for the two possible permutations is required for this cop to be robust.