-
Notifications
You must be signed in to change notification settings - Fork 200
stages: [] selects all stages instead of none #1785
Description
Summary
I'm trying to add a slow job to prek that will only be run when explicitly specified, via prek run job_id. The reason I want to do this is because:
- we already use the
manualstage to select a subset of jobs to run when a file is saved - this tool exits 0 even if it makes changes to the repo, and wrapping it in prek gets us nice error handling
I assumed I could do stages: [], and the tool would never run in any stage unless explicitly specified on the command line. Instead, stages: [] seems to be equivalent to stages: ~; that is to say, it selects all stages instead of none.
Could prek support this empty stages list, or, alternatively, could we make custom stages? Basically I want two different manual stages so that I can do prek run --stage group_a or prek run --stage group_b (and crucially, I'd like to have checks in these groups that don't run during any other stage). I was hoping that clearing stages would get this to work.
Willing to submit a PR?
- Yes — I’m willing to open a PR to fix this.
Platform
Linux 5.15.0-135-generic x86_64 GNU/Linux
Version
prek 0.3.4
.pre-commit-config.yaml
Not relevant
Log file
Not relevant