Files
codeql/python/ql/test/library-tests/ControlFlow/PointsToSupport/UseFromDefinition.ql
2018-11-19 15:15:54 +00:00

23 lines
593 B
Plaintext

/**
* @name UseFromDefinition
* @description Insert description here...
* @kind problem
* @problem.severity warning
*/
import python
/*Find any Definition, assigned value pairs that 'valueForDefinition' misses */
Expr assignedValue(Name n) {
exists(Assign a | a.getATarget() = n and result = a.getValue())
or
exists(Alias a | a.getAsname() = n and result = a.getValue())
}
from Name def, DefinitionNode d
where d = def.getAFlowNode() and
exists(assignedValue(def)) and
not d.getValue().getNode() = assignedValue(def)
select def.toString(), assignedValue(def)