parser icon indicating copy to clipboard operation
parser copied to clipboard

Simplify parsing by preventing `!` in Tyoe?

Open epage opened this issue 4 years ago • 3 comments

Currently, the grammar only prevents the sequence !:. So someone could have a type like He!!o.

::= <any UTF8-octets except newline or parens or ":" or "!:" or whitespace>+

Personally, I would find this confusing to see but it also would greatly simplify this grammar rule to only be looking at characters rather than sequence of characters.

epage avatar Oct 19 '21 14:10 epage

Using ! in the type to indicate a breaking change is part of the Conventional Commit standard...

https://www.conventionalcommits.org/en/v1.0.0/?ref=blog.formacao.dev#commit-message-with--to-draw-attention-to-breaking-change

Why would we want to prevent it?

WillGibson avatar Feb 29 '24 15:02 WillGibson

My suggestion is to make this change

- ::= <any UTF8-octets except newline or parens or ":" or "!:" or whitespace>+
+ ::= <any UTF8-octets except newline or parens or ":" or "!" or whitespace>+

The idea being that a message like:

He!!o: some message

is both odd (harder to parse by computer and human) and inconsistent in what it allows as you can't then do

He!!: some message

without there being a semantic change

epage avatar Feb 29 '24 15:02 epage

As I understand it, indicating a breaking change is meant to be a single ! after the type, e.g. feat!: some commit message.

I ended up here by mistake though, the package I am needing to fiddle with is actually https://www.npmjs.com/package/conventional-commits-parser.

WillGibson avatar Mar 01 '24 07:03 WillGibson