Skip to content

Commit 174ab25

Browse files
committed
Ruby: address some review comments
1 parent f6e2449 commit 174ab25

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

ruby/ql/lib/codeql/ruby/ApiGraphs.qll

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Provides an implementation of _API graphs_, which allow efficient modelling of how a given
3-
* value is used the code base or how values produced by the code base are consumed by a library.
3+
* value is used by the code base or how values produced by the code base are consumed by a library.
44
*
55
* See `API::Node` for more details.
66
*/
@@ -53,7 +53,7 @@ module API {
5353
*
5454
* The members predicates on this class generally take inheritance and data flow into account.
5555
*
56-
* The following example demonstrate a case where data flow was used to find the sink `x`:
56+
* The following example demonstrates a case where data flow was used to find the sink `x`:
5757
* ```ruby
5858
* def doSomething f
5959
* f.bar(x) # API::getTopLevelMember("Foo").getInstance().getMethod("bar").getArgument(0).asSink()
@@ -280,7 +280,6 @@ module API {
280280
/**
281281
* Gets an access to the constant `m` with this value as the base of the access.
282282
*
283-
* For example, the constant `A::B` would be found by `API::getATopLevelMember("A").getMember("B")`
284283
* For example:
285284
* ```ruby
286285
* A::B # API::getATopLevelMember("A").getMember("B")
@@ -761,7 +760,7 @@ module API {
761760
/**
762761
* A node corresponding to an argument, right-hand side of a store, or return value from a callable.
763762
*
764-
* Such a node may serve as the starting-point of backtracking, and has epsilon edges going
763+
* Such a node may serve as the starting-point of backtracking, and has epsilon edges going to
765764
* the backward nodes corresponding to `getALocalSource`.
766765
*/
767766
private class SinkNode extends Node, Impl::MkSinkNode {
@@ -905,7 +904,7 @@ module API {
905904
}
906905

907906
/**
908-
* Holds if the epsilon `pred -> succ` be generated, to associate `mod` with its references in the codebase.
907+
* Holds if the epsilon `pred -> succ` should be generated, to associate `mod` with its references in the codebase.
909908
*/
910909
bindingset[mod]
911910
pragma[inline_late]

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPublic.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ private module Cached {
419419
}
420420

421421
/**
422-
* Gets a module for which this constant is the reference to an ancestor module.
422+
* Gets a module for which `constRef` is the reference to an ancestor module.
423423
*
424424
* For example, `M` is the ancestry target of `C` in the following examples:
425425
* ```rb
@@ -437,11 +437,10 @@ private module Cached {
437437
private ModuleNode getAncestryTarget(ConstRef constRef) { result.getAnAncestorExpr() = constRef }
438438

439439
/**
440-
* Gets a scope in which a constant lookup may access the contents of the module referenced by this constant.
440+
* Gets a scope in which a constant lookup may access the contents of the module referenced by `constRef`.
441441
*/
442442
cached
443443
TConstLookupScope getATargetScope(ConstRef constRef) {
444-
forceCachingInSameStage() and
445444
result = MkAncestorLookup(getAncestryTarget(constRef).getAnImmediateDescendent*())
446445
or
447446
constRef.asConstantAccess() = any(ConstantAccess ac).getScopeExpr() and

ruby/ql/lib/codeql/ruby/frameworks/ActiveRecord.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class ActiveRecordModelClass extends ClassDeclaration {
128128
)
129129
}
130130

131-
/** Gets the class as a `DataFlow::ClasNode`. */
131+
/** Gets the class as a `DataFlow::ClassNode`. */
132132
DataFlow::ClassNode getClassNode() { result = cls }
133133
}
134134

ruby/ql/lib/codeql/ruby/typetracking/ApiGraphShared.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ module ApiGraphShared<ApiGraphSharedSig S> {
8484
pragma[noopt]
8585
cached
8686
predicate epsilonEdge(ApiNode pred, ApiNode succ) {
87-
// forward
8887
exists(
8988
StepSummary summary, TypeTrackingNode predNode, TypeTracker predState,
9089
TypeTrackingNode succNode, TypeTracker succState

0 commit comments

Comments
 (0)