-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Obsolete StringAsInstanceDoubleConstant
in favor of VerifiedDoubleReference
for constants only
#1968
base: master
Are you sure you want to change the base?
Conversation
@pirj @bquorning Does this look like the right approach to you as outlined in the comments here? @lucthev also tagging you as a courtesy since you identified the duplication here. |
94194a7
to
d1e49c8
Compare
0f2b7c7
to
2b505ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this cop has been released once, it might be better not to delete or rename it until the next major version update, but to encourage migration with warning and changelogs, soft deprecation, and proceed with deletion and renaming in the next major version update.
StringAsInstanceDoubleConstant
in favor of VerifiedDoubleReference
for constants only
0df39b9
to
13edfcc
Compare
I rebased and prepped this so it can be ready for the Monthly release |
The code looks good, but I am not sure if removing |
I’d check if we can avoid errors by using the obsoletion config. |
So what happens if you add the following to .rubocop.yml?
and run rubocop? |
# This cop can be configured in your configuration using the | ||
# `EnforcedStyle` option and supports `--auto-gen-config`. | ||
# @safety | ||
# This cop is unsafe because the correction requires loading the class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I tried that and first got this error:
I removed the obsolete configuration and ran rubocop again, this time getting a successful output, but got a warning:
|
If we used the changed_parameters, this would also result in an error, not a warning, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM without the renamed
in obsoletion conf.
If changed_parameters results in a warning, please add it.
Thank you!
Both changed_enforced_styles:
- cops: RSpec/VerifiedDoubleReference
parameters: EnforcedStyle
value: string
reason: String references are not verifying unless the class is loaded.
severity: warning Of course, users will now get two warnings instead of one:
|
I think the correct thing to do is to add a @corsonknowles Do you want to add this last change? |
…erence for constants only
13edfcc
to
9f182e6
Compare
Thanks @bquorning -- what about the |
Ah, that is true. Perhaps the |
This PR obsoletes our newly introduced
StringAsInstanceDoubleConstant
in favor ofVerifiedDoubleReference
.This changes
VerifiedDoubleReference
to no longer support string style, as string references are not verifying when the class has not yet been loaded.From the
RSpec
docs:This PR essentially reverts nearly all of
This uses the Obsoletion feature to point leading edge branch users to a revised
VerifiedDoubleReference
instead.Before submitting the PR make sure the following are checked:
master
(if not - rebase it).CHANGELOG.md
if the new code introduces user-observable changes.bundle exec rake
) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).If you have created a new cop:
config/default.yml
.Enabled: pending
inconfig/default.yml
.Enabled: true
in.rubocop.yml
.VersionAdded: "<<next>>"
indefault/config.yml
.If you have modified an existing cop's configuration options:
VersionChanged: "<<next>>"
inconfig/default.yml
.