mirror of
https://github.com/github/codeql.git
synced 2026-07-04 19:15:29 +02:00
Excluded for now: unnecassary-delete; since the pattern is often intentional to break reference cycles, which the query doesn't account for; so uncertain about its claim of high precision
25 lines
683 B
Plaintext
25 lines
683 B
Plaintext
/**
|
|
* @name Comparison of constants
|
|
* @description Comparison of constants is always constant, but is harder to read than a simple constant.
|
|
* @kind problem
|
|
* @tags quality
|
|
* maintainability
|
|
* useless-code
|
|
* external/cwe/cwe-570
|
|
* external/cwe/cwe-571
|
|
* @problem.severity warning
|
|
* @sub-severity low
|
|
* @precision very-high
|
|
* @id py/comparison-of-constants
|
|
*/
|
|
|
|
import python
|
|
|
|
from Compare comparison, Expr left, Expr right
|
|
where
|
|
comparison.compares(left, _, right) and
|
|
left.isConstant() and
|
|
right.isConstant() and
|
|
not exists(Assert a | a.getTest() = comparison)
|
|
select comparison, "Comparison of constants; use 'True' or 'False' instead."
|