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/AutoResourceCleanup shouldn't flag File.open(…).close. #4444

Closed
reitermarkus opened this issue May 29, 2017 · 0 comments
Closed

Style/AutoResourceCleanup shouldn't flag File.open(…).close. #4444

reitermarkus opened this issue May 29, 2017 · 0 comments

Comments

@reitermarkus
Copy link
Contributor

The Style/AutoResourceCleanup cop should not flag the following (touch + chmod):

File.open('file', 'w', 0o777).close

Expected behavior

Given a file with the content above, rubocop --only Style/AutoResourceCleanup should output:

Inspecting 1 file
.

1 file inspected, no offenses detected

Actual behavior

Given a file with the content above, rubocop --only Style/AutoResourceCleanup outputs:

Inspecting 1 file
C

Offenses:

open.rb:1:1: C: Use the block version of File.open.
File.open(file, 'w', 0o100777).close
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected

RuboCop version

$ rubocop -V
0.49.1 (using Parser 2.4.0.0, running on ruby 2.0.0 universal.x86_64-darwin16)
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