Skip to content
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

Conflicting Lint/UnusedBlockArgument & Style/SingleLineBlockParams #1466

Closed
deivid-rodriguez opened this issue Nov 26, 2014 · 1 comment
Closed

Comments

@deivid-rodriguez
Copy link
Contributor

I have this line of code that counts the number of lines in a file

File.foreach(filename).reduce(0) { |a, e| a + 1 }

but I get complaints from the Lint/UnusedBlockArgument cop.

W: Lint/UnusedBlockArgument: Unused block argument - e. If it's necessary, use _ or _e as an argument name to indicate that it won't be used.

So I change it to

File.foreach(filename).reduce(0) { |a, _e| a + 1 }

but now the Style/SingleLineBlockParams cop complains...

C: Style/SingleLineBlockParams: Name reduce block params |a, e|.

Maybe the block param names should not be enforced if they start with an underscore?

bbatsov added a commit that referenced this issue Nov 28, 2014
[Fix #1466] Allow underscored parameters in SingleLineBlockParams
@deivid-rodriguez
Copy link
Contributor Author

Thanks @jonas054 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant