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 does not handle variables with underscore #6903

Closed
anthony-robin opened this issue Apr 8, 2019 · 0 comments
Labels

Comments

@anthony-robin
Copy link
Contributor

After upgrading to Rubocop v0.67.2, if we use a variable name with a leading _, the offense message ask to rename it without the underscore which flag a new Lint/UselessAssignment offense.


Expected behavior

The cop should deal with underscored variable name and ask to rename it keeping the _.

Actual behavior

Rubocop ask me to rename my variable e whereas it should be _e.

Steps to reproduce the problem

class MyController < ApplicationController
  def create
    # some code here
  rescue MyException => _exception
    render_my_exception
  end
end

RuboCop version

$ [bundle exec] rubocop -V
0.67.2 (using Parser 2.6.2.1, running on ruby 2.6.1 x86_64-darwin18)
@bbatsov bbatsov added the bug label Apr 8, 2019
anthony-robin added a commit to anthony-robin/rubocop that referenced this issue Apr 10, 2019
…tionsVariableName` cop

Currently, this cop do not play nicely with variables that are prefixed by an `_`.

The message should take into consideration if the variable is going to be
used or not when showing the error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants