Vulture ignore rules for Pydantic
I've written about before, and how it can have lots of false positives for unused code. One place where it is especially annoying is with decorators. I had this problem just now with Pydantic validators, and I found out that vulture has a setting for ignoring specific decorators. Neat!
Here is are some pyproject.toml rules to make vulture ignore Pydantic decorators and variables:
# pyproject.toml
[tool.vulture]
ignore_decorators = [
"@field_validator",
"@model_validator",
]
ignore_names = [
"model_config",
"cls",
"schema_version"
]
exclude = [".venv/"]
Please add comments if you know of other good ignore rules for Pydantic.