pocc / pre-commit-hooks

C/C++ hooks to integrate with pre-commit
Apache License 2.0
324 stars 67 forks source link

Configurable `uncrustify` executable path for the uncrustify hook #57

Open skelly37 opened 1 year ago

skelly37 commented 1 year ago

I have seen in the hook's code that uncrustify is hardcoded as a command. It would be really useful to specify some custom path for the executable, e.g. /home/skelly37/.local/bin/uncrustify, so the end-user can have multiple uncrustify installations or so they do not have to mess with the system's PATH

If I can already do something like this, I would appreciate showing me how to do it.

bakkiraju commented 1 year ago

also want to know how to provide custom path to uncrustify.cfg that is not necessarily at the root level

skelly37 commented 1 year ago

also want to know how to provide custom path to uncrustify.cfg that is not necessarily at the root level

@bakkiraju It is actually handled by the uncrustify itself. You basically pass the path like this

hooks:
      - id: uncrustify
        args: [-c, path/to/uncrustify.cfg]