lefthook icon indicating copy to clipboard operation
lefthook copied to clipboard

Best way to run multiple groups?

Open thieman opened this issue 5 years ago • 3 comments

I'm trying to separate my precommit hook into jobs that are parallelizable vs those that are not. I've got this basic setup:

pre-commit:
  parallel: false
  commands:
    readonly:
      run: lefthook run readonly
    writable:
      run: lefthook run writable

readonly:
  parallel: true
  commands:
    ...

writable:
  parallel: false
  commands:
    ...

I'm wondering if there is a better way to do this than executing lefthook from inside itself. Additionally, this is combining with #78 in a bad way and generating even more useless info in my terminal (e.g. the Lefthook version is printed on 3 separate lines).

thieman avatar Feb 10 '20 20:02 thieman

Hi @thieman ! Looks like you have a problem with concurrent overrides. Could you try flock utility? It described here: https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md#concurrent-files-overrides

Arkweid avatar Feb 11 '20 09:02 Arkweid

That might be doable, but it's not optimal. It's yet another dependency I need to install to make my hooks work at all, and I'm trying to support both Linux and macOS so that's a bit more painful than it might sound.

As lefthook's essentially a task runner, it seems to me like this would fit nicely in lefthook itself as a feature enhancement. Do you agree?

thieman avatar Feb 11 '20 15:02 thieman

Yea, agree. That would be nice.

Arkweid avatar Feb 11 '20 15:02 Arkweid