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.
Hi everyone,
I just want to add my +1 to
casecmp
issues. My colleague, who is new to Ruby, got an offense for using thedowncase
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 thecasecmp
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.