mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Improve query help
This commit is contained in:
@@ -17,7 +17,11 @@ Consequently, it is not possible to suggest a general fix.</p>
|
||||
<example>
|
||||
<p>In this example, a <code>return</code> statement is used outside a class method in a class and
|
||||
a <code>yield</code> statement is used outside a function in a scope of a module which would result
|
||||
in a <code>SyntaxError</code> when running this code.</p>
|
||||
in a <code>SyntaxError</code> when running this code.
|
||||
|
||||
In this example, the invalid class could be corrected by placing the <code>return</code> statement
|
||||
in a class method, or by refactoring the class into a function. The invalid <code>yield</code> statement
|
||||
could become part of a new generator function containing the <code>for</code> loop.</p>
|
||||
<sample src="ReturnOrYieldOutsideFunction.py" />
|
||||
</example>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user