Skip to content

Commit 65ac951

Browse files
committed
C#: Remove all Sink tags after rebase.
1 parent dcf11c2 commit 65ac951

File tree

5 files changed

+35
-35
lines changed

5 files changed

+35
-35
lines changed

csharp/ql/test/query-tests/API Abuse/FormatInvalid/FormatInvalid.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void FormatStringTests()
3434
String.Format("{0:{}}", 1); // $ Alert
3535

3636
// BAD: Invalid format string
37-
String.Format("%d", 1); // $ Alert Sink
37+
String.Format("%d", 1); // $ Alert
3838

3939
// BAD: } { in the middle.
4040
String.Format("{{0}-{1}}", 0, 1); // $ Alert

csharp/ql/test/query-tests/API Abuse/FormatInvalid/FormatMissingArgument.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ void TestFormatMissingArgument()
99
String.Format("{0}", 0);
1010

1111
// BAD: Missing {1}
12-
String.Format("{1}", 0); // $ Alert Sink
12+
String.Format("{1}", 0); // $ Alert
1313

1414
// BAD: Missing {2} and {3}
15-
String.Format("{2} {3}", 0, 1); // $ Alert Sink
15+
String.Format("{2} {3}", 0, 1); // $ Alert
1616

1717
// GOOD: An array has been supplied.
1818
String.Format("{0} {1} {2}", args);
@@ -29,7 +29,7 @@ void TestFormatMissingArgument()
2929
void helper(string format)
3030
{
3131
// BAD: Missing {1}
32-
String.Format(format, 0); // $ Alert=source1 Sink=source1
32+
String.Format(format, 0); // $ Alert=source1
3333
}
3434

3535
void TestCompositeFormatMissingArgument()
@@ -43,28 +43,28 @@ void TestCompositeFormatMissingArgument()
4343
String.Format<string>(null, format0, "");
4444

4545
// BAD: Missing {1}
46-
String.Format<string>(null, format1, ""); // $ Alert=source2 Sink=source2
46+
String.Format<string>(null, format1, ""); // $ Alert=source2
4747

4848
// GOOD: All args supplied
4949
String.Format<string, string>(null, format01, "", "");
5050

5151
// BAD: Missing {2} and {3}
52-
String.Format<string, string>(null, format23, "", ""); // $ Alert=source3 Sink=source3
52+
String.Format<string, string>(null, format23, "", ""); // $ Alert=source3
5353

5454

5555
// GOOD: All arguments supplied
5656
sb.AppendFormat(null, format0, "");
5757
sb.AppendFormat<string>(null, format0, "");
5858

5959
// BAD: Missing {1}
60-
sb.AppendFormat(null, format1, ""); // $ Alert=source2 Sink=source2
61-
sb.AppendFormat<string>(null, format1, ""); // $ Alert=source2 Sink=source2
60+
sb.AppendFormat(null, format1, ""); // $ Alert=source2
61+
sb.AppendFormat<string>(null, format1, ""); // $ Alert=source2
6262

6363
// GOOD: All args supplied
6464
sb.AppendFormat<string, string>(null, format01, "", "");
6565

6666
// BAD: Missing {2} and {3}
67-
sb.AppendFormat<string, string>(null, format23, "", ""); // $ Alert=source3 Sink=source3
67+
sb.AppendFormat<string, string>(null, format23, "", ""); // $ Alert=source3
6868

6969

7070
var span = new Span<char>();
@@ -74,14 +74,14 @@ void TestCompositeFormatMissingArgument()
7474
span.TryWrite<string>(null, format0, out _, "");
7575

7676
// BAD: Missing {1}
77-
span.TryWrite(null, format1, out _, ""); // $ Alert=source2 Sink=source2
78-
span.TryWrite<string>(null, format1, out _, ""); // $ Alert=source2 Sink=source2
77+
span.TryWrite(null, format1, out _, ""); // $ Alert=source2
78+
span.TryWrite<string>(null, format1, out _, ""); // $ Alert=source2
7979

8080
// GOOD: All args supplied
8181
span.TryWrite<string, string>(null, format01, out _, "", "");
8282

8383
// BAD: Missing {2} and {3}
84-
span.TryWrite<string, string>(null, format23, out _, "", ""); // $ Alert=source3 Sink=source3
84+
span.TryWrite<string, string>(null, format23, out _, "", ""); // $ Alert=source3
8585
}
8686

8787
object[] args;

csharp/ql/test/query-tests/API Abuse/FormatInvalid/FormatMissingArgumentBad.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class Bad3
44
{
55
void Hello(string first, string last)
66
{
7-
Console.WriteLine("Hello {0} {1}", first); // $ Alert Sink
8-
Console.WriteLine("Hello {1} {2}", first, last); // $ Alert Sink
7+
Console.WriteLine("Hello {0} {1}", first); // $ Alert
8+
Console.WriteLine("Hello {1} {2}", first, last); // $ Alert
99
}
1010
}

csharp/ql/test/query-tests/API Abuse/FormatInvalid/FormatUnusedArgument.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ void FormatTests()
99
String.Format("{0} {1} {2}", 0, 1, 2);
1010

1111
// BAD: Missing arg {0}
12-
String.Format("X", 1); // $ Alert Sink
12+
String.Format("X", 1); // $ Alert
1313

1414
// BAD: Missing {1}
15-
String.Format("{0}", 1, 2); // $ Alert Sink
15+
String.Format("{0}", 1, 2); // $ Alert
1616

1717
// BAD: Missing {1}
18-
String.Format("{0} {0}", 1, 2); // $ Alert Sink
18+
String.Format("{0} {0}", 1, 2); // $ Alert
1919

2020
// BAD: Missing {0}
21-
String.Format("{1} {1}", 1, 2); // $ Alert Sink
21+
String.Format("{1} {1}", 1, 2); // $ Alert
2222

2323
// BAD: Missing {0}, {1} and {2}
24-
String.Format("abcdefg", 0, 1, 2); // $ Alert Sink
24+
String.Format("abcdefg", 0, 1, 2); // $ Alert
2525

2626
// BAD: {0} is unused
27-
String.Format("{{sdc}}", 0); // $ Alert Sink
27+
String.Format("{{sdc}}", 0); // $ Alert
2828

2929
// GOOD: {0} is used
3030
String.Format("{{{0:D}}}", 0);
@@ -36,7 +36,7 @@ void FormatTests()
3636
String.Format("{0} {1} {2}", ps);
3737

3838
// BAD: Would display "{0}"
39-
String.Format("{{0}}", 1); // $ Alert Sink
39+
String.Format("{{0}}", 1); // $ Alert
4040

4141
// GOOD: Ignore the empty string as it's often used as the default value
4242
// of GetResource().
@@ -50,35 +50,35 @@ void CompositeFormatTests()
5050
var format11 = CompositeFormat.Parse("{1}{1}"); // $ Source=source6
5151

5252
// BAD: Unused arg {0}
53-
String.Format<string>(null, format, ""); // $ Alert=source4 Sink=source4
53+
String.Format<string>(null, format, ""); // $ Alert=source4
5454

5555
// BAD: Unused arg {1}
56-
String.Format<string, string>(null, format00, "", ""); // $ Alert=source5 Sink=source5
56+
String.Format<string, string>(null, format00, "", ""); // $ Alert=source5
5757

5858
// BAD: Unused arg {0}
59-
String.Format<string, string>(null, format11, "", ""); // $ Alert=source6 Sink=source6
59+
String.Format<string, string>(null, format11, "", ""); // $ Alert=source6
6060

6161
// BAD: Unused arg {0}
62-
sb.AppendFormat(null, format, ""); // $ Alert=source4 Sink=source4
63-
sb.AppendFormat<string>(null, format, ""); // $ Alert=source4 Sink=source4
62+
sb.AppendFormat(null, format, ""); // $ Alert=source4
63+
sb.AppendFormat<string>(null, format, ""); // $ Alert=source4
6464

6565
// BAD: Unused arg {1}
66-
sb.AppendFormat<string, string>(null, format00, "", ""); // $ Alert=source5 Sink=source5
66+
sb.AppendFormat<string, string>(null, format00, "", ""); // $ Alert=source5
6767

6868
// BAD: Unused arg {0}
69-
sb.AppendFormat<string, string>(null, format11, "", ""); // $ Alert=source6 Sink=source6
69+
sb.AppendFormat<string, string>(null, format11, "", ""); // $ Alert=source6
7070

7171
var span = new Span<char>();
7272

7373
// BAD: Unused arg {0}
74-
span.TryWrite(null, format, out _, ""); // $ Alert=source4 Sink=source4
75-
span.TryWrite<string>(null, format, out _, ""); // $ Alert=source4 Sink=source4
74+
span.TryWrite(null, format, out _, ""); // $ Alert=source4
75+
span.TryWrite<string>(null, format, out _, ""); // $ Alert=source4
7676

7777
// BAD: Unused arg {1}
78-
span.TryWrite<string, string>(null, format00, out _, "", ""); // $ Alert=source5 Sink=source5
78+
span.TryWrite<string, string>(null, format00, out _, "", ""); // $ Alert=source5
7979

8080
// BAD: Unused arg {0}
81-
span.TryWrite<string, string>(null, format11, out _, "", ""); // $ Alert=source6 Sink=source6
81+
span.TryWrite<string, string>(null, format11, out _, "", ""); // $ Alert=source6
8282
}
8383

8484
object[] ps;

csharp/ql/test/query-tests/API Abuse/FormatInvalid/FormatUnusedArgumentBad.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ class Bad2
44
{
55
void M(Exception ex)
66
{
7-
Console.WriteLine("Error processing file: {0}", ex, ex.HResult); // $ Alert Sink
8-
Console.WriteLine("Error processing file: {1} ({1})", ex, ex.HResult); // $ Alert Sink
9-
Console.WriteLine("Error processing file: %s (%d)", ex, ex.HResult); // $ Alert Sink
7+
Console.WriteLine("Error processing file: {0}", ex, ex.HResult); // $ Alert
8+
Console.WriteLine("Error processing file: {1} ({1})", ex, ex.HResult); // $ Alert
9+
Console.WriteLine("Error processing file: %s (%d)", ex, ex.HResult); // $ Alert
1010
}
1111
}

0 commit comments

Comments
 (0)