Skip to content

Commit 8009dde

Browse files
authored
Merge pull request #20329 from michaelnebel/javascript/ql4ql
JS: Fix some Ql4Ql violations.
2 parents dd99a2d + 8b10ad4 commit 8009dde

File tree

17 files changed

+49
-49
lines changed

17 files changed

+49
-49
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ private import semmle.javascript.dataflow.internal.DataFlowPrivate
1717
*
1818
* - The relevant call sites cannot be matched by the access path syntax, and require the full power of CodeQL.
1919
* For example, complex overloading patterns might require more local reasoning at the call site.
20-
* - The input/output behaviour cannot be described statically in the access path syntax, but the relevant access paths
20+
* - The input/output behavior cannot be described statically in the access path syntax, but the relevant access paths
2121
* can be generated dynamically in CodeQL, based on the usages found in the codebase.
2222
*
23-
* Subclasses should bind `this` to a unique identifier for the function being modelled. There is no special
23+
* Subclasses should bind `this` to a unique identifier for the function being modeled. There is no special
2424
* interpreation of the `this` value, it should just not clash with the `this`-value used by other classes.
2525
*
2626
* For example, this models flow through calls such as `require("my-library").myFunction()`:

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

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -386,34 +386,35 @@ module MakeStateBarrierGuard<
386386
*/
387387
private class BarrierGuardFunction extends FinalFunction {
388388
DataFlow::ParameterNode sanitizedParameter;
389-
BarrierGuard guard;
390389
boolean guardOutcome;
391390
FlowState state;
392391
int paramIndex;
393392

394393
BarrierGuardFunction() {
395-
barrierGuardIsRelevant(guard) and
396-
exists(Expr e |
397-
exists(Expr returnExpr |
398-
returnExpr = guard.asExpr()
399-
or
400-
// ad hoc support for conjunctions:
401-
getALogicalAndParent(guard) = returnExpr and guardOutcome = true
402-
or
403-
// ad hoc support for disjunctions:
404-
getALogicalOrParent(guard) = returnExpr and guardOutcome = false
405-
|
406-
exists(SsaExplicitDefinition ssa |
407-
ssa.getDef().getSource() = returnExpr and
408-
ssa.getVariable().getAUse() = this.getAReturnedExpr()
409-
)
410-
or
411-
returnExpr = this.getAReturnedExpr()
394+
exists(BarrierGuard guard |
395+
barrierGuardIsRelevant(guard) and
396+
exists(Expr e |
397+
exists(Expr returnExpr |
398+
returnExpr = guard.asExpr()
399+
or
400+
// ad hoc support for conjunctions:
401+
getALogicalAndParent(guard) = returnExpr and guardOutcome = true
402+
or
403+
// ad hoc support for disjunctions:
404+
getALogicalOrParent(guard) = returnExpr and guardOutcome = false
405+
|
406+
exists(SsaExplicitDefinition ssa |
407+
ssa.getDef().getSource() = returnExpr and
408+
ssa.getVariable().getAUse() = this.getAReturnedExpr()
409+
)
410+
or
411+
returnExpr = this.getAReturnedExpr()
412+
) and
413+
sanitizedParameter.flowsToExpr(e) and
414+
barrierGuardBlocksExpr(guard, guardOutcome, e, state)
412415
) and
413-
sanitizedParameter.flowsToExpr(e) and
414-
barrierGuardBlocksExpr(guard, guardOutcome, e, state)
415-
) and
416-
sanitizedParameter.getParameter() = this.getParameter(paramIndex)
416+
sanitizedParameter.getParameter() = this.getParameter(paramIndex)
417+
)
417418
}
418419

419420
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ predicate neverSkipInPathGraph(Node node) {
674674
// Include the return-value expression
675675
node.asExpr() = any(Function f).getAReturnedExpr()
676676
or
677-
// Include calls (which may have been modelled as steps)
677+
// Include calls (which may have been modeled as steps)
678678
node.asExpr() instanceof InvokeExpr
679679
or
680680
// Include references to a variable
@@ -1103,7 +1103,7 @@ private predicate legacyBarrier(DataFlow::Node node) {
11031103
pragma[nomagic]
11041104
private predicate isBlockedLegacyNode(Node node) {
11051105
// Ignore captured variable nodes for those variables that are handled by the captured-variable library.
1106-
// Note that some variables, such as top-level variables, are still modelled with these nodes (which will result in jump steps).
1106+
// Note that some variables, such as top-level variables, are still modeled with these nodes (which will result in jump steps).
11071107
exists(LocalVariable variable |
11081108
node = TCapturedVariableNode(variable) and
11091109
variable = any(VariableCaptureConfig::CapturedVariable v).asLocalVariable()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ module VariableCaptureConfig implements InputSig<js::Location, js::Cfg::BasicBlo
170170

171171
predicate hasCfgNode(js::Cfg::BasicBlock bb, int i) { none() } // Overridden in subclass
172172

173-
// note: langauge-specific
173+
// note: language-specific
174174
js::DataFlow::Node getSource() { none() } // Overridden in subclass
175175
}
176176

javascript/ql/lib/semmle/javascript/frameworks/Babel.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,17 @@ module Babel {
141141
*/
142142
deprecated private class BabelRootTransformedPathExpr extends PathExpr, Expr {
143143
RootImportConfig plugin;
144-
string prefix;
145144
string mappedPrefix;
146145
string suffix;
147146

148147
BabelRootTransformedPathExpr() {
149148
this instanceof PathExpr and
150149
plugin.appliesTo(this.getTopLevel()) and
151-
prefix = this.getStringValue().regexpCapture("(.)/(.*)", 1) and
152150
suffix = this.getStringValue().regexpCapture("(.)/(.*)", 2) and
153-
mappedPrefix = plugin.getRoot(prefix)
151+
exists(string prefix |
152+
prefix = this.getStringValue().regexpCapture("(.)/(.*)", 1) and
153+
mappedPrefix = plugin.getRoot(prefix)
154+
)
154155
}
155156

156157
/** Gets the configuration that applies to this path. */

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsSpecific.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Location = JS::Location;
3535
* Type names have form `package.type` or just `package` if referring to the package export
3636
* object. If `package` contains a `.` character it must be enclosed in single quotes, such as `'package'.type`.
3737
*
38-
* A type name of form `(package)` may also be used when refering to the package export object.
38+
* A type name of form `(package)` may also be used when referring to the package export object.
3939
* We allow this syntax as an alternative to the above, so models generated based on `EndpointNaming` look more consistent.
4040
* However, access paths are deliberately not parsed here, as we can not handle aliasing at this stage.
4141
* The model generator must explicitly generate the step between `(package)` and `(package).foo`, for example.

javascript/ql/lib/semmle/javascript/internal/flow_summaries/Arrays.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Contains a summary for relevant methods on arrays.
33
*
4-
* Note that some of Array methods are modelled in `AmbiguousCoreMethods.qll`, and `toString` is special-cased elsewhere.
4+
* Note that some of Array methods are modeled in `AmbiguousCoreMethods.qll`, and `toString` is special-cased elsewhere.
55
*/
66

77
private import javascript
@@ -60,7 +60,7 @@ private predicate isForLoopVariable(Variable v) {
6060

6161
private predicate isLikelyArrayIndex(Expr e) {
6262
// Require that 'e' is of type number and refers to a for-loop variable.
63-
// TODO: This is here to mirror the old behaviour. Experiment with turning the 'and' into an 'or'.
63+
// TODO: This is here to mirror the old behavior. Experiment with turning the 'and' into an 'or'.
6464
TTNumber() = unique(InferredType type | type = e.flow().analyze().getAType()) and
6565
isForLoopVariable(e.(VarAccess).getVariable())
6666
or
@@ -114,7 +114,7 @@ class ArrayConstructorSummary extends SummarizedCallable {
114114
/**
115115
* A call to `join` with a separator argument.
116116
*
117-
* Calls without separators are modelled in `StringConcatenation.qll`.
117+
* Calls without separators are modeled in `StringConcatenation.qll`.
118118
*/
119119
class Join extends SummarizedCallable {
120120
Join() { this = "Array#join" }

javascript/ql/lib/semmle/javascript/internal/flow_summaries/AsyncAwait.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ private import semmle.javascript.dataflow.internal.AdditionalFlowInternal
88
private import semmle.javascript.dataflow.internal.DataFlowPrivate
99

1010
/**
11-
* Steps modelling flow in an `async` function.
11+
* Steps modeling flow in an `async` function.
1212
*
1313
* Note about promise-coercion and flattening:
1414
* - `await` preserves non-promise values, e.g. `await "foo"` is just `"foo"`.

javascript/ql/lib/semmle/javascript/internal/flow_summaries/Generators.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ private import semmle.javascript.dataflow.internal.DataFlowNode
77
private import semmle.javascript.dataflow.internal.AdditionalFlowInternal
88

99
/**
10-
* Steps modelling flow out of a generator function:
10+
* Steps modeling flow out of a generator function:
1111
* ```js
1212
* function* foo() {
1313
* yield x; // store 'x' in the return value's IteratorElement

javascript/ql/lib/semmle/javascript/internal/flow_summaries/Iterators.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Contains flow summaries and steps modelling flow through iterators.
2+
* Contains flow summaries and steps modeling flow through iterators.
33
*/
44

55
private import javascript

0 commit comments

Comments
 (0)