jendrikseipp / vulture

Find dead Python code
MIT License
3.38k stars 148 forks source link

Whitelist parameter of specific function #287

Closed VakarisZ closed 2 years ago

VakarisZ commented 2 years ago

I have a vulture complaint:

C:\Users\vzilius\Desktop\infection_monkey\monkey\common\utils\IJSONSerializable.py:9: unused variable 'json_string' (100% confidence)

The method looks like:

class IJSONSerializable(ABC):
    @classmethod
    @abstractmethod
    def from_json(cls, json_string: str) -> IJSONSerializable:
        pass

The method is an abstract class method, thus it doesn't use the variable. Is there a way to whitelist this parameter without 1. changing the code 2. whitelisting everything that's json_string? Couldn't find anything in the documentation or examples, except "rename the parameter to _json_string".

jendrikseipp commented 2 years ago

For this specific example, I'd replace pass by del json_string (see README).

jendrikseipp commented 2 years ago

I don't think there's a solution that satisfies both 1. and 2. at the same time.