mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
35 lines
520 B
C#
35 lines
520 B
C#
using System;
|
|
|
|
class FutileConditionalTest
|
|
{
|
|
|
|
public void M(string s)
|
|
{
|
|
if (s.Length > 0) ; // $ Alert
|
|
|
|
if (s.Length > 1)
|
|
{
|
|
} // $ Alert
|
|
|
|
if (s.Length > 2) // GOOD: because of else-branch
|
|
{
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("hello");
|
|
}
|
|
|
|
if (s.Length > 3)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
} // $ Alert
|
|
|
|
if (s.Length > 4)
|
|
{
|
|
// GOOD: Because of the comment.
|
|
}
|
|
}
|
|
}
|