Files
codeql/python/ql/src/Expressions/EqualsNone.ql
2018-11-19 15:10:42 +00:00

18 lines
489 B
Plaintext

/**
* @name Testing equality to None
* @description Testing whether an object is 'None' using the == operator is inefficient and potentially incorrect.
* @kind problem
* @tags efficiency
* maintainability
* @problem.severity recommendation
* @sub-severity high
* @precision very-high
* @id py/test-equals-none
*/
import python
from Compare c
where c.getOp(0) instanceof Eq and c.getAComparator() instanceof None
select c, "Testing for None should use the 'is' operator."