Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Suggest: Disable String#casecmp cop for non-ASCII strings #441

Closed
MaratKarimov21 opened this issue Feb 8, 2024 · 1 comment
Closed

Suggest: Disable String#casecmp cop for non-ASCII strings #441

MaratKarimov21 opened this issue Feb 8, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@MaratKarimov21
Copy link

Hi everyone,

I just want to add my +1 to casecmp issues. My colleague, who is new to Ruby, got an offense for using the downcase method for comparison. He followed the instructions and fixed it as shown in the example, but the problem was that he was comparing against a non-ASCII string, which is why the code was not working properly. He didn't know the nuances of the casecmp method and said he spent an hour looking for the problem😅

I saw an open PR where this cop was proposed to be disabled, but it was decided to declare it unsafe.

My suggestion is to disable the check if the comparison involves a string containing non-ASCII characters, in order to avoid pushing people to misuse the casecmp method.

What do you think about this idea? I would be happy to participate and create a PR if you are OK with it.

@koic koic added the duplicate This issue or pull request already exists label Feb 15, 2024
@koic
Copy link
Member

koic commented Feb 15, 2024

This is a dup with #240 and it will be fixed in #443. Thank you for the feedback.

@koic koic closed this as completed Feb 15, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants