How to get rid of thousands of False positives for java 21: Remove the non-escaped char from literal

yes, running with java 21.

hers the output:

out.txt (36.0 KB)

Hi,

Thanks for the log. Nothing is jumping out at me here. (I had hoped it might include the encoding, but no such luck.)

I’m going to flag this for the language experts.

 
Ann

\u0009 should be a tab character (\t). To me it looks like there might be some weird formatted tab in your source code. Can you please try to delete those few lines and retype them manually without copy-pasting them?

Hello John,

I understand how frustrating it must be to deal with these false positives.

SonarQube does support Java 15 text blocks starting from version 7.3, see this ticket. The rule is intended to flag issues when control characters are used within text blocks, but not in the text block indentation. There may be a bug in the rule, but I was not able to reproduce the issue with the code sample you shared.

To address the issue, you have two options: you can either deactivate the rule as Ann suggested, or adjust the parameter for rule S2479 to allow tabs within text blocks. For both, you need administrator right. I hope one of these solutions helps reduce the noise for you.

I realised why its complaining. Although the error is over the “”" in the IDE, the problem is on the next line because it contains tabs. However, in SQL, there is nothing wrong with tabs, so for us its a false positive. We haven’t figured out yet how to remove this check.

John I agree with you in your case tabs are not a problem. The rule: Whitespace and control characters in literals should be explicit (S2479) has a parameter to allow tabs in text blocks.

To learn how to customize your analysis, the best resource is the quality profile documentation. you’ll need administrative rights for your project to proceed.

Thanks. I have seen the documentation you link to, but I cant find quality profiles in the UI. Where should I look for them?

I saw a post which said its possible to do some configuration in properties files in the project. Is this an option also?

Hi,

They’re under the Quality Profiles link. Even as an unprivileged user, you should see that link, although you may not have rights to edit the profiles when you get there.

Not for rule parameters.

 
Ann