Issue with Rule S2275

java
sonarqube

(Rama Krishna) #1
  • versions used (SonarQube 6.7.3, java)

Below code is giving Rule S2275 violation

MessageFormat.format("There were {0} classes that aren't loaded", unknownClasses.size());

As per my understanding this rule should ignore if ’ is in middle of a word and looks like it is a false positive to me.


(Pierre-Yves Nicolas) #2

Hi,

Why do you think it’s a false positive?
If I execute the following code:

System.out.println(MessageFormat.format("There were {0} classes that aren't loaded", 42));

I get "There were 42 classes that arent loaded", where the single quote disappeared…

Pierre-Yves