For:
Sonarqube Version 9.1.0.47736
Azure DevOps plugin 5.0.0 (Latest)
C#
protected void Test(decimal? value1, decimal? value2)
{
if (value1 == null || value2 == null || value1 != value2)
{
Console.WriteLine("test");
}
}
false positive is being reported “Change this condition so that it does not always evaluate to ‘false’.”
for value1 != value2
csharpsquid:S2589
pass fine when changed to:
protected void Test(decimal? value1, decimal? value2)
{
if (value1 == null || value2 == null || value1.Value != value2.Value)
{
Console.WriteLine("test");
}
}