We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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/ClassEqualityComparison
Class.name
Input:
foo.class.name == Bar.name
Output:
app/untitled.rb:1:5: C: [Correctable] Style/ClassEqualityComparison: Use instance_of?(Bar.name) instead of comparing classes. foo.class.name == Bar.name ^^^^^^^^^^^^^^^^^^^^^^
Autocorrect gives this:
foo.instance_of?(Bar.name)
Which is invalid, and causes instance_of? to throw a TypeError. It should autocorrect to
instance_of?
TypeError
foo.instance_of?(Bar)
1.10.0 (using Parser 3.0.0.0, rubocop-ast 1.4.1, running on ruby 2.7.3 x86_64-darwin19) - rubocop-minitest 0.10.3 - rubocop-rails 2.9.1
The text was updated successfully, but these errors were encountered:
This issue is a dup with #8875 and resolved by #8876. Please update to the latest RuboCop (1.13.0). Thank you.
Sorry, something went wrong.
No branches or pull requests
Input:
Output:
Autocorrect gives this:
Which is invalid, and causes
instance_of?
to throw aTypeError
. It should autocorrect toRuboCop version
The text was updated successfully, but these errors were encountered: