mirror of
https://github.com/github/codeql.git
synced 2026-05-14 19:29:28 +02:00
Python: Port ConsistentReturns.ql
No test changes.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
private import semmle.python.dataflow.new.internal.DataFlowDispatch
|
||||
|
||||
predicate explicitly_returns_non_none(Function func) {
|
||||
exists(Return return |
|
||||
@@ -22,8 +22,8 @@ predicate explicitly_returns_non_none(Function func) {
|
||||
}
|
||||
|
||||
predicate has_implicit_return(Function func) {
|
||||
exists(ControlFlowNodeWithPointsTo fallthru |
|
||||
fallthru = func.getFallthroughNode() and not fallthru.unlikelyReachable()
|
||||
exists(ControlFlowNode fallthru |
|
||||
fallthru = func.getFallthroughNode() and not Reachability::unlikelyReachable(fallthru)
|
||||
)
|
||||
or
|
||||
exists(Return return | return.getScope() = func and not exists(return.getValue()))
|
||||
|
||||
Reference in New Issue
Block a user