mirror of
https://github.com/github/codeql.git
synced 2026-01-11 05:30:24 +01:00
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
21 lines
532 B
Plaintext
21 lines
532 B
Plaintext
/**
|
|
* @name Unused exception object
|
|
* @description An exception object is created, but is not used.
|
|
* @kind problem
|
|
* @tags reliability
|
|
* maintainability
|
|
* @problem.severity error
|
|
* @sub-severity low
|
|
* @precision very-high
|
|
* @id py/unused-exception-object
|
|
*/
|
|
|
|
import python
|
|
|
|
from Call call, ClassValue ex
|
|
where
|
|
call.getFunc().pointsTo(ex) and
|
|
ex.getASuperType() = ClassValue::exception() and
|
|
exists(ExprStmt s | s.getValue() = call)
|
|
select call, "Instantiating an exception, but not raising it, has no effect"
|