fix(hook): show actual regex pattern in commit-msg-hook error#191
Closed
A386official wants to merge 1 commit intoqoomon:masterfrom
Closed
fix(hook): show actual regex pattern in commit-msg-hook error#191A386official wants to merge 1 commit intoqoomon:masterfrom
A386official wants to merge 1 commit intoqoomon:masterfrom
Conversation
When a custom commitMessageRegexPattern is configured, the commit-msg-hook error message still shows the hardcoded default pattern <TYPE>[(<SCOPE>)]: <DESCRIPTION> instead of the actual regex being used for validation. Display convention.msgRegex.source so users see which pattern their commit must match. Closes #180
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! I noticed the bug reported in #180 where the pre-commit hook error message always shows the default pattern instead of the custom one when
commitMessageRegexPatternis configured.What
When a custom
commitMessageRegexPatternis set in the config file, the commit-msg-hook error message still displays the hardcoded default pattern<TYPE>[(<SCOPE>)]: <DESCRIPTION>instead of the actual regex being used for validation.Why
The error message on line 31 of
commandCommitMessageHook.jsuses a hardcoded string literal rather than reading from the loaded convention config. Since the config loader already compiles the custom pattern intoconvention.msgRegex, this information is available but was not being used.How
Replace the hardcoded pattern string with
convention.msgRegex.source, which contains the actual regex pattern string being used for validation (whether default or custom). This way users see exactly which pattern their commit message needs to match.Closes #180