mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
52 lines
808 B
C#
52 lines
808 B
C#
class EmptyBlock
|
|
{
|
|
static void Method(string[] args)
|
|
{
|
|
var result = "";
|
|
|
|
// BAD
|
|
foreach (var arg in args)
|
|
{
|
|
}
|
|
|
|
// OK - comment
|
|
foreach (var arg in args)
|
|
{
|
|
// comment
|
|
}
|
|
|
|
// OK - not empty
|
|
foreach (var arg in args)
|
|
{
|
|
result = result + arg;
|
|
}
|
|
|
|
// BAD
|
|
if (true)
|
|
{
|
|
}
|
|
|
|
// OK - comment
|
|
if (true)
|
|
{
|
|
// comment
|
|
}
|
|
|
|
// OK - not empty
|
|
if (true)
|
|
{
|
|
result = result + "foo";
|
|
}
|
|
|
|
// OK - there is an update
|
|
for (int i = 0; i < 10; ++i)
|
|
{
|
|
}
|
|
|
|
// BAD: there is no update
|
|
for (int i = 0; i < 10;)
|
|
{
|
|
}
|
|
}
|
|
}
|