Skip to content

Commit f1957df

Browse files
committed
JS: Run the autoformatter for .qll/.ql files
1 parent 681b1a5 commit f1957df

File tree

4 files changed

+24
-28
lines changed

4 files changed

+24
-28
lines changed

javascript/ql/lib/semmle/javascript/dataflow/DataFlow.qll

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ module DataFlow {
11621162
}
11631163

11641164
/**
1165-
* A data flow node representing arguments of the `.apply` function call
1165+
* A data flow node representing arguments of the `.apply` function call
11661166
* to emulate a separate argument for each parameter of a reflective function call.
11671167
*/
11681168
private class ApplyArgumentNode extends DataFlow::Node {
@@ -1171,24 +1171,25 @@ module DataFlow {
11711171
int index;
11721172

11731173
ApplyArgumentNode() {
1174-
this = TApplyArgumentNode(
1175-
call.asExpr(),
1176-
call.getReceiver().getABoundFunctionValue(_).getFunction(),
1177-
index) and
1174+
this =
1175+
TApplyArgumentNode(call.asExpr(),
1176+
call.getReceiver().getABoundFunctionValue(_).getFunction(), index) and
11781177
arrayArgument = call.getArgument(1)
11791178
}
11801179

1181-
/**
1182-
* Gets an explicit call of the `.apply` function call
1183-
* that takes an argument represented by this data flow node.
1184-
* */
1180+
/**
1181+
* Gets an explicit call of the `.apply` function call
1182+
* that takes an argument represented by this data flow node.
1183+
*/
11851184
ExplicitMethodCallNode getCall() { result = call }
11861185

11871186
/** Gets an argument index represented by this data flow node. */
11881187
int getIndex() { result = index }
11891188

1190-
override string toString() { result = arrayArgument.toString() + "[" + index.toString() + "]" }
1191-
1189+
override string toString() {
1190+
result = arrayArgument.toString() + "[" + index.toString() + "]"
1191+
}
1192+
11921193
override predicate hasLocationInfo(
11931194
string filepath, int startline, int startcolumn, int endline, int endcolumn
11941195
) {
@@ -1199,7 +1200,7 @@ module DataFlow {
11991200
/**
12001201
* A data flow node representing a reflective function call.
12011202
*/
1202-
private abstract class ReflectiveCallNodeDef extends CallNodeDef {
1203+
abstract private class ReflectiveCallNodeDef extends CallNodeDef {
12031204
ExplicitMethodCallNode originalCall;
12041205

12051206
override InvokeExpr getInvokeExpr() { result = originalCall.getInvokeExpr() }
@@ -1224,17 +1225,13 @@ module DataFlow {
12241225
}
12251226

12261227
override DataFlow::Node getAnArgument() {
1227-
result = originalCall.getAnArgument() and
1228+
result = originalCall.getAnArgument() and
12281229
result != getReceiver()
12291230
}
12301231

1231-
override DataFlow::Node getASpreadArgument() {
1232-
result = originalCall.getASpreadArgument()
1233-
}
1232+
override DataFlow::Node getASpreadArgument() { result = originalCall.getASpreadArgument() }
12341233

1235-
override int getNumArgument() {
1236-
result >= 0 and result = originalCall.getNumArgument() - 1
1237-
}
1234+
override int getNumArgument() { result >= 0 and result = originalCall.getNumArgument() - 1 }
12381235
}
12391236

12401237
/**
@@ -1244,17 +1241,15 @@ module DataFlow {
12441241
ApplyReflectiveCallNodeDef() { this = TReflectiveCallNode(originalCall.asExpr(), "apply") }
12451242

12461243
ApplyArgumentNode getApplyArgument(int i) {
1247-
result.getCall() = originalCall and
1244+
result.getCall() = originalCall and
12481245
result.getIndex() = i
12491246
}
12501247

12511248
override DataFlow::Node getArgument(int i) { none() }
12521249

12531250
override DataFlow::Node getAnArgument() { none() }
12541251

1255-
override DataFlow::Node getASpreadArgument() {
1256-
result = originalCall.getArgument(1)
1257-
}
1252+
override DataFlow::Node getASpreadArgument() { result = originalCall.getArgument(1) }
12581253

12591254
override int getNumArgument() { none() }
12601255
}

javascript/ql/lib/semmle/javascript/dataflow/internal/DataFlowNode.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,4 @@ newtype TNode =
3232
TExceptionalInvocationReturnNode(InvokeExpr e) or
3333
TGlobalAccessPathRoot() or
3434
TTemplatePlaceholderTag(Templating::TemplatePlaceholderTag tag) or
35-
TApplyArgumentNode(MethodCallExpr ce, Function func, int i) {
36-
exists(func.getParameter(i))
37-
}
35+
TApplyArgumentNode(MethodCallExpr ce, Function func, int i) { exists(func.getParameter(i)) }

javascript/ql/lib/semmle/javascript/dataflow/internal/FlowSteps.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ private module CachedSteps {
204204
) {
205205
calls(invk, f) and
206206
(
207-
exists(int i | arg = invk.(DataFlow::InvokeNode).getArgument(i) or arg = invk.(DataFlow::Impl::ApplyReflectiveCallNodeDef).getApplyArgument(i) |
207+
exists(int i |
208+
arg = invk.(DataFlow::InvokeNode).getArgument(i) or
209+
arg = invk.(DataFlow::Impl::ApplyReflectiveCallNodeDef).getApplyArgument(i)
210+
|
208211
exists(Parameter p |
209212
f.getParameter(i) = p and
210213
not p.isRestParameter() and

javascript/ql/test/library-tests/Arrays/DataFlow.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ class ArrayFlowConfig extends DataFlow::Configuration {
1212

1313
from ArrayFlowConfig config, DataFlow::Node src, DataFlow::Node snk, string snk_file
1414
where config.hasFlow(src, snk) and snk_file = snk.getAstNode().getFile().getBaseName()
15-
select snk_file, snk, src
15+
select snk_file, snk, src

0 commit comments

Comments
 (0)