mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Initial commit of Python queries and QL libraries.
This commit is contained in:
committed by
Mark Shannon
parent
90c75cd362
commit
5f58824d1b
34
python/ql/src/Variables/UnusedModuleVariable.qhelp
Normal file
34
python/ql/src/Variables/UnusedModuleVariable.qhelp
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE qhelp PUBLIC
|
||||
"-//Semmle//qhelp//EN"
|
||||
"qhelp.dtd">
|
||||
<qhelp>
|
||||
|
||||
<overview>
|
||||
<p> A global (module-level) variable is defined (by an assignment) but never used
|
||||
and is not explicitly made public by inclusion in the <code>__all__</code> list.
|
||||
</p>
|
||||
|
||||
<include src="UnusedVariableNaming.qhelp" />
|
||||
<include src="UnusedTuple.qhelp" />
|
||||
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>If the variable is included for documentation purposes or is otherwise intentionally unused, then change its name to indicate that it is unused,
|
||||
otherwise delete the assignment (taking care not to delete right hand side if it has side effects).</p>
|
||||
|
||||
</recommendation>
|
||||
<example>
|
||||
<p>In this example, the <code>random_no</code> variable is never read but its assignment
|
||||
has a side effect. Because of this it is important to only remove the left hand side of the
|
||||
assignment in line 9.</p>
|
||||
<sample src="UnusedModuleVariable.py" />
|
||||
|
||||
</example>
|
||||
<references>
|
||||
|
||||
<li>Python: <a href="http://docs.python.org/reference/simple_stmts.html#assignment-statements">Assignment statements</a>,
|
||||
<a href="http://docs.python.org/reference/simple_stmts.html#the-import-statement">The import statement</a>.</li>
|
||||
<li>Python Tutorial: <a href="http://docs.python.org/2/tutorial/modules.html#importing-from-a-package">Importing * from a package</a>.</li>
|
||||
|
||||
</references>
|
||||
</qhelp>
|
||||
Reference in New Issue
Block a user