commitlint icon indicating copy to clipboard operation
commitlint copied to clipboard

Add whitespace handling (trim) for commit messages

Open rojvv opened this issue 2 years ago • 5 comments

image

rojvv avatar May 26 '22 14:05 rojvv

You mean if it's intended not to trim inputs? tbh I don't know. What would you expect? Is this blocking you in a way? Would be nice if you could add some more context to your issue.

Creating a commit message I usually use -m "[MESSAGE]" and I don't have any spaces in there. Don't think it's commitlint's task to take care of this. But maybe this could be improved.

escapedcat avatar May 27 '22 03:05 escapedcat

I expect it to not count leading whitespaces. Yes, it is super blocking in case of mistakes.

rojvv avatar May 27 '22 06:05 rojvv

Do you have time and motivation to look into this?

escapedcat avatar May 27 '22 06:05 escapedcat

So you want to allow leading whitespace? IMO, that's an invalid commit message and is being linted correctly - albeit with a misleading error message.

The purpose of commitlint is to throw errors when you make mistakes - so blocking is the correct behaviour. No?

adanilev avatar Sep 09 '22 00:09 adanilev

The purpose of commitlint is to throw errors when you make mistakes

True, I can understand this as well

escapedcat avatar Sep 09 '22 02:09 escapedcat

Currently when having a leading space, the error message says that the subject is empty. I suggest that the error message instead says that there is leading whitespace. This is due to identifying extra unwanted leading whitespace is hard in a commit message.

jbnjohnathan avatar May 02 '23 12:05 jbnjohnathan

Thanks @marcalexiei https://github.com/conventional-changelog/commitlint/releases/tag/v18.6.0

escapedcat avatar Jan 25 '24 10:01 escapedcat