Ruby: address some review comments

This commit is contained in:
Asger F
2023-06-28 10:58:10 +02:00
parent f6e244995a
commit 174ab25867
4 changed files with 7 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
/**
* Provides an implementation of _API graphs_, which allow efficient modelling of how a given
* value is used the code base or how values produced by the code base are consumed by a library.
* value is used by the code base or how values produced by the code base are consumed by a library.
*
* See `API::Node` for more details.
*/
@@ -53,7 +53,7 @@ module API {
*
* The members predicates on this class generally take inheritance and data flow into account.
*
* The following example demonstrate a case where data flow was used to find the sink `x`:
* The following example demonstrates a case where data flow was used to find the sink `x`:
* ```ruby
* def doSomething f
* f.bar(x) # API::getTopLevelMember("Foo").getInstance().getMethod("bar").getArgument(0).asSink()
@@ -280,7 +280,6 @@ module API {
/**
* Gets an access to the constant `m` with this value as the base of the access.
*
* For example, the constant `A::B` would be found by `API::getATopLevelMember("A").getMember("B")`
* For example:
* ```ruby
* A::B # API::getATopLevelMember("A").getMember("B")
@@ -761,7 +760,7 @@ module API {
/**
* A node corresponding to an argument, right-hand side of a store, or return value from a callable.
*
* Such a node may serve as the starting-point of backtracking, and has epsilon edges going
* Such a node may serve as the starting-point of backtracking, and has epsilon edges going to
* the backward nodes corresponding to `getALocalSource`.
*/
private class SinkNode extends Node, Impl::MkSinkNode {
@@ -905,7 +904,7 @@ module API {
}
/**
* Holds if the epsilon `pred -> succ` be generated, to associate `mod` with its references in the codebase.
* Holds if the epsilon `pred -> succ` should be generated, to associate `mod` with its references in the codebase.
*/
bindingset[mod]
pragma[inline_late]

View File

@@ -419,7 +419,7 @@ private module Cached {
}
/**
* Gets a module for which this constant is the reference to an ancestor module.
* Gets a module for which `constRef` is the reference to an ancestor module.
*
* For example, `M` is the ancestry target of `C` in the following examples:
* ```rb
@@ -437,11 +437,10 @@ private module Cached {
private ModuleNode getAncestryTarget(ConstRef constRef) { result.getAnAncestorExpr() = constRef }
/**
* Gets a scope in which a constant lookup may access the contents of the module referenced by this constant.
* Gets a scope in which a constant lookup may access the contents of the module referenced by `constRef`.
*/
cached
TConstLookupScope getATargetScope(ConstRef constRef) {
forceCachingInSameStage() and
result = MkAncestorLookup(getAncestryTarget(constRef).getAnImmediateDescendent*())
or
constRef.asConstantAccess() = any(ConstantAccess ac).getScopeExpr() and

View File

@@ -128,7 +128,7 @@ class ActiveRecordModelClass extends ClassDeclaration {
)
}
/** Gets the class as a `DataFlow::ClasNode`. */
/** Gets the class as a `DataFlow::ClassNode`. */
DataFlow::ClassNode getClassNode() { result = cls }
}

View File

@@ -84,7 +84,6 @@ module ApiGraphShared<ApiGraphSharedSig S> {
pragma[noopt]
cached
predicate epsilonEdge(ApiNode pred, ApiNode succ) {
// forward
exists(
StepSummary summary, TypeTrackingNode predNode, TypeTracker predState,
TypeTrackingNode succNode, TypeTracker succState