Skip to content

arguments-differ is triggered if just arg names changed #3536

@socketpair

Description

@socketpair
class fruit:
    def _do_actions(self, fruit_name: str):
        pass

class orange(fruit):
    def _do_actions(self, orange_name: str):   # will trigger arguments-differ
        pass

I think we should differentiate errors:

  1. arguments-differ if something changed except the names (i.e., number of args, their types, or args become kwargs, or so.).
  2. a new error: arguments-renamed should be raised only if a name was changed.

But arguments changed in a way that old arguments change their positions (i.e. swapped) arguments-differ should be raise anyway:

class fruit:
    def xxx(self, a: str, b: str):
        pass

class orange(fruit):
    def xxx(self, b: str, a:str):   # MUST trigger arguments-differ
        pass

Rationale:
If I just add # pylint: disable=arguments-differ it would hide other arguments-related errors in this line. As a workaround I can write something like:

class orange(fruit):
    def _do_actions(self, fruit_name: str):   # will trigger arguments-differ
        super()._do_actions(fruit_name)
        orange_name = fruit_name
        # use orange_name in the code.

but this is slightly stupid. I would not like to do such a trick just to silence the linter.

Metadata

Metadata

Assignees

Labels

CheckersRelated to a checkerEnhancement ✨Improvement to a componentGood first issueFriendly and approachable by new contributorsHelp wanted 🙏Outside help would be appreciated, good for new contributors

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions