Skip to content

Commit 2622fc6

Browse files
author
Esben Sparre Andreasen
committed
JS: autoformat
1 parent 86a046a commit 2622fc6

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

javascript/ql/src/semmle/javascript/frameworks/Koa.qll

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/**
23
* Provides classes for working with [Koa](https://koajs.com) applications.
34
*/
@@ -63,18 +64,13 @@ module Koa {
6364
* Gets an expression that contains the context or response
6465
* object of a route handler invocation.
6566
*/
66-
Expr getAResponseOrContextExpr() {
67-
result = getAResponseExpr() or result = getAContextExpr()
68-
}
67+
Expr getAResponseOrContextExpr() { result = getAResponseExpr() or result = getAContextExpr() }
6968

7069
/**
7170
* Gets an expression that contains the context or request
7271
* object of a route handler invocation.
7372
*/
74-
Expr getARequestOrContextExpr() {
75-
result = getARequestExpr() or result = getAContextExpr()
76-
}
77-
73+
Expr getARequestOrContextExpr() { result = getARequestExpr() or result = getAContextExpr() }
7874
}
7975

8076
/**
@@ -184,7 +180,7 @@ module Koa {
184180
exists(string propName |
185181
kind = "url" and
186182
this.asExpr().(PropAccess).accesses(e, propName)
187-
|
183+
|
188184
propName = "url"
189185
or
190186
propName = "originalUrl"
@@ -221,7 +217,7 @@ module Koa {
221217

222218
private DataFlow::Node getAQueryParameterAccess(RouteHandler rh) {
223219
// `ctx.query.name` or `ctx.request.query.name`
224-
exists (PropAccess q |
220+
exists(PropAccess q |
225221
q.accesses(rh.getARequestOrContextExpr(), "query") and
226222
result = q.flow().(DataFlow::SourceNode).getAPropertyRead()
227223
)
@@ -288,7 +284,9 @@ module Koa {
288284

289285
ResponseSendArgument() {
290286
exists(DataFlow::PropWrite pwn |
291-
pwn.writes(DataFlow::valueNode(rh.getAResponseOrContextExpr()), "body", DataFlow::valueNode(this))
287+
pwn
288+
.writes(DataFlow::valueNode(rh.getAResponseOrContextExpr()), "body",
289+
DataFlow::valueNode(this))
292290
)
293291
}
294292

@@ -301,13 +299,10 @@ module Koa {
301299
private class RedirectInvocation extends HTTP::RedirectInvocation, MethodCallExpr {
302300
RouteHandler rh;
303301

304-
RedirectInvocation() {
305-
this.(MethodCallExpr).calls(rh.getAResponseOrContextExpr(), "redirect")
306-
}
302+
RedirectInvocation() { this.(MethodCallExpr).calls(rh.getAResponseOrContextExpr(), "redirect") }
307303

308304
override Expr getUrlArgument() { result = getArgument(0) }
309305

310306
override RouteHandler getRouteHandler() { result = rh }
311307
}
312-
313308
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
12
import javascript
23

3-
query predicate test_RedirectInvocation(HTTP::RedirectInvocation redirect, Expr url, HTTP::RouteHandler rh) {
4+
query predicate test_RedirectInvocation(
5+
HTTP::RedirectInvocation redirect, Expr url, HTTP::RouteHandler rh
6+
) {
47
redirect.getUrlArgument() = url and
58
redirect.getRouteHandler() = rh
69
}

0 commit comments

Comments
 (0)