-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Rake/MethodDefinitionInTask is 66.6% incorrect #42
Comments
pboling
changed the title
Rake/MethodDefinitionInTask is 100% incorrect and bad
Rake/MethodDefinitionInTask is 66.6% incorrect
Nov 17, 2021
|
I don't think a new cop is needed, the current cop, |
oh, you are right, sorry. Indeed a method defined inside |
pboling
added a commit
to rubocop-lts/standard-rubocop-lts
that referenced
this issue
Nov 9, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The good code is bad, and the bad code is good.
Methods should be defined inside tasks (only)
(but not namespaces), as it is the only way they will not be globally scoped, and thereby silently conflict with all other same-named globally scoped methods.
Obviously it is also fine to define methods in classes or modules... that's outside the scope of this issue.
"Good Code" example for
task
:"Bad Code" example for
namespace
:"Bad Code" example for
top-level
:reference: https://www.albertoalmagro.com/en/ruby-methods-defined-in-rake-tasks/
The text was updated successfully, but these errors were encountered: