mirror of
https://github.com/github/codeql.git
synced 2025-12-19 10:23:15 +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.
26 lines
650 B
Plaintext
26 lines
650 B
Plaintext
/**
|
|
* @name Illegal raise
|
|
* @description Raising a non-exception object or type will result in a TypeError being raised instead.
|
|
* @kind problem
|
|
* @tags reliability
|
|
* correctness
|
|
* types
|
|
* @problem.severity error
|
|
* @sub-severity high
|
|
* @precision very-high
|
|
* @id py/illegal-raise
|
|
*/
|
|
|
|
import python
|
|
import Raising
|
|
import Exceptions.NotImplemented
|
|
|
|
from Raise r, ClassValue t
|
|
where
|
|
type_or_typeof(r, t, _) and
|
|
not t.isLegalExceptionType() and
|
|
not t.failedInference(_) and
|
|
not use_of_not_implemented_in_raise(r, _)
|
|
select r,
|
|
"Illegal class '" + t.getName() + "' raised; will result in a TypeError being raised instead."
|