Skip to content

Commit eccc7d6

Browse files
committed
Ruby: Remove redundant .getExpr()
1 parent 717a355 commit eccc7d6

File tree

4 files changed

+3
-13
lines changed

4 files changed

+3
-13
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,7 @@ class CallNode extends LocalSourceNode, ExprNode {
118118
.asExpr()
119119
.(CfgNodes::ExprNodes::HashLiteralCfgNode)
120120
.getAKeyValuePair() and
121-
exprNode(pair.getKey())
122-
.getALocalSource()
123-
.asExpr()
124-
.getExpr()
125-
.getConstantValue()
126-
.isStringlikeValue(name) and
121+
exprNode(pair.getKey()).getALocalSource().asExpr().getConstantValue().isStringlikeValue(name) and
127122
result.asExpr() = pair.getValue()
128123
)
129124
}

ruby/ql/lib/codeql/ruby/frameworks/http_clients/Excon.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ class ExconHttpRequest extends HTTP::Client::Request::Range, DataFlow::CallNode
8787
.getArgument(0)
8888
.getALocalSource()
8989
.asExpr()
90-
.getExpr()
9190
.getConstantValue()
9291
.isStringlikeValue("ssl_verify_peer") and
9392
disablingNode = disableCall.getArgument(1) and

ruby/ql/lib/codeql/ruby/frameworks/http_clients/Faraday.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class FaradayHttpRequest extends HTTP::Client::Request::Range, DataFlow::CallNod
6565
exists(CfgNodes::ExprNodes::PairCfgNode p, DataFlow::Node key |
6666
p = sslValue.asExpr().(CfgNodes::ExprNodes::HashLiteralCfgNode).getAKeyValuePair() and
6767
key.asExpr() = p.getKey() and
68-
key.getALocalSource().asExpr().getExpr().getConstantValue().isStringlikeValue(argName) and
68+
key.getALocalSource().asExpr().getConstantValue().isStringlikeValue(argName) and
6969
result.asExpr() = p.getValue()
7070
)
7171
)

ruby/ql/lib/codeql/ruby/frameworks/http_clients/OpenURI.qll

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ class OpenUriKernelOpenRequest extends HTTP::Client::Request::Range, DataFlow::C
8686
optionsNode.flowsTo(this.getArgument(any(int i | i > 0))) and
8787
p = optionsNode.asExpr().(CfgNodes::ExprNodes::HashLiteralCfgNode).getAKeyValuePair() and
8888
key.asExpr() = p.getKey() and
89-
key.getALocalSource()
90-
.asExpr()
91-
.getExpr()
92-
.getConstantValue()
93-
.isStringlikeValue("ssl_verify_mode") and
89+
key.getALocalSource().asExpr().getConstantValue().isStringlikeValue("ssl_verify_mode") and
9490
result.asExpr() = p.getValue()
9591
)
9692
}

0 commit comments

Comments
 (0)