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

Style/SymbolProc and Style/AutoResourceCleanup do not place nicely together #2248

Closed
amilligan opened this issue Sep 15, 2015 · 0 comments
Closed

Comments

@amilligan
Copy link

Specifically, when using File.open. With this code:

File.open(path) { |f| f.read }

the Style/SymbolProc cop fails thusly:

C: Style/SymbolProc: Pass &:read as an argument to open instead of a block.
    File.open(path) { |f| f.read }
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

However with the suggested code:

File.open(path, &:read)

the Style/AutoResourceCleanup cop fails:

C: Style/AutoResourceCleanup: Use the block version of File.open.
    File.open(path, &:read)
    ^^^^^^^^^^^^^^^^^^^^^^^

I believe this is due to the change to Style/SymbolProc after which that cop now applies to methods that take parameters.

bbatsov added a commit that referenced this issue Sep 16, 2015
…_pass

[Fix #2248] Allow AutoResourceCleanup block-pass
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