Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S2589 FP: Change this condition so that it does not always evaluate to 'True' #8449

Closed
paulhickman-ec opened this issue Dec 6, 2023 · 1 comment · Fixed by #8656
Closed
Assignees
Labels
Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Area: VB.NET VB.NET rules related issues. Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Milestone

Comments

@paulhickman-ec
Copy link

Description

The code below erroneously reports 2589 Change this condition so that it does not always evaluate to 'True' on the expression delay < 409600

Repro steps

public static void Foo()
{
    int delay = 100;
    while (true)
    {
        if (delay < 409600) delay = delay * 2;
    }
}

Expected behavior

No warning

Actual behavior

Warning S2589

Known workarounds

None

Related information

  • C#/VB.NET Plugins version 9.15.0.81779
  • Visual Studio version 17.7
  • MSBuild / dotnet version 7
  • Operating System Windows 11
@mary-georgiou-sonarsource
Copy link
Contributor

mary-georgiou-sonarsource commented Dec 8, 2023

Hello @paulhickman-ec,

Thanks for reporting this.
I confirm this is an FP - I've added this issue to our backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Area: VB.NET VB.NET rules related issues. Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants