pylint icon indicating copy to clipboard operation
pylint copied to clipboard

no_self_use fails to catch methods with empty bodies

Open scop opened this issue 3 years ago • 0 comments

Bug description

no_self_use does not catch methods that have empty bodies (just a docstring or a pass)

Configuration

No response

Command used

With the test cases from https://github.com/PyCQA/pylint/pull/6994 added:

pytest tests/test_functional.py::test_functional[no_self_use]

Pylint output

____________________________________________________ test_functional[no_self_use] ____________________________________________________

self = <pylint.testutils.lint_module_test.LintModuleTest object at 0x7f13d49a0910>

    def runTest(self) -> None:
>       self._runTest()
E       AssertionError: Wrong results for file "no_self_use":
E       
E       Expected in testdata:
E         29: no-self-use
E         34: no-self-use

pylint/testutils/lint_module_test.py:145: AssertionError

Expected behavior

No errors.

Pylint version

pylint 2.15.0-dev0
astroid 2.11.6
Python 3.10.0 (default, Oct  8 2021, 12:02:33) [GCC 9.3.0]

OS / Environment

No response

Additional dependencies

https://github.com/PyCQA/pylint/pull/6994

scop avatar Jun 21 '22 08:06 scop