-
Notifications
You must be signed in to change notification settings - Fork 25
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
[#494] Create (or use) a Rubocop for the inverse keyword needed in the associations #495
[#494] Create (or use) a Rubocop for the inverse keyword needed in the associations #495
Conversation
194a4e0
to
4ee9b70
Compare
4ee9b70
to
f9dc30a
Compare
bd14c0e
to
a384ec3
Compare
@malparty Now think about it, I think we better off splitting the custom cops into a separate repo 🤔 . It's likely that we gonna have more custom cops coming in the future and also makes it easier for current project to adopt the new cops. What do you think? |
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.
Thanks for the clear insights about the arbitrations made. That seems fair enough to me 💡
Approved ahead with a question/suggestion 👍
.rubocop.yml
Outdated
@@ -2,6 +2,7 @@ require: | |||
- rubocop-rails | |||
- rubocop-rspec | |||
- rubocop-performance | |||
- ./custom_cops/required_inverse_of_relations.rb |
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.
I'm not sure if that works, but can we try to rename the folder: ./rubocop/cops/
. At first glance, custom_cops
might be hard to recognize for people new in the world of Rails 🛤️
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.
Agree. Fixed in fba261b
3457045
to
fba261b
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.
What a delightful change!! 🎉
What happened 👀
Implement custom cop to enforce explicit
inverse_of
when specifying Rails associationCompass rule
Insight 📝
There are severals trade-offs that I made to reduce the complexity of the cop:
Note
I encounter a weird bug that prevents me from copying the custom cops to
lib/
folder. That's why I have to keep it in the root folder. For more information, see thisProof Of Work 📹
Screen-Recording-2024-01-03-at-11.59.47.mp4