mirror of
https://github.com/github/codeql.git
synced 2025-12-26 13:46:31 +01:00
The Python 3 FAQ states that this is the right thing [0] It sadly doesn't align 100% with PEP8, which calls them for "arguments" [1], but after discussion with Taus, we decided to go with "parameter" everywhere to be consistent. [0] https://docs.python.org/3/faq/programming.html#faq-argument-vs-parameter [1] https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments
36 lines
921 B
XML
36 lines
921 B
XML
<!DOCTYPE qhelp PUBLIC
|
|
"-//Semmle//qhelp//EN"
|
|
"qhelp.dtd">
|
|
<qhelp>
|
|
|
|
|
|
<overview>
|
|
<p> The first parameter of a class method, a new method or any metaclass method
|
|
should be called <code>cls</code>. This makes the purpose of the parameter clear to other developers.
|
|
</p>
|
|
|
|
</overview>
|
|
<recommendation>
|
|
|
|
<p>Change the name of the first parameter to <code>cls</code> as recommended by the style guidelines
|
|
in PEP 8.</p>
|
|
|
|
</recommendation>
|
|
<example>
|
|
<p>In the example, the first parameter to <code>make()</code> is <code>klass</code> which should be changed to <code>cls</code>
|
|
for ease of comprehension.
|
|
</p>
|
|
|
|
<sample src="NonCls.py" />
|
|
|
|
|
|
</example>
|
|
<references>
|
|
|
|
<li>Python PEP 8: <a href="http://www.python.org/dev/peps/pep-0008/#function-and-method-arguments">Function and method arguments</a>.</li>
|
|
<li>Python Tutorial: <a href="http://docs.python.org/2/tutorial/classes.html">Classes</a>.</li>
|
|
|
|
|
|
</references>
|
|
</qhelp>
|