Description
Bug description
From what I'm assuming is a typo in class_checker.py
, the default value of valid-metaclass-classmethod-first-arg
is cls
instead of mcs
. All documentation (readthedocs, function docstrings) points to the default being mcs
.
bad-mcs-classmethod-argument
is raised here with no other configuration:
# pylint: disable=C
# pylint: enable=bad-mcs-classmethod-argument
class MetaClass(type):
@classmethod
def example(mcs) -> None:
...
The default of ("cls",)
is defined here:
https://github.com/PyCQA/pylint/blob/e44eec69560febea194b31c3c7a16260a9e1da1b/pylint/checkers/classes/class_checker.py#L793-L800
Configuration workaround:
[tool.pylint.'CLASSES']
valid-metaclass-classmethod-first-arg = ["mcs",]
I am willing to submit a PR if preferred.
Configuration
No response
Command used
pylint foo.py
Pylint output
************* Module foo
foo.py:7:4: C0204: Metaclass class method example should have 'cls' as first argument (bad-mcs-classmethod-argument)
Expected behavior
As defined in https://pylint.pycqa.org/en/latest/user_guide/messages/convention/bad-mcs-classmethod-argument.html,
the default value for valid-metaclass-classmethod-first-arg
should be mcs
.
Pylint version
pylint 2.15.5
astroid 2.12.12
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]
OS / Environment
Windows 10
Additional dependencies
No response