jendrikseipp / vulture

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

Pydantic false positive #289

Closed nosid91 closed 2 years ago

nosid91 commented 2 years ago

We often use Pydantic in our projects. There are several problems with Pydantic classes. 1)

src/employee/models.py:11: unused variable 'first_name' (60% confidence)
src/employee/models.py:12: unused variable 'middle_name' (60% confidence)
src/employee/models.py:13: unused variable 'last_name' (60% confidence)

for model:

    id: UUID4
    first_name: str
    middle_name: str
    last_name: str

2) It completely ignores Pydantic classes and does not check their usage. It only checks the variables from the example above

vulture 2.5

jendrikseipp commented 2 years ago

Thanks for the report! Since Vulture cannot detect that this code is actually used, I recommend adding the variables to a whitelist file (see README.md).