Rename files by style guide and change query metadata

This commit is contained in:
alexey
2019-05-29 15:35:58 +01:00
parent 96380f6767
commit 86ec047be2
8 changed files with 28 additions and 19 deletions

View File

@@ -1,8 +1,8 @@
# invalid class with return outside of a function
# invalid class with return outside a function
class InvalidClass1(object):
if [1, 2, 3]:
return "Exists"
# invalid statement with yield outside of a function
# invalid statement with yield outside a function
for i in [1, 2, 3]:
yield i

View File

@@ -18,7 +18,7 @@ Consequently, it is not possible to suggest a general fix.</p>
<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>
<sample src="ReturnOrYieldOutsideOfFunction.py" />
<sample src="ReturnOrYieldOutsideFunction.py" />
</example>
<references>

View File

@@ -1,13 +1,13 @@
/**
* @name Using 'return' or 'yield' outside a function causes a 'SyntaxError' at runtime
* @description Statements 'return' and 'yield' should be used only within a function.
* @name Use of 'return' or 'yield' outside a function
* @description Using 'return' or 'yield' outside a function causes a 'SyntaxError' at runtime.
* @kind problem
* @tags reliability
* correctness
* @problem.severity error
* @sub-severity low
* @precision very-high
* @id py/return-or-yield-outside-of-function
* @precision medium
* @id py/return-or-yield-outside-function
*/
import python
@@ -22,4 +22,4 @@ where
or
node instanceof YieldFrom and kind = "yield from"
)
select node, "'" + kind + "' is used outside of a function."
select node, "'" + kind + "' is used outside a function."