Skip to content

Commit 40f2cec

Browse files
committed
C#: Autoformat cookbook examples.
1 parent d6e1ba6 commit 40f2cec

15 files changed

+49
-38
lines changed

csharp/ql/examples/snippets/cast_expr.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import csharp
1212

1313
from CastExpr c
14-
where c.getExpr().getType() instanceof FloatingPointType
15-
and c.getType() instanceof IntegralType
14+
where
15+
c.getExpr().getType() instanceof FloatingPointType and
16+
c.getType() instanceof IntegralType
1617
select c

csharp/ql/examples/snippets/catch_exception.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* try
77
* exception
88
*/
9-
9+
1010
import csharp
1111

1212
from CatchClause catch

csharp/ql/examples/snippets/constructor_call.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* constructor
77
* new
88
*/
9-
9+
1010
import csharp
1111

1212
from ObjectCreation new

csharp/ql/examples/snippets/eq_true.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* test
77
* boolean
88
*/
9-
9+
1010
import csharp
1111

1212
from EqualityOperation eq

csharp/ql/examples/snippets/extend_class.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* subtype
1010
* supertype
1111
*/
12-
12+
1313
import csharp
1414

1515
from RefType type

csharp/ql/examples/snippets/field_read.ql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
* @tags field
66
* read
77
*/
8-
8+
99
import csharp
1010

1111
from Field f, FieldRead read
12-
where f.hasName("VirtualAddress")
13-
and f.getDeclaringType().hasQualifiedName("Mono.Cecil.PE.Section")
14-
and f = read.getTarget()
12+
where
13+
f.hasName("VirtualAddress") and
14+
f.getDeclaringType().hasQualifiedName("Mono.Cecil.PE.Section") and
15+
f = read.getTarget()
1516
select read

csharp/ql/examples/snippets/integer_literal.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @tags integer
66
* literal
77
*/
8-
8+
99
import csharp
1010

1111
from IntegerLiteral literal

csharp/ql/examples/snippets/method_call.ql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
* @tags call
66
* method
77
*/
8-
8+
99
import csharp
1010

1111
from MethodCall call, Method method
12-
where call.getTarget() = method
13-
and method.hasName("MethodName")
14-
and method.getDeclaringType().hasQualifiedName("Company.Class")
12+
where
13+
call.getTarget() = method and
14+
method.hasName("MethodName") and
15+
method.getDeclaringType().hasQualifiedName("Company.Class")
1516
select call

csharp/ql/examples/snippets/mutual_recursion.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import csharp
1010

1111
from Method m, Method n
12-
where m.calls(n)
13-
and n.calls(m)
14-
and m != n
12+
where
13+
m.calls(n) and
14+
n.calls(m) and
15+
m != n
1516
select m, n
16-

csharp/ql/examples/snippets/null_argument.ql

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
* collection
99
* add
1010
*/
11-
11+
1212
import csharp
1313

1414
from MethodCall call, Method add
15-
where call.getTarget() = add.getAnUltimateImplementor*()
16-
and add.hasName("Add")
17-
and add.getDeclaringType().getSourceDeclaration().hasQualifiedName("System.Collections.Generic.ICollection<>")
18-
and call.getAnArgument() instanceof NullLiteral
15+
where
16+
call.getTarget() = add.getAnUltimateImplementor*() and
17+
add.hasName("Add") and
18+
add
19+
.getDeclaringType()
20+
.getSourceDeclaration()
21+
.hasQualifiedName("System.Collections.Generic.ICollection<>") and
22+
call.getAnArgument() instanceof NullLiteral
1923
select call

0 commit comments

Comments
 (0)