-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Change default args forStyle/SingleLineBlockParams
#3601
Conversation
I tend to agree with you on this one. But I do feel that a better solution would be to simply make the names configurable (and by default to change them to something like |
And after I said this I saw the cop is already configurable and one can change the defaults. |
@bbatsov Thanks for taking a look. The reason I think this cop should not be enabled by default is that I find it unexpected for a style library to dictate variable names . Adding naming guidelines is more common, but actually saying "this variable should be If you think we should continue to make this cop enabled by default, what do you think about changing the default args from |
I'm fine with changing the defaults, but given the line length constraint I'd say "acc" and "elem" might be better names - still understandable and not that long. Btw, there's a reason why RuboCop doesn't implement this particular check - it's really hard to figure out of something is a bad name - if you're dealing with points |
Ok @bbatsov thanks for the feedback -- updated per your suggestion. I think it would be better not to have requirements for variable names at all, but I think this is a good incremental improvement. |
The building is failing, because now there are offenses in RuboCop's own code. |
@bbatsov thanks for letting me know! fixed |
Style/SingleLineBlockParams
by defaultStyle/SingleLineBlockParams
**Why**: * This cop enforces block args of `a` and `e` by default * This suggestion causes an "Uncommunicative Variable Name" error from Reek * Source: https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md * I tend to agree with Reek on this one. I like expressive variables. * New default arg names: `acc` and `elem` per #3601 (comment)
Why:
a
ande
by defaultReek
acc
andelem
per bbatsov#3601 (comment)