ruff icon indicating copy to clipboard operation
ruff copied to clipboard

ARG003 does not seem to respect Protocols

Open harahu opened this issue 4 months ago • 3 comments

The ruff ruleARG003: unused-class-method-argument does not seem to understand that unused arguments sometimes are necessary in order to implement a protocol. See example below:

from abc import abstractmethod
from typing import Protocol


class A(Protocol):
    @classmethod
    @abstractmethod
    def foo(cls, bar: str) -> str:
        raise NotImplementedError


class B(A):
    @classmethod
    def foo(cls, bar: object) -> str:
        return "foo"

https://play.ruff.rs/204c57b4-a35e-48d5-8f92-ca2e109dd2cd

This problem appears in ruff 0.6.9

harahu avatar Oct 08 '24 10:10 harahu