-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix a false positive for Lint/RedundantRequireStatement
#11931
Fix a false positive for Lint/RedundantRequireStatement
#11931
Conversation
Follow up rubocop#11099 (comment) This PR fixes a false positive for `Lint/RedundantRequireStatement` when using `PP.pp`.
@koic Tried your branch on my project, works when Is this intended behaviour ? I prefer to keep all Edit: Real world examples if that's helpful: |
I'm leaning towards just ignoring the additional problem, as it's outside of RuboCop's scope. I'm wondering if we should just ignore the special handing for |
@bbatsov It's no bother for me to add a |
For now, the implementation of this PR appears simple and seems capable of preventing false positives for
Yes, I can certainly enhance the documentation. However, I'm wondering if it would be better to set |
Not a bad idea. |
I'll merge this in its current state, as I'm about the cut a release. The rest of the stuff we discussed can happen later. |
Follow up rubocop#11931 (comment). This PR marks `Lint/RedundantRequireStatement` as unsafe autocorrect because if `require 'pp'` is removed from one file, `NameError` can be encountered when another file uses `PP.pp`.
Follow up #11099 (comment)
This PR fixes a false positive for
Lint/RedundantRequireStatement
when usingPP.pp
.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.