mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
Move 'snippet' queries to 'snippets' folders
This commit is contained in:
19
python/ql/examples/snippets/raise_exception.ql
Normal file
19
python/ql/examples/snippets/raise_exception.ql
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @name Raise exception of a class
|
||||
* @description Finds places where we raise AnException or one of its subclasses
|
||||
* @tags throw
|
||||
* raise
|
||||
* exception
|
||||
*/
|
||||
|
||||
import python
|
||||
|
||||
from Raise raise, ClassObject ex
|
||||
where
|
||||
ex.getName() = "AnException" and
|
||||
(
|
||||
raise.getException().refersTo(ex.getAnImproperSuperType())
|
||||
or
|
||||
raise.getException().refersTo(_, ex.getAnImproperSuperType(), _)
|
||||
)
|
||||
select raise, "Don't raise instances of 'AnException'"
|
||||
Reference in New Issue
Block a user