mlawren / githook-perltidy

Run perltidy as a Git pre-commit hook
41 stars 10 forks source link

pre-commit support #11

Closed mapshen closed 6 years ago

mapshen commented 6 years ago

It would be great if this is supported by pre-commit. Can we make this happen?

mlawren commented 6 years ago

On Fri Jul 13, 2018 at 11:44:29AM -0700, mapshen wrote:

It would be great if this is support by pre-commit. Can we make this happen?

I'm not against it in principle, but I struggle a bit to understand what the requirements are from a plugin point of view. Do I just need to create a .pre-commit-hooks.yaml file in this repo?

I'm happy to work with you if you are happy to do most of the work, but I don't have the motivation to investigate and test pre-commit myself at this stage.

-- Mark Lawrence

mapshen commented 6 years ago

Hey Mark,

Thanks for the reply. In fact, I didn't quite think it through - I have got perltidy working with pre-commit with a bit research. An example would be:

- repo: local
  hooks:
    - id: perltidy
      name: perltidy
      language: script
      entry: util/perltidy.sh
      types: [perl]
      args: ['-pbp', '-nst', '-syn', '-w', '-b']
      additional_dependencies: [perltidy]

where perltidy.sh is a wrapper that calls perltidy underneath. pre-commit already takes care of the logistics of how/when to run the hooks. More info can be found here.

Feel free to close this issue.

Thanks again, Map

mlawren commented 6 years ago

Ah, your approach with perltidy directly makes more sense to me now in the context of the pre-commit tool. Pre-commit and githook-perltidy overlap to a certain degree and probably wouldn't integrate well.