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
removing duplicate code in railties/lib/rails/generators/resource_helper... #13771
Conversation
lgtm. |
Thanks for your contribution! However, this is a cosmetic change, and as noted in the the contributing to rails guide, we have a policy of not accepting these kind of changes. I know this might be thinking, "sure, it might not be adding much value, but I already wrote the code, so the cost is already paid – by me – so why not just merge it"? The reason is that there are a lot of hidden cost in addition to writing the code itself.
Theses are just some examples of the hidden costs that are not so apparent from the surface. It's awesome that you want to contribute to Rails, please keep the PRs coming! All we ask is that you refrain from sending these types of changes in the future (and read the contribution guide :). I hope you'll understand! P.S. I'm not picking on you – it's just that we seem to be getting more PRs in the cosmetic changes category, and so I wanted to take this chance to explain our position and have something I can link to in the future. ❤️ 💚 💙 💛 💜 |
@chancancode I understand your point, but i am surprised to see that Rails community do not promote improving code quality. I am using code climate for past few months , and am confident that my commit will surely decrease method complexity, do not mind if you still think its a cosmetic change. |
Looks like it is not a cosmetic change neither duplicated code. Tests are broken with this change. |
@@ -16,12 +16,10 @@ def self.included(base) #:nodoc: | |||
def initialize(*args) #:nodoc: | |||
super | |||
if options[:model_name] | |||
controller_name = name | |||
self.name = options[:model_name] |
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.
Name gets changed here, so we cannot move controller_name
assignment below this line.
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.
Interesting. It appears that what looked like a cosmetic change caused unexpected downstream issues...
|
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.
ㅤ
...s.rb