Files
codeql/python/ql/src/Variables/UndefinedPlaceHolder.qhelp
2018-11-19 15:10:42 +00:00

30 lines
915 B
XML

<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This place-holder variable may not be defined.
If this code is executed and the variable is undefined then a <code>NameError</code> will occur.
</p>
</overview>
<recommendation>
<p>Check that the name of the place-holder variable is not a typographic error.
If the name is correct, either define a value for the variable, or import the module that defines the function or method that sets the value.
</p>
<p>If another module initializes this variable before it is used, then the <code>NameError</code> may not occur.
However, you can make the code more robust and clearer by setting the variable to a default value in its own module.
</p>
</recommendation>
<references>
<li>Python Standard Library: <a href="https://docs.python.org/library/exceptions.html#exceptions.NameError">NameError</a>.</li>
</references>
</qhelp>