Inconsistent block starting line behaviour for classes #10199
Open
Description
Bug description
"""
docstring
"""
class FOO: # pylint: disable=invalid-name
"""
docstring
"""
def camelCase(self):
"docstring"
return
def good_function(self):
"docstring"
return
class BAR(FOO): # pylint: disable=invalid-name
"""
docstring
"""
def camelCase2(self):
"docstring"
return
def good_function2(self):
"docstring"
return
Configuration
Command used
pylint a.py
Pylint output
************* Module test_pylint
test_pylint.py:23:4: C0103: Method name "camelCase2" doesn't conform to snake_case naming style (invalid-name)
Expected behavior
It is surprising for me that the invalid name is only outputted for the method BAR.camelCase2 and not for method FOO.camelCase. From the documentation I read
If the violation occurs on a block starting line, then it applies only to that line
and so I would expect that the disable=invalid-name statements only apply to the single lines where the classes are defined and not to the whole block of the class.
Pylint version
pylint 3.3.3
astroid 3.3.8
Python 3.13.1 (main, Jan 14 2025, 22:47:35) [MSC v.1942 64 bit (AMD64)]
OS / Environment
No response
Additional dependencies
astroid==3.3.8
colorama==0.4.6
dill==0.3.9
isort==5.13.2
mccabe==0.7.0
platformdirs==4.3.6
pylint==3.3.3
tomlkit==0.13.2