You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a hook option for passing *all* repo files as args to it
#2522
This is inspired by my want to type-check my entire repository with ty whenever prek runs (regardless of what files are actually changed) but not wanting it to include any untracked files I have. This is something that's hard to do with just a hook configuration, as you can see in the 4 comments starting from: astral-sh/ty#269 (comment)
which will both run ty check on all files, including untracked.
It would be better if I could specify some option, maybe all_files: true, to have that hook always run as if it were run as part of prek run --all-files. While I could have a hook with a custom Python script that calls git ls-files, it's certainly more involved than being able to just define this through metadata (and slower due to e.g. Python startup times; also, prek can reuse the generated list for multiple hooks needing this or perhaps even for its own use).
I should note that this would be, to my knowledge, the first new feature for the hook configuration format (.pre-commit-hooks.yaml); from what I understand, so far only the project configuration (prek.toml / .pre-commit-config.yaml) may have extra features in it.
This discussion was converted from issue #1897 on August 09, 2026 08:57.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This is inspired by my want to type-check my entire repository with
tywhenever prek runs (regardless of what files are actually changed) but not wanting it to include any untracked files I have. This is something that's hard to do with just a hook configuration, as you can see in the 4 comments starting from: astral-sh/ty#269 (comment)The best I can do is either:
or the
pythonlanguage variant:which will both run
ty checkon all files, including untracked.It would be better if I could specify some option, maybe
all_files: true, to have that hook always run as if it were run as part ofprek run --all-files. While I could have a hook with a custom Python script that callsgit ls-files, it's certainly more involved than being able to just define this through metadata (and slower due to e.g. Python startup times; also, prek can reuse the generated list for multiple hooks needing this or perhaps even for its own use).I should note that this would be, to my knowledge, the first new feature for the hook configuration format (
.pre-commit-hooks.yaml); from what I understand, so far only the project configuration (prek.toml/.pre-commit-config.yaml) may have extra features in it.A similar feature was suggested in the pre-commit repo a couple of times in the past, but these suggestions were rejected:
pre-commit/pre-commit#2194
pre-commit/pre-commit#2405
pre-commit/pre-commit#2818
A similar sentiment of not wanting untracked files to affect what the hook does can be seen in other issues:
pre-commit/pre-commit#708
pre-commit/pre-commit#1212
pre-commit/pre-commit#1981
pre-commit/pre-commit#2660 (maybe, the description does not make it clear)
All reactions