-
-
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
Naming/ConstantName ignores constants that are frozen #5155
Labels
Comments
dominicsayers
changed the title
Naming/ConstantName ignores mutable constants that are frozen
Naming/ConstantName ignores constants that are frozen
Nov 28, 2017
koic
added a commit
to koic/rubocop
that referenced
this issue
Nov 28, 2017
Fixes rubocop#5155. This PR fixes a false negative for `Naming/ConstantName` cop when using frozen object assignment. It also fixed the offenses that occurred in RuboCop itself.
11 tasks
bbatsov
pushed a commit
that referenced
this issue
Dec 1, 2017
This PR fixes a false negative for `Naming/ConstantName` cop when using frozen object assignment. It also fixed the offenses that occurred in RuboCop itself.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you give a constant a name that is not in
SCREAMING_SNAKE_CASE
the cop Naming/ConstantName raises an offence. If you then.freeze
that constant the offence is not detected.Expected behavior
I expect Rubocop's Naming/ConstantName cop to raise an offence for a mis-named constant whether the constant is frozen or not.
Actual behavior
If the mis-named constant is frozen with
.freeze
the Naming/ConstantName offence is not detected.Steps to reproduce the problem
my_class.rb
as follows:$ rubocop my_class.rb Inspecting 1 file . 1 file inspected, no offenses detected
RuboCop version
Include the output of
rubocop -V
. Here's an example:The text was updated successfully, but these errors were encountered: