Skip to content

Commit 726a873

Browse files
committed
C#: Autoformat.
1 parent 96e4a57 commit 726a873

File tree

126 files changed

+800
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+800
-560
lines changed

csharp/ql/src/API Abuse/Dispose.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class WebPage extends RefType {
3030
*/
3131
predicate isAutoDisposedWebControl(Field f) {
3232
f.getType() instanceof WebControl and
33-
f.getDeclaringType() = any(RefType t |
33+
f.getDeclaringType() =
34+
any(RefType t |
3435
t instanceof WebControl or
3536
t instanceof WebPage
3637
)

csharp/ql/src/API Abuse/NoDisposeCallOnLocalIDisposable.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ private class Conf extends DataFlow::Configuration {
2828
Conf() { this = "NoDisposeCallOnLocalIDisposable" }
2929

3030
override predicate isSource(DataFlow::Node node) {
31-
node.asExpr() = any(LocalScopeDisposableCreation disposable |
31+
node.asExpr() =
32+
any(LocalScopeDisposableCreation disposable |
3233
// Only care about library types - user types often have spurious IDisposable declarations
3334
disposable.getType().fromLibrary() and
3435
// WebControls are usually disposed automatically
@@ -80,7 +81,8 @@ private class Conf extends DataFlow::Configuration {
8081
}
8182

8283
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
83-
node2.asExpr() = any(LocalScopeDisposableCreation other | other.getAnArgument() = node1.asExpr())
84+
node2.asExpr() =
85+
any(LocalScopeDisposableCreation other | other.getAnArgument() = node1.asExpr())
8486
}
8587

8688
override predicate isBarrierOut(DataFlow::Node node) {

csharp/ql/src/API Abuse/UncheckedReturnValue.ql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ predicate dubious(Method m, int percentage) {
4747
not designedForChaining(m) and
4848
exists(int used, int total, Method target |
4949
target = m.getSourceDeclaration() and
50-
used = count(MethodCall mc |
50+
used =
51+
count(MethodCall mc |
5152
mc.getTarget().getSourceDeclaration() = target and
5253
not mc instanceof DiscardedMethodCall and
5354
(methodHasGenericReturnType(m) implies m.getReturnType() = mc.getTarget().getReturnType())
5455
) and
55-
total = count(MethodCall mc |
56+
total =
57+
count(MethodCall mc |
5658
mc.getTarget().getSourceDeclaration() = target and
5759
(methodHasGenericReturnType(m) implies m.getReturnType() = mc.getTarget().getReturnType())
5860
) and
@@ -64,7 +66,8 @@ predicate dubious(Method m, int percentage) {
6466
}
6567

6668
int chainedUses(Method m) {
67-
result = count(MethodCall mc, MethodCall qual |
69+
result =
70+
count(MethodCall mc, MethodCall qual |
6871
m = mc.getTarget() and
6972
hasQualifierAndTarget(mc, qual, qual.getTarget())
7073
)

csharp/ql/src/Bad Practices/Implementation Hiding/StaticArray.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@
1414
import csharp
1515

1616
predicate nonEmptyArrayLiteralOrNull(Expr e) {
17-
e = any(ArrayCreation arr |
17+
e =
18+
any(ArrayCreation arr |
1819
exists(arr.getInitializer().getAnElement())
1920
or
2021
not arr.getALengthArgument().getValue() = "0"
2122
)
2223
or
2324
e instanceof NullLiteral
2425
or
25-
e = any(ConditionalExpr cond |
26+
e =
27+
any(ConditionalExpr cond |
2628
nonEmptyArrayLiteralOrNull(cond.getThen()) and
2729
nonEmptyArrayLiteralOrNull(cond.getElse())
2830
)

csharp/ql/src/Bad Practices/Magic Constants/MagicConstants.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ private predicate relevantLiteral(Literal literal, string value) {
263263
}
264264

265265
private predicate valueOccurrenceCount(string value, int n) {
266-
n = strictcount(Location loc |
266+
n =
267+
strictcount(Location loc |
267268
exists(Literal lit | relevantLiteral(lit, value) | lit.getLocation() = loc)
268269
) and
269270
n > 20
@@ -289,7 +290,8 @@ private predicate check(Literal lit, string value, int n, File f) {
289290
}
290291

291292
private predicate checkWithFileCount(string value, int overallCount, int fileCount, File f) {
292-
fileCount = strictcount(Location loc |
293+
fileCount =
294+
strictcount(Location loc |
293295
exists(Literal lit | check(lit, value, overallCount, f) | lit.getLocation() = loc)
294296
)
295297
}
@@ -322,7 +324,8 @@ predicate isNumber(Literal lit) {
322324
predicate magicConstant(Literal e, string msg) {
323325
exists(string value, int n |
324326
firstOccurrence(e, value, n) and
325-
msg = "Magic constant: literal '" + value + "' is repeated " + n.toString() +
327+
msg =
328+
"Magic constant: literal '" + value + "' is repeated " + n.toString() +
326329
" times and should be encapsulated in a constant."
327330
)
328331
}

csharp/ql/src/Complexity/ComplexCondition.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ predicate logicalParent(LogicalOperation op, LogicalOperation parent) { parent =
2323
from Expr e, int operators
2424
where
2525
not e.getParent() instanceof LogicalOperation and
26-
operators = count(BinaryLogicalOperation op |
27-
logicalParent*(op, e) and nontrivialLogicalOperator(op)
28-
) and
26+
operators =
27+
count(BinaryLogicalOperation op | logicalParent*(op, e) and nontrivialLogicalOperator(op)) and
2928
operators > 3
3029
select e.getLocation(), "Complex condition: too many logical operations in this expression."

csharp/ql/src/Concurrency/Concurrency.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class LockStmtBlock extends LockedBlock {
8181
*/
8282
class LockingCall extends MethodCall {
8383
LockingCall() {
84-
this.getTarget() = any(Method m |
84+
this.getTarget() =
85+
any(Method m |
8586
m.getDeclaringType().hasQualifiedName("System.Threading", "Monitor") and
8687
m.getName().matches("%Enter%")
8788
) or

csharp/ql/src/Dead Code/DeadStoreOfLocal.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ class RelevantDefinition extends AssignableDefinition {
8282
// for now
8383
//or
8484
//this.(AssignableDefinitions::OutRefDefinition).getTargetAccess().isOutArgument()
85-
this.(AssignableDefinitions::LocalVariableDefinition).getDeclaration() = any(LocalVariableDeclExpr lvde |
85+
this.(AssignableDefinitions::LocalVariableDefinition).getDeclaration() =
86+
any(LocalVariableDeclExpr lvde |
8687
lvde = any(SpecificCatchClause scc).getVariableDeclExpr()
8788
or
8889
lvde = any(ForeachStmt fs).getVariableDeclExpr() and
@@ -123,7 +124,8 @@ class RelevantDefinition extends AssignableDefinition {
123124
or
124125
e instanceof NullLiteral
125126
or
126-
e = any(Field f |
127+
e =
128+
any(Field f |
127129
f.isStatic() and
128130
(f.isReadOnly() or f.isConst())
129131
).getAnAccess()

csharp/ql/src/Language Abuse/CatchOfGenericException.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class GenericCatchClause extends CatchClause {
1818
GenericCatchClause() {
1919
this instanceof GeneralCatchClause
2020
or
21-
this = any(SpecificCatchClause scc |
21+
this =
22+
any(SpecificCatchClause scc |
2223
scc.getCaughtExceptionType() instanceof SystemExceptionClass and
2324
not scc.hasFilterClause()
2425
)

csharp/ql/src/Language Abuse/ForeachCapture.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ Element getCollectionAssignmentTarget(Expr e) {
9090
e = result.(ArrayCreation).getInitializer().getAnElement()
9191
or
9292
// Collection initializer
93-
e = result
93+
e =
94+
result
9495
.(ObjectCreation)
9596
.getInitializer()
9697
.(CollectionInitializer)

0 commit comments

Comments
 (0)