-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
Rails/ReflectionClassName complains on variables #1179
Comments
exterm
added a commit
to exterm/rubocop-rails
that referenced
this issue
Nov 10, 2023
…flectionClassName
exterm
added a commit
to exterm/rubocop-rails
that referenced
this issue
Nov 10, 2023
…flectionClassName
9 tasks
exterm
added a commit
to exterm/rubocop-rails
that referenced
this issue
Nov 10, 2023
…flectionClassName
exterm
added a commit
to exterm/rubocop-rails
that referenced
this issue
Nov 14, 2023
…flectionClassName
exterm
added a commit
to exterm/rubocop-rails
that referenced
this issue
Nov 14, 2023
…flectionClassName
exterm
added a commit
to exterm/rubocop-rails
that referenced
this issue
Dec 1, 2023
…flectionClassName
Method calls are unsafe too, since they could reference an unloaded constant: def account_class
Account
end
has_many :accounts, class_name: account_class |
Yeah, this cop will never be able to catch all cases. That's OK. I'm just looking to reduce the number of false positives. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior
These are the examples from the docs:
I would also expect
Because the purpose of the cop, if I understand correctly, is to prevent constant references and the autoload they cause, so the cop should only reject constant references.
Actual behavior
The cop rejects everything that is not a string literal.
Steps to reproduce the problem
See above.
RuboCop version
I checked changelog and code and this doesn't seem to be fixed in
2.22.1
, which is the most current version as I'm writing this.The text was updated successfully, but these errors were encountered: