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

S2589: Add FP repro for #8449 #8453

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3458,10 +3458,28 @@ private void Test()
Console.WriteLine();
}
}

public class Repro_8445_OtherClass
{
public static readonly int readonlyStaticInt = 42;
public static readonly string readonlyStaticString = "42";
public readonly int readonlyInt = 42;
public readonly string readonlyString = "42";
}

// Reproducer for https://github.com/SonarSource/sonar-dotnet/issues/8449
public class Repro_8449
{
public static void Foo()
{
int delay = 100;
while (true)
{
if (delay < 1000) // Noncompliant {{Change this condition so that it does not always evaluate to 'True'.}} FP
// ^^^^^^^^^^^^
{
delay = delay * 2;
}
}
}
}