Files
codeql/python/ql/src/Functions/InitIsGenerator.ql
Rasmus Wriedt Larsen 3fe715abb6 Python: Fix query names that inclde __ (dunder)
Without backticks, the text UNDERSCORE UNDERSCORE eq UNDERSCORE UNDERSCORE would
be considered to make things bold in our markdown output, making the query info
look strange.

Example https://codeql.github.com/codeql-query-help/python/py-slots-in-old-style-class/
2021-02-04 15:49:37 +01:00

20 lines
452 B
Plaintext

/**
* @name `__init__` method is a generator
* @description `__init__` method is a generator.
* @kind problem
* @tags reliability
* correctness
* @problem.severity error
* @sub-severity low
* @precision very-high
* @id py/init-method-is-generator
*/
import python
from Function f
where
f.isInitMethod() and
(exists(Yield y | y.getScope() = f) or exists(YieldFrom y | y.getScope() = f))
select f, "__init__ method is a generator."