Text of codeql.github.com › codeql-query-help › python › py-not-named-cls as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

First parameter of a class method is not named ‘cls’ — CodeQL query help documentation

CodeQL query help documentation » CodeQL query help for Python » First parameter of a class method is not named ‘cls’ ¶ ID: py/not-named-cls Kind: problem Security severity: Severity: recommendation Precision: high Tags: - maintainability - readability - convention - quality Query suites: - python-code-quality.qls - python-security-and-quality.qls Click to see the query in the CodeQL repository The first parameter of a class method (including certain special methods such as __new__ ), or a method of a metaclass, should be named cls .

Recommendation ¶ Ensure that the first parameter of class methods is named cls , as recommended by the style guidelines in PEP 8. Example ¶ In the following example, the first parameter of the class method make is named self instead of cls . class Entry ( object ): @classmethod def make ( self ): return Entry () References ¶ Python PEP 8: Function and method arguments . Python Tutorial: Classes . Python Docs: classmethod . © GitHub, Inc.

Terms Privacy