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

Naming/RescuedExceptionsVariableName invalid report #6893

Closed
mensfeld opened this issue Apr 6, 2019 · 4 comments · Fixed by #7122
Closed

Naming/RescuedExceptionsVariableName invalid report #6893

mensfeld opened this issue Apr 6, 2019 · 4 comments · Fixed by #7122
Labels

Comments

@mensfeld
Copy link

mensfeld commented Apr 6, 2019

When I run rubocop 0.67.2 with following code:

handled = [StandardError]

begin
  raise StandardError
rescue *handled
  false
end

I get the following error:

test.rb:5:8: C: Naming/RescuedExceptionsVariableName: Use e instead of *handled.
rescue *handled
       ^^^^^^^^

Expected behavior

I should not get this offense.

Actual behavior

I do get the offense.

Steps to reproduce the problem

  • Create a file with the code above
  • Run Rubocop on it

RuboCop version

$ [bundle exec] rubocop -V
0.67.2 (using Parser 2.6.2.1, running on ruby 2.6.2 x86_64-linux)
@bbatsov bbatsov added the bug label Apr 8, 2019
@bbatsov
Copy link
Collaborator

bbatsov commented Apr 8, 2019

Thanks for reporting this. The cop is certainly rough around the edges, but we'll fix it soon.

anthony-robin added a commit to anthony-robin/rubocop that referenced this issue Apr 20, 2019
…ariableName` cop

This PR makes the `Naming/RescuedExceptionsVariableName` cop to play friendly
with exceptions listed using the splat operator or calling a method on a class.

Fix rubocop#6893
Fix rubocop#6907
Fix rubocop#6912
@stale
Copy link

stale bot commented May 8, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

@stale stale bot added the stale Issues that haven't been active in a while label May 8, 2019
@mensfeld
Copy link
Author

mensfeld commented May 9, 2019

It's not stale - it's still present.

@stale stale bot removed the stale Issues that haven't been active in a while label May 9, 2019
@bbatsov
Copy link
Collaborator

bbatsov commented May 9, 2019

Yeah, there's a PR that targets it, but it got stuck a while ago. See #6908

pocke added a commit to pocke/rubocop that referenced this issue Jun 25, 2019
…ExceptionsVariableName

Co-authored-by: Anthony Robin <contact@anthony-robin.fr>
bbatsov pushed a commit that referenced this issue Jun 25, 2019
…onsVariableName (#7122)

Co-authored-by: Anthony Robin <contact@anthony-robin.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants