-
-
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
Style/InverseMethods produces behaviourally different code #4643
Comments
I confirmed the incorrect behavior. It is important to note the 3 corrections that occur here:
|
It seems as if an additional check would be required since the situation is not as simple as a .select versus .reject, when combined with regexes, parens, and !. Other code examples out in the wild may behave correctly; I assume that this behaviour change is only possible in regex-styles like the above, right? |
It looks like the issue here has to do with the body of the block being wrapped in a not. |
Expected behavior
Rubocop -a should produce code that has the same behaviour as the previous code.
This is the original code:
This is what a possible result could look like:
Actual behavior
Rubocop -a produces code that has different behaviour than the previous code.
The following code:
Results in this which does not have the same behaviour.
Steps to reproduce the problem
run the following code with this rubocop command:
RuboCop version
The text was updated successfully, but these errors were encountered: