Your `exclude: ^generated/` only matches if the file path *starts* with `generated/`. To exclude any `generated` folder at any depth, use:
```yaml
exclude: (^|/)generated/
Test it with-->pre-commit run --all-files --verbose