SonarQube complains about "String contains no format specifiers." when using org.slf4j.Logger
, in particular method "public void debug(String msg)
". For example
log.info("message");
It refers to this rule : https://wiki.sei.cmu.edu/confluence/display/c/FIO47-C.+Use+valid+format+strings
However, in this rule, we can find the following quote :
Each conversion specification is introduced by the % character followed (in order) by
Zero or more flags (in any order), which modify the meaning of the conversion specification
Is it me that miss something, or is this rule not well implemented? Any experience with that ?
This is a known issue introduced with SonarJava 5.1. You can safely consider this issue as a False Positive (FP) and/or ignore it. It has already been fixed while handling JIRA ticket SONARJAVA-2633.
The fix has been delivered with version 5.1.1 of SonarJava analyzer, released on Feb 16, 2018 (requires SonarQube LTS 6.7 or superior).
Update for SonarLint standalone users
For SonarLint users working with standalone versions (not connected to any SonarQube instance), you may still observe the issue depending of the version you are using. If you are using:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With