Affects Sonarqube Version:
Sonarqube version: 8.1.0.31237
sonar-scanner version: 4.2.0.1873-windows
Rule:
S3027: String function use should be optimized for single characters
Description:
Unable to detect single unicode character like “\u001B”.
This rule is implemented in java-checks-6.2.0.21135-sources.jar!\org\sonar\java\checks\StringMethodsOnSingleCharCheck.java
This rule uses return argValue.length() == 2 && argValue.charAt(0) == ‘\’;
to determine whether the string is a single character,
and does not apply to the case of single unicode characters.
Code Sample demonstrating the issue:
int aIndex = addString.indexOf("\u001B");
Expected outcome:
false-negative
Running Sonarqube through:
command line