Javascript: Autoformat qls

This commit is contained in:
Anders Schack-Mulligen
2019-02-12 14:29:19 +01:00
parent 25469637db
commit 1182fca665
19 changed files with 39 additions and 45 deletions

View File

@@ -134,9 +134,7 @@ where
isCompatibleRequestedService(request, compatibleKind) and
not isWildcardKind(compatibleKind)
|
"'" + compatibleKind + "'", ", "
order by
compatibleKind
"'" + compatibleKind + "'", ", " order by compatibleKind
).regexpReplaceAll(",(?=[^,]+$)", " or") and
(
isServiceDirectiveOrFilterFunction(request) and

View File

@@ -137,9 +137,7 @@ string pathToModule(Module source, Module destination, int steps) {
isImportedAtRuntime(source, mod) and
numberOfStepsToModule(mod, destination, steps - 1)
|
mod
order by
mod.getName()
mod order by mod.getName()
) and
result = repr(getARuntimeImport(source, next)) + " => " +
pathToModule(next, destination, steps - 1)

View File

@@ -18,8 +18,8 @@ private predicate isBoundInMethod(MethodDeclaration method) {
bindingMethod.getDeclaringClass() = method.getDeclaringClass() and
not bindingMethod.isStatic() and
thiz.getBinder().getAstNode() = bindingMethod.getBody()
|
exists (DataFlow::MethodCallNode bind, DataFlow::PropWrite w |
|
exists(DataFlow::MethodCallNode bind, DataFlow::PropWrite w |
// this[x] = <expr>.bind(...)
w = thiz.getAPropertyWrite() and
not exists(w.getPropertyName()) and

View File

@@ -38,9 +38,7 @@ Function getALikelyCallee(DataFlow::InvokeNode cs, boolean isNew) {
result = min(Function callee, int imprecision |
callee = cs.getACallee(imprecision)
|
callee
order by
imprecision
callee order by imprecision
) and
not cs.isUncertain() and
not whitelistedCall(cs) and
@@ -89,9 +87,7 @@ DataFlow::InvokeNode getFirstInvocation(Function f, boolean isNew) {
result = min(DataFlow::InvokeNode invk, string path, int line, int col |
f = getALikelyCallee(invk, isNew) and invk.hasLocationInfo(path, line, col, _, _)
|
invk
order by
path, line, col
invk order by path, line, col
)
}

View File

@@ -21,9 +21,7 @@ predicate constantInCharacterClass(RegExpCharacterClass recc, int i, RegExpConst
cc = rank[i](RegExpConstant cc2, int j |
cc2 = recc.getChild(j) and cc2.isCharacter() and cc2.getValue() = val
|
cc2
order by
j
cc2 order by j
)
}

View File

@@ -59,9 +59,7 @@ predicate regExpMatchesString(RegExpTerm t, string s) {
s = concat(int i, RegExpTerm child |
child = seq.getChild(i)
|
any(string subs | regExpMatchesString(child, subs))
order by
i
any(string subs | regExpMatchesString(child, subs)) order by i
)
)
}

View File

@@ -36,9 +36,7 @@ string getStringValue(RegExpLiteral rl) {
result = strictconcat(RegExpTerm ch, int i |
ch = root.(RegExpSequence).getChild(i)
|
ch.(RegExpConstant).getValue()
order by
i
ch.(RegExpConstant).getValue() order by i
)
)
}

View File

@@ -26,16 +26,16 @@ predicate isThrowOrReturn(Stmt s) {
/**
* A `return` statement with an operand (that is, not just `return;`).
*/
class ValueReturn extends ReturnStmt { ValueReturn() { exists(getExpr()) } }
class ValueReturn extends ReturnStmt {
ValueReturn() { exists(getExpr()) }
}
/** Gets the lexically first explicit return statement in function `f`. */
ValueReturn getFirstExplicitReturn(Function f) {
result = min(ValueReturn ret |
ret.getContainer() = f
|
ret
order by
ret.getLocation().getStartLine(), ret.getLocation().getStartColumn()
ret order by ret.getLocation().getStartLine(), ret.getLocation().getStartColumn()
)
}

View File

@@ -81,7 +81,7 @@ predicate isConstantBooleanReturnValue(Expr e) {
ssa.getVariable().getAUse() = e
)
)
|
|
ret.(BooleanLiteral).getValue() = b
)
)

View File

@@ -12,8 +12,10 @@
import javascript
from Vue::Instance instance, DataFlow::Node def, DataFlow::FunctionNode arrow, ThisExpr dis
where instance.getABoundFunction() = def and
arrow.flowsTo(def) and
arrow.asExpr() instanceof ArrowFunctionExpr and
arrow.asExpr() = dis.getEnclosingFunction()
select def, "The $@ of this $@ it will not be bound to the Vue instance.", dis, "`this` variable", arrow, "arrow function"
where
instance.getABoundFunction() = def and
arrow.flowsTo(def) and
arrow.asExpr() instanceof ArrowFunctionExpr and
arrow.asExpr() = dis.getEnclosingFunction()
select def, "The $@ of this $@ it will not be bound to the Vue instance.", dis, "`this` variable",
arrow, "arrow function"