-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ExtractType cop #7
Implement ExtractType cop #7
Conversation
8d27ac0
to
c40736c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @0legovich, thanks for the contribution, great job! I've added some comments and ideas and please add yourself to the Changelog (right after the ## master
line)
c40736c
to
aea232d
Compare
@DmitryTsepelev Hi. Thank you for your quick feedback. |
aea232d
to
4b6e4d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I tried to run the cop in the real–world project and realized that my initial requirements were not full. In some cases we don't need to extract the type, for instance, some teams name Boolean fields starting with is_
, and of course when there are more then two fields gem suggests to extract the new type Is
.
Solution should be simple: we can add one more config option called Prefixes
and skip the check for listed prefixes (example from rubocop-rspec). I guess defaults could be is
, avg
, min
, max
.
However, the initial task is definitely completed, please let me know if you want to face this last challenge, or we can call it a day and handle it later 🙂
I think I will add the Prefixes parameter and its processing within the current PR, as a separate commit. |
@DmitryTsepelev I also thought about composite prefixes.
Here the composite prefix is |
4b6e4d7
to
d71e1c0
Compare
Yeah, it would be really helpful to handle such cases too, good catch |
@DmitryTsepelev Now we are able to recognize composite prefixes. What do you think about this implementation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I'm going to merge it right now and make some minor tweaks in the master branch, thank you for the hard work!
@DmitryTsepelev Added cop GraphQL/ExtractType.
Closes #5