commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

Support custom types for pre-commit hook

Open LukeHankey opened this issue 3 years ago • 5 comments

Description

As far as I can see, there is no way to customize the types when using the pre-commit hook. It would be nice to implement this somehow.

Possible Solution

Allow the hook to somehow work with a configuration file or have some arguments that can be passed when adding the pre-commit hook to the .pre-commit-config.yaml file.

Additional context

No response

Additional context

No response

LukeHankey avatar Apr 21 '22 15:04 LukeHankey

@LukeHankey, it sounds like you are looking for this existing feature of pre-commit.

Kurt-von-Laven avatar Apr 30 '22 21:04 Kurt-von-Laven

@LukeHankey do you think @Kurt-von-Laven solve your question? If not, could you please elaborate?

Lee-W avatar May 03 '22 14:05 Lee-W

Hi both. I don't think that is what I was looking for. When running the cz check command, the pattern shows as pattern: (build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\(\S+\))?!?:(\s.*). I was wondering, with the precommit hook, if it is possible to customize this pattern or add onto it with the args key or via one of the config files.

LukeHankey avatar May 04 '22 14:05 LukeHankey

I have tried using a config file which seems to work with the pre-commit hook. Not sure if this is added anywhere on your docs but would be a good detail to add in the pre-commit section.

LukeHankey avatar May 04 '22 16:05 LukeHankey

Yes, that sounds like the right approach. I apologize in advance if I am misunderstanding you again. The integrating with pre-commit section already makes it clear that the hook runs cz check. The fact that one would configure the pre-commit hook the same way one would configure Commitizen seems self-evident to me, but I have been working with pre-commit for a while now. Hooks generally work by running their namesake tool (in some cases on a given subset of files). All this to say, I'm not the best person to suggest how the docs might be clarified, but I imagine if you open a PR proposing what you would have found helpful, it will benefit others as well. I find that often simply rewording something for clarity can go a long way even if it doesn't technically change the meaning.

Kurt-von-Laven avatar May 04 '22 23:05 Kurt-von-Laven

Thanks @Kurt-von-Laven . IMO, the document is clear enough. I'll close this issue for now. @LukeHankey If you think we should have more discuss or you can think of a way to improve the doc further, feel free to reopen it or send us a PR. Thanks!

Lee-W avatar Aug 14 '22 08:08 Lee-W