Skip to content

False positive for too-many-arguments in methods #8675

Open
@mbyrnepr2

Description

@mbyrnepr2

Bug description

As mentioned in merge-request 8674 comment, self is counted as one of the arguments in the too-many-arguments calculation.
This means that if a user creates a function with 5 parameters, the message is not emitted whereas if the user creates a method with the same 5 parameters, then the message will be emitted. This behaviour could be surprising.

No message emitted:

def name1(param1, param2, param3, param4, param5):
    ...

Message is emitted:

class A:
    def name2(self, param1, param2, param3, param4, param5):  # R0913: Too many arguments (6/5) (too-many-arguments)
        ...

Configuration

No response

Command used

pylint example.py

Pylint output

R0913: Too many arguments (6/5) (too-many-arguments)

Expected behavior

No message emitted for this example

Pylint version

pylint 3.0.0b1
astroid 3.0.0a2
Python 3.10.4

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions