Skip to content

Commit fce8058

Browse files
committed
C#: Address review comments
1 parent 3bb3de2 commit fce8058

File tree

7 files changed

+121
-121
lines changed

7 files changed

+121
-121
lines changed

csharp/ql/src/CSI/NullAlways.qhelp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
<overview>
8-
<p>If a variable is dereferenced, and the variable has a <code>null</code>
9-
value on all possible execution paths leading to the dereferencing, the dereferencing is
10-
guaranteed to result in a <code>NullReferenceException</code>.
8+
<p>If a variable is dereferenced, for example as the qualifier in a method call, and the
9+
variable has a <code>null</code> value on all possible execution paths leading to the
10+
dereferencing, the dereferencing is guaranteed to result in a <code>NullReferenceException</code>.
1111
</p>
1212

1313
</overview>

csharp/ql/src/CSI/NullAlways.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ import semmle.code.csharp.dataflow.Nullness
1616

1717
from Dereference d, Ssa::SourceVariable v
1818
where d.isFirstAlwaysNull(v)
19-
select d, "Variable '$@' is always null here.", v, v.toString()
19+
select d, "Variable $@ is always null here.", v, v.toString()

csharp/ql/src/CSI/NullMaybe.qhelp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
<overview>
8-
<p>If a variable is dereferenced, and the variable may have a <code>null</code>
9-
value on some execution paths leading to the dereferencing, the dereferencing
10-
may result in a <code>NullReferenceException</code>.
8+
<p>If a variable is dereferenced, for example as the qualifier in a method call, and the
9+
variable may have a <code>null</code> value on some execution paths leading to the
10+
dereferencing, the dereferencing may result in a <code>NullReferenceException</code>.
1111
</p>
1212

1313
</overview>

csharp/ql/src/CSI/NullMaybe.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ import semmle.code.csharp.dataflow.Nullness
1717

1818
from Dereference d, Ssa::SourceVariable v, string msg, Element reason
1919
where d.isFirstMaybeNull(v.getAnSsaDefinition(), msg, reason)
20-
select d, "Variable '$@' may be null here " + msg + ".", v, v.toString(), reason, "this"
20+
select d, "Variable $@ may be null here " + msg + ".", v, v.toString(), reason, "this"

csharp/ql/test/query-tests/Nullness/B.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public void OperatorCall()
3434
return !(b1 == b2);
3535
}
3636

37-
public struct CoOrds
37+
public struct Coords
3838
{
3939
public int x, y;
4040

41-
public CoOrds(int p1, int p2)
41+
public Coords(int p1, int p2)
4242
{
4343
x = p1;
4444
y = p2;
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
| A.cs:8:15:8:32 | access to local variable synchronizedAlways | Variable '$@' is always null here. | A.cs:7:16:7:33 | synchronizedAlways | synchronizedAlways |
2-
| A.cs:17:9:17:17 | access to local variable arrayNull | Variable '$@' is always null here. | A.cs:16:15:16:23 | arrayNull | arrayNull |
3-
| A.cs:31:27:31:37 | access to local variable arrayAccess | Variable '$@' is always null here. | A.cs:26:15:26:25 | arrayAccess | arrayAccess |
4-
| A.cs:32:27:32:37 | access to local variable fieldAccess | Variable '$@' is always null here. | A.cs:27:18:27:28 | fieldAccess | fieldAccess |
5-
| A.cs:33:28:33:39 | access to local variable methodAccess | Variable '$@' is always null here. | A.cs:28:16:28:27 | methodAccess | methodAccess |
6-
| A.cs:34:27:34:36 | access to local variable methodCall | Variable '$@' is always null here. | A.cs:29:16:29:25 | methodCall | methodCall |
7-
| A.cs:50:9:50:14 | access to local variable varRef | Variable '$@' is always null here. | A.cs:48:16:48:21 | varRef | varRef |
8-
| Assert.cs:15:27:15:27 | access to local variable s | Variable '$@' is always null here. | Assert.cs:9:16:9:16 | s | s |
9-
| Assert.cs:23:27:23:27 | access to local variable s | Variable '$@' is always null here. | Assert.cs:9:16:9:16 | s | s |
10-
| Assert.cs:31:27:31:27 | access to local variable s | Variable '$@' is always null here. | Assert.cs:9:16:9:16 | s | s |
11-
| Assert.cs:47:27:47:27 | access to local variable s | Variable '$@' is always null here. | Assert.cs:9:16:9:16 | s | s |
12-
| Assert.cs:51:27:51:27 | access to local variable s | Variable '$@' is always null here. | Assert.cs:9:16:9:16 | s | s |
13-
| B.cs:13:13:13:24 | access to local variable eqCallAlways | Variable '$@' is always null here. | B.cs:7:11:7:22 | eqCallAlways | eqCallAlways |
14-
| B.cs:24:13:24:25 | access to local variable neqCallAlways | Variable '$@' is always null here. | B.cs:10:11:10:23 | neqCallAlways | neqCallAlways |
15-
| C.cs:18:13:18:13 | access to local variable o | Variable '$@' is always null here. | C.cs:10:16:10:16 | o | o |
16-
| C.cs:42:9:42:9 | access to local variable s | Variable '$@' is always null here. | C.cs:40:13:40:13 | s | s |
17-
| C.cs:57:9:57:10 | access to local variable o2 | Variable '$@' is always null here. | C.cs:55:13:55:14 | o2 | o2 |
18-
| C.cs:163:13:163:13 | access to local variable s | Variable '$@' is always null here. | C.cs:152:13:152:13 | s | s |
19-
| C.cs:171:13:171:13 | access to local variable s | Variable '$@' is always null here. | C.cs:152:13:152:13 | s | s |
20-
| C.cs:197:13:197:13 | access to local variable s | Variable '$@' is always null here. | C.cs:186:13:186:13 | s | s |
21-
| C.cs:219:13:219:13 | access to local variable s | Variable '$@' is always null here. | C.cs:211:13:211:13 | s | s |
22-
| C.cs:234:9:234:9 | access to local variable s | Variable '$@' is always null here. | C.cs:229:16:229:16 | s | s |
23-
| C.cs:238:13:238:13 | access to local variable s | Variable '$@' is always null here. | C.cs:229:16:229:16 | s | s |
24-
| C.cs:250:9:250:9 | access to local variable a | Variable '$@' is always null here. | C.cs:249:15:249:15 | a | a |
25-
| C.cs:261:9:261:10 | access to local variable ia | Variable '$@' is always null here. | C.cs:258:15:258:16 | ia | ia |
26-
| C.cs:262:20:262:21 | access to local variable sa | Variable '$@' is always null here. | C.cs:259:18:259:19 | sa | sa |
27-
| D.cs:120:13:120:13 | access to local variable x | Variable '$@' is always null here. | D.cs:117:13:117:13 | x | x |
28-
| D.cs:197:13:197:13 | access to local variable o | Variable '$@' is always null here. | D.cs:195:13:195:13 | o | o |
29-
| D.cs:207:17:207:17 | access to local variable e | Variable '$@' is always null here. | D.cs:204:26:204:26 | e | e |
30-
| D.cs:217:13:217:14 | access to local variable o3 | Variable '$@' is always null here. | D.cs:215:13:215:14 | o3 | o3 |
31-
| D.cs:222:13:222:14 | access to local variable o4 | Variable '$@' is always null here. | D.cs:220:13:220:14 | o4 | o4 |
32-
| D.cs:385:13:385:15 | access to local variable ioe | Variable '$@' is always null here. | D.cs:378:19:378:21 | ioe | ioe |
33-
| E.cs:210:16:210:16 | access to parameter s | Variable '$@' is always null here. | E.cs:206:28:206:28 | s | s |
34-
| E.cs:220:13:220:13 | access to local variable x | Variable '$@' is always null here. | E.cs:215:13:215:13 | x | x |
35-
| E.cs:229:13:229:13 | access to local variable x | Variable '$@' is always null here. | E.cs:225:13:225:13 | x | x |
36-
| Forwarding.cs:36:31:36:31 | access to local variable s | Variable '$@' is always null here. | Forwarding.cs:7:16:7:16 | s | s |
37-
| Forwarding.cs:40:27:40:27 | access to local variable s | Variable '$@' is always null here. | Forwarding.cs:7:16:7:16 | s | s |
38-
| NullAlwaysBad.cs:9:30:9:30 | access to parameter s | Variable '$@' is always null here. | NullAlwaysBad.cs:7:29:7:29 | s | s |
1+
| A.cs:8:15:8:32 | access to local variable synchronizedAlways | Variable $@ is always null here. | A.cs:7:16:7:33 | synchronizedAlways | synchronizedAlways |
2+
| A.cs:17:9:17:17 | access to local variable arrayNull | Variable $@ is always null here. | A.cs:16:15:16:23 | arrayNull | arrayNull |
3+
| A.cs:31:27:31:37 | access to local variable arrayAccess | Variable $@ is always null here. | A.cs:26:15:26:25 | arrayAccess | arrayAccess |
4+
| A.cs:32:27:32:37 | access to local variable fieldAccess | Variable $@ is always null here. | A.cs:27:18:27:28 | fieldAccess | fieldAccess |
5+
| A.cs:33:28:33:39 | access to local variable methodAccess | Variable $@ is always null here. | A.cs:28:16:28:27 | methodAccess | methodAccess |
6+
| A.cs:34:27:34:36 | access to local variable methodCall | Variable $@ is always null here. | A.cs:29:16:29:25 | methodCall | methodCall |
7+
| A.cs:50:9:50:14 | access to local variable varRef | Variable $@ is always null here. | A.cs:48:16:48:21 | varRef | varRef |
8+
| Assert.cs:15:27:15:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
9+
| Assert.cs:23:27:23:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
10+
| Assert.cs:31:27:31:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
11+
| Assert.cs:47:27:47:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
12+
| Assert.cs:51:27:51:27 | access to local variable s | Variable $@ is always null here. | Assert.cs:9:16:9:16 | s | s |
13+
| B.cs:13:13:13:24 | access to local variable eqCallAlways | Variable $@ is always null here. | B.cs:7:11:7:22 | eqCallAlways | eqCallAlways |
14+
| B.cs:24:13:24:25 | access to local variable neqCallAlways | Variable $@ is always null here. | B.cs:10:11:10:23 | neqCallAlways | neqCallAlways |
15+
| C.cs:18:13:18:13 | access to local variable o | Variable $@ is always null here. | C.cs:10:16:10:16 | o | o |
16+
| C.cs:42:9:42:9 | access to local variable s | Variable $@ is always null here. | C.cs:40:13:40:13 | s | s |
17+
| C.cs:57:9:57:10 | access to local variable o2 | Variable $@ is always null here. | C.cs:55:13:55:14 | o2 | o2 |
18+
| C.cs:163:13:163:13 | access to local variable s | Variable $@ is always null here. | C.cs:152:13:152:13 | s | s |
19+
| C.cs:171:13:171:13 | access to local variable s | Variable $@ is always null here. | C.cs:152:13:152:13 | s | s |
20+
| C.cs:197:13:197:13 | access to local variable s | Variable $@ is always null here. | C.cs:186:13:186:13 | s | s |
21+
| C.cs:219:13:219:13 | access to local variable s | Variable $@ is always null here. | C.cs:211:13:211:13 | s | s |
22+
| C.cs:234:9:234:9 | access to local variable s | Variable $@ is always null here. | C.cs:229:16:229:16 | s | s |
23+
| C.cs:238:13:238:13 | access to local variable s | Variable $@ is always null here. | C.cs:229:16:229:16 | s | s |
24+
| C.cs:250:9:250:9 | access to local variable a | Variable $@ is always null here. | C.cs:249:15:249:15 | a | a |
25+
| C.cs:261:9:261:10 | access to local variable ia | Variable $@ is always null here. | C.cs:258:15:258:16 | ia | ia |
26+
| C.cs:262:20:262:21 | access to local variable sa | Variable $@ is always null here. | C.cs:259:18:259:19 | sa | sa |
27+
| D.cs:120:13:120:13 | access to local variable x | Variable $@ is always null here. | D.cs:117:13:117:13 | x | x |
28+
| D.cs:197:13:197:13 | access to local variable o | Variable $@ is always null here. | D.cs:195:13:195:13 | o | o |
29+
| D.cs:207:17:207:17 | access to local variable e | Variable $@ is always null here. | D.cs:204:26:204:26 | e | e |
30+
| D.cs:217:13:217:14 | access to local variable o3 | Variable $@ is always null here. | D.cs:215:13:215:14 | o3 | o3 |
31+
| D.cs:222:13:222:14 | access to local variable o4 | Variable $@ is always null here. | D.cs:220:13:220:14 | o4 | o4 |
32+
| D.cs:385:13:385:15 | access to local variable ioe | Variable $@ is always null here. | D.cs:378:19:378:21 | ioe | ioe |
33+
| E.cs:210:16:210:16 | access to parameter s | Variable $@ is always null here. | E.cs:206:28:206:28 | s | s |
34+
| E.cs:220:13:220:13 | access to local variable x | Variable $@ is always null here. | E.cs:215:13:215:13 | x | x |
35+
| E.cs:229:13:229:13 | access to local variable x | Variable $@ is always null here. | E.cs:225:13:225:13 | x | x |
36+
| Forwarding.cs:36:31:36:31 | access to local variable s | Variable $@ is always null here. | Forwarding.cs:7:16:7:16 | s | s |
37+
| Forwarding.cs:40:27:40:27 | access to local variable s | Variable $@ is always null here. | Forwarding.cs:7:16:7:16 | s | s |
38+
| NullAlwaysBad.cs:9:30:9:30 | access to parameter s | Variable $@ is always null here. | NullAlwaysBad.cs:7:29:7:29 | s | s |

0 commit comments

Comments
 (0)