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/GlobalStdStream cop is unsafe #8688

Closed
tsugimoto opened this issue Sep 10, 2020 · 1 comment
Closed

Style/GlobalStdStream cop is unsafe #8688

tsugimoto opened this issue Sep 10, 2020 · 1 comment

Comments

@tsugimoto
Copy link
Contributor

because $stdout and STDOUT may point different object.

$stdout = STDERR
STDOUT.puts($stdout == STDOUT) # false

Expected behavior

Auto-corrects with --auto-correct-all, but not --auto-correct.

Actual behavior

Auto-corrects with --auto-correct.

Example source code now prints true instead of false.

Steps to reproduce the problem

rubocop --auto-correct --only Style/GlobalStdStream

RuboCop version

$ bundle exec rubocop -V
0.90.0 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.6.3 x86_64-darwin18)
@marcandre
Copy link
Contributor

Absolutely! Thanks :-)
Fixed in #8691.

marcandre added a commit to marcandre/rubocop that referenced this issue Sep 10, 2020
@mergify mergify bot closed this as completed in a60c3d2 Sep 10, 2020
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

2 participants