-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
ConstantName should allow CamelCase constants for class aliases #5053
Comments
This sounds like a fun fix. Happy to take a stab at it over the next few days. Looks like there is already a note about this in the codebase - https://github.com/bbatsov/rubocop/blob/master/lib/rubocop/cop/naming/constant_name.rb#L27-L30 |
As that comment suggestions, it looks like the described behavior actually is not flagged by rubocop. I tried to reproduce without success. Adding this spec also passes: # spec/rubocop/cop/naming/constant_name_spec.rb
it 'does not throw offense if rhs is camelCase' do
expect_no_offenses(<<-RUBY.strip_indent)
class FooBaz
end
BarBaz = FooBaz
RUBY
end @marcandre - Can you provide any additional info about the error? |
Indeed, |
Thanks for the fix. On the other hand, this allows |
From a quick test, it looks like those examples work just fine. No offenses on my end. |
Yeah. Maybe it should be an offense though, at least |
The follow code is flagged by RuboCop:
I believe it shouldn't complain about
Bar
being camelcase here. AssumingFoo
is correctly written, thenBar
should actually be CamelCase, andBAR = Foo
should actually be an error.I understand there is rarely a case for such code (but we have nevertheless 14 such cases 😈 )
The text was updated successfully, but these errors were encountered: