-
-
Notifications
You must be signed in to change notification settings - Fork 263
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/NegateInclude is not safe for auto correction #384
Labels
bug
Something isn't working
Comments
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Nov 18, 2020
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Nov 18, 2020
Fixes rubocop#384 This PR marks unsafe for `Rails/NegateInclude` because false positive will occurs for a receiver object that do not have `exclude?` method. (e.g. `IPAddr`)
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Nov 18, 2020
Fixes rubocop#384 This PR marks unsafe for `Rails/NegateInclude` because false positive will occurs for a receiver object that do not have `exclude?` method. (e.g. `IPAddr`)
9 tasks
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Nov 18, 2020
Fixes rubocop#384 This PR marks unsafe for `Rails/NegateInclude` because false positive will occur for a receiver object that do not have `exclude?` method. (e.g. `IPAddr`)
koic
added a commit
that referenced
this issue
Nov 18, 2020
[Fix #384] Mark unsafe for `Rails/NegateInclude`
Thank you! |
@adamcooke You are welcome. Thank you for the feedback! |
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Nov 20, 2020
Fixes rubocop#384 This PR marks unsafe for `Rails/NegateInclude` because false positive will occur for a receiver object that do not have `exclude?` method. (e.g. `IPAddr`)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We cannot assume that everything that implements
include?
also implementsexclude?
. While Rails does add this to some things, it doesn't add them to everything and making this assumption is dangerous.For example,
IPAddr
(in stdlib) has aninclude?
method but does not have anexclude?
.Expected behaviour
Inserting
!something.include?(x)
should not correct tosomething.exclude?(x)
.Actual behavior
It was corrected.
RuboCop version
The text was updated successfully, but these errors were encountered: