ramsey / conventional-commits

:yo_yo: A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook plugin!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lower case converter wrong validation

toniop99 opened this issue · comments

I think this is kind a bug but I am not sure if it could be the valid implementation of a lower case converter

Maybe is more related to jawira/case-converter than with that package.

Steps to reproduce

If we config the package to use "descriptionCase": "lower", if we try to commit the following commit type(scope): 1.1.1 to release a new version, the commit message validation will fail as it detect that the versioning is not in lower format

Screenshots or output

Image showing error

Definitely, I think that what I am commenting does not make sense, since there would be no way to differentiate the text from other types such as the dot conversion.

Sorry for the waste of time

Your comment makes sense, and this has frustrated me, too. If you can think of a good way to validate the commit message like this, let me know. I'm willing to make that change.

I think we can try to validate if the description is for versioning and not apply descriptionCaseValidator and descriptionEndMarkValidator in that case. For that pupose, we can use the regex specified in the semserver website as official/recommended option.

Description validation

In addition, to generalize this behavior, the following options can be added to the configuration:

  • validateDescriptionWhenVersioningCommit -> if false description will not be validated.
  • customVersioningRegex -> Allow the user specify custom regex to decide if validation will be applied.

This is what comes to mind. Let me know what you think!