pre-commit icon indicating copy to clipboard operation
pre-commit copied to clipboard

Support `repos` argument for `pre-commit clean`

Open lorenzwalthert opened this issue 3 years ago • 2 comments

Sometimes I have a hook env that's not working properly anymore for some reason and I don't want to clean the whole pre-commit cache. In that case, it would be handy to only clean cache for certain repos, e.g along these lines:

pre-commit clean --repos https://github.com/pre-commit/pre-commit-hooks

pre-commit clean has no such documented option and I searched old issues. Would you consider this a valuable addition?

lorenzwalthert avatar Apr 11 '22 20:04 lorenzwalthert

I'm hesitant to add this option

originally I didn't even want to implement pre-commit clean since it usually is hiding a bug somewhere else (and it trains users to run the wrong and slow things whenever something goes wrong -- "oh just make clean && make" etc.)

I'm not really sure I want to add more features to it since that would encourage its use, thoughts?

asottile avatar Apr 12 '22 00:04 asottile

I was also wondering about that trade-off. However, it's a reality that there are bugs in every piece of software and people need to find a way to work around them until they get solved. So I think if we properly document that people should file issues if they run into problems and use that as a strategy of last resort, I am not afraid that it will be abused. If it will, it's the responsibiliy of the user I think.

lorenzwalthert avatar May 18 '22 08:05 lorenzwalthert

closing since I'm not planning to implement this

asottile avatar Dec 27 '22 17:12 asottile