jmcgee
(Jamie McGee)
February 17, 2023, 6:07am
1
Make sure to read this post before raising a thread here:
Hey SonarSource Community!
False-positives happen , as do false-negatives, and we’re eager to fix them. We are thrilled when our users report problems, so we can make our products better.
What is a false-positive (FP)?
A false-positive is when an issue is raised unexpectedly on code that should not trigger an issue, or where the suggested action doesn’t make any sense for the code.
What is a false-negative (FN)?
A false-negative is when an issue should be raised on a piece of code, but isn’t…
C#
SonarScanner for MSBuild 5.11
if ((response?.Data?.Results?.Count ?? 0) == 0) return;
offset += response.Data.Results.Count;
Flagged as “‘response’ is null on at least one execution path.”.
If ‘response’ variable was equal to null it would return at first statement, therefor execution cannot reach 2nd line.
Colin
(Colin)
February 20, 2023, 10:35am
2
Hey there.
What version of SonarQube are you using (or are you using SonarCloud)?
jmcgee
(Jamie McGee)
February 21, 2023, 5:59am
3
Hi Colin,
We are using a SonarQube server, version 8.9.9.
SonarScanner for MSBuild 5.11, SonarScanner 4.8.0.2856
Hello jmcgee ,
Thank you for reporting this false positive.
We are planning to improve the support for null coalescing operators for the rule in the future and I can confirm that this is a known false positive.
Best Martin
system
(system)
Closed
March 3, 2023, 7:46am
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.