forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmptyBlock.cs
More file actions
56 lines (47 loc) · 862 Bytes
/
EmptyBlock.cs
File metadata and controls
56 lines (47 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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)
{
}
// 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;)
{
}
// BAD
if (true)
{
// comment
}
}
}