Skip to content

Pre-commit hook error message does not state the correct commitMsgRegexPattern #180

@Mo0rBy

Description

@Mo0rBy

Hey there,

I just realised this because I had my commit message slightly incorrect.

I have a custom regex pattern set (I suggested some changes a few days ago to add this nice config option to the documentation) and the pre-commit hook is showing the standard regex pattern, rather than the custom one.
Here is my custom regex which just includes a small addition to the beginning for a ticket/issue ID:

commitMessageRegexPattern: ^(?<ticket>[A-Z]*-[A-Za-z0-9]*) \| (?<type>\w+)(?:\((?<scope>[^()]+)\))?(?<breaking>!)?:\s*(?<description>.+)$

And here is the pre-commit error message stating to use the default format:

❯ gcmsg "[WM] DSO-108 | feat: add GenericWebhookTrigger and update DSOHub/build/tools-images to be configured with this trigger"
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
Detect hardcoded secrets.................................................Passed
conventional-commits.....................................................Failed
- hook id: conventional-commits
- exit code: 2

[WARN] Invalid commit subject format: '[WM] DSO-108 | feat: add GenericWebhookTrigger and update DSOHub/build/tools-images to be configured with this trigger'
[ERROR] Invalid commit message
  Valid message pattern: <TYPE>[(<SCOPE>)]: <DESCRIPTION>

I think the final line that states the valid message pattern should show what is defined in the commitMessageRegexPattern config option.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions