Skip to content

no_self_use fails to catch methods with empty bodies #6993

@scop

Description

@scop

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 #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

#6994

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions