commit-message-checker icon indicating copy to clipboard operation
commit-message-checker copied to clipboard

Add an option to invert the check (fail if RegExp succeeds)

Open happycollision opened this issue 2 years ago • 1 comments

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • [X] I have searched the existing issues

Are you willing to sponsor your idea?

  • [ ] Yes, I like to sponsor this request

Is your feature request related to a problem? Please describe

I am trying to fail if a commit message starts with fixup or squash. I am also trying to fail if a message contains [no-merge]. It is far easier to check for the existence of these things than confirm the negative.

Describe the solution you'd like

A new flag: failOnMatch. It defaults to false (current behavior). Setting to true will fail if the pattern matches on a commit.

Describe alternatives you've considered

RegExp negative lookahead. Ugh. Not easy to understand for the next person to look at the code. (AKA me, in five minutes.)

Additional context

No response

happycollision avatar Jan 31 '23 22:01 happycollision

I’ll take a crack at this tonight if I have some spare time. If I didn’t, then someone else should feel free to grab this if it is a desired feature.

happycollision avatar Feb 01 '23 00:02 happycollision