Closed nrankin18 closed 1 month ago
Hi @nrankin18!
You are using an old version of the analyzer, v.8.4.0.10426
.
The FP you are experiencing does not reproduce in the latest version of the plugin. Therefore, updating to the most recent version should resolve your issue 👍
@CristianAmbrosini I have updated to 8.6.0.10679 and am still experiencing this false positive.
List<string> foo = [];
foo.AddRange([]);
if (foo.Count > 0) { // S2589 is raised
return;
}
Hi @nrankin18, it looks like you're not using the latest version. I recommend updating to 9.32.0.97167
.
Hi @CristianAmbrosini, thanks for the reply. I double-checked and the SonarLint for Visual Studio 2022 extension is showing 8.6.0.10679 as the most recent version (last updated on 10/23).
I didn't realize you were referring to the SonarLint version rather than the plugin version. I have double-checked, and the fix is included in plugin version 10. However, it has not yet been integrated into SonarLint or SonarQube. I will need to ask you to be patient for a while, have a good day!
Sorry for the confusion! I'm glad to hear it's in the pipeline. Thanks for the clarification.
Description
Rule S2583 is raised when List is considered to be populated.
Repro steps
Expected behavior
S2583 should not be raised since it's possible for foo to contain any number of elements, including 0.
Actual behavior
S2583 is raised.
Known workarounds
Inhibit S2583
Related information