Skip to content

Commit b81d2ca

Browse files
committed
C#: Autoformat QLL files
1 parent bbc49dc commit b81d2ca

File tree

185 files changed

+6276
-8176
lines changed

Some content is hidden

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

185 files changed

+6276
-8176
lines changed

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

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,18 @@ private import semmle.code.csharp.frameworks.System
44
private import semmle.code.csharp.frameworks.system.web.UI
55

66
class DisposableType extends RefType {
7-
DisposableType() {
8-
this.getABaseType+() instanceof SystemIDisposableInterface
9-
}
7+
DisposableType() { this.getABaseType+() instanceof SystemIDisposableInterface }
108
}
119

1210
class DisposableField extends Field {
13-
DisposableField() {
14-
this.getType() instanceof DisposableType
15-
}
11+
DisposableField() { this.getType() instanceof DisposableType }
1612
}
1713

1814
class WebControl extends RefType {
19-
WebControl() {
20-
this.getBaseClass*() instanceof SystemWebUIControlClass
21-
}
15+
WebControl() { this.getBaseClass*() instanceof SystemWebUIControlClass }
2216
}
2317

24-
class WebPage extends RefType {
25-
WebPage() {
26-
this.getBaseClass*() instanceof SystemWebUIPageClass
27-
}
28-
}
18+
class WebPage extends RefType { WebPage() { this.getBaseClass*() instanceof SystemWebUIPageClass } }
2919

3020
/**
3121
* Holds if `f` is an auto-disposed web control.
@@ -37,15 +27,13 @@ class WebPage extends RefType {
3727
* `UnloadRecursive()`.
3828
*/
3929
predicate isAutoDisposedWebControl(Field f) {
40-
f.getType() instanceof WebControl
41-
and
30+
f.getType() instanceof WebControl and
4231
f.getDeclaringType() = any(RefType t |
43-
t instanceof WebControl or
44-
t instanceof WebPage
45-
)
32+
t instanceof WebControl or
33+
t instanceof WebPage
34+
)
4635
}
4736

48-
4937
/**
5038
* An object creation that creates an `IDisposable` instance into the local scope.
5139
*/
@@ -56,13 +44,13 @@ class LocalScopeDisposableCreation extends Call {
5644
// Type extends IDisposable
5745
t instanceof DisposableType and
5846
// Within function, not field or instance initializer
59-
exists(this.getEnclosingCallable()) |
47+
exists(this.getEnclosingCallable())
48+
|
6049
// Either an ordinary object creation
6150
this instanceof ObjectCreation
6251
or
6352
// Or a creation using a factory method
64-
exists(Method create |
65-
this.getTarget() = create |
53+
exists(Method create | this.getTarget() = create |
6654
create.hasName("Create") and
6755
create.isStatic() and
6856
create.getDeclaringType().getSourceDeclaration() = t.getSourceDeclaration()
@@ -74,20 +62,17 @@ class LocalScopeDisposableCreation extends Call {
7462
* Gets an expression that, if it is disposed of, will imply that the object
7563
* created by this creation is disposed of as well.
7664
*/
77-
Expr getADisposeTarget() {
78-
result = getADisposeTarget0().asExpr()
79-
}
65+
Expr getADisposeTarget() { result = getADisposeTarget0().asExpr() }
8066

8167
private DataFlow::Node getADisposeTarget0() {
8268
result = exprNode(this)
8369
or
84-
exists(DataFlow::Node mid |
85-
mid = this.getADisposeTarget0() |
70+
exists(DataFlow::Node mid | mid = this.getADisposeTarget0() |
8671
localFlowStep(mid, result)
8772
or
8873
result.asExpr() = any(LocalScopeDisposableCreation other |
89-
other.getAnArgument() = mid.asExpr()
90-
)
74+
other.getAnArgument() = mid.asExpr()
75+
)
9176
)
9277
}
9378
}

0 commit comments

Comments
 (0)