-
-
Notifications
You must be signed in to change notification settings - Fork 172
Description
The latest release of identify (2.6.17) now includes uv.lock as a toml type file.
See this PR / comment: #569 (comment)
Because it is a generated file rather than a user editable one, I am not sure this is desirable behaviour.
Our ruff pre-commit hook looks like this:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.5
hooks:
- id: ruff-check
name: ruff
args:
- --fix
- --show-fixes
- --exit-non-zero-on-fix
types_or: [python, pyi, toml]
# This will also validate pyproject.toml, note ruff doesn't have rules for any other toml file.
Due to this change, uv.lock is now being passed in to ruff also and causing it to raise 3000+ errors.
It took a while to debug this as I wasn't expecting a .lock file to be included with a toml flag (it wasn't till I found the source code / the above PR till I actually read the docs and realised it was toml)
I should be able to use some exclude rules to prevent this error but I am not sure this behaviour makes sense as the default.
I guess one option could be a generated or managed tag for files like this, so that hooks targeting manually edited files can ignore it?
Currently identify-cli uv.lock returns ["file", "non-executable", "text"] which other than the name / extension isn't overly easy to filter against.
I suspect there will be further instances of uv users running into variations of this issue.
Thanks