False positive for S2589

Hi there,
trying out Solarlint i found an FP for S2589.
Found similar issues in the forum but either not exactly same or supposed to be resolved in the plugin version i am using.

  • Operating system: Windows 10 22H2
  • Visual Studio version: VS 2022, 17.9.5
  • SonarLint plugin version: 7.8.0.88494
  • Programming language you’re coding in: C#
  • Is connected mode used: No
    • Connected to SonarCloud or SonarQube (and which version):

Following code block produces S2589 at line “if (!found)”:

if (licenseData != null && licenseData.Any())
{
    var found = false;
    licenseData.ToList().ForEach(license =>
    {
        if (license.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).Exists(a => a == artifactType))
        {
            found = true;
        }
    });

    if (!found)
    {
        _logger.LogWarning("No License for artifact type");
    }

    return found;
}

Hello @um78,

Thank you for reporting the false positive. I was able to reproduce it and added it to our backlog. To receive further updates, you can track this issue at

Hi Martin,

Thanks for your quick reaction.

Cheers,

Ueli

~WRD0000.jpg

1 Like