Skip to content
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

Autocorrect bug in performance/redundant_match #3351

Closed
annaswims opened this issue Jul 28, 2016 · 1 comment
Closed

Autocorrect bug in performance/redundant_match #3351

annaswims opened this issue Jul 28, 2016 · 1 comment

Comments

@annaswims
Copy link

The match method takes an argument of either a regex or a string. However, when we run auto correct,
do_something if "foo.txt".match(".txt")
gets autocorrected to
do_something if "foo.txt" =~ ".txt", which results in TypeError: type mismatch: String given


Expected behavior

match() should only be autocorrected to =~ if the argument is a regex.

Actual behavior

When running autocorrect do_something if "foo.txt".match(".txt") gets autocorrected to do_something if "foo.txt" =~ ".txt".

RuboCop version

0.40.0

@annaswims
Copy link
Author

I've got a PR in the works.

bbatsov pushed a commit that referenced this issue Jul 29, 2016
#3352)

The match method takes an argument of either a regex or a string. However, when we run auto correct,
do_something if "foo.txt".match(".txt")  gets autocorrected to
do_something if "foo.txt" =~ ".txt", which results in TypeError: type mismatch: String given
Neodelf pushed a commit to Neodelf/rubocop that referenced this issue Oct 15, 2016
…ch` cop. (rubocop#3352)

The match method takes an argument of either a regex or a string. However, when we run auto correct,
do_something if "foo.txt".match(".txt")  gets autocorrected to
do_something if "foo.txt" =~ ".txt", which results in TypeError: type mismatch: String given
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant