conventional-commits / parser

reference implementation of conventionalcommits.org spec
ISC License
46 stars 7 forks source link

refactor: contain scope parsing in scope method only #22

Closed byCedric closed 3 years ago

byCedric commented 3 years ago

Note, this is just a try-out. Feel free to close this if it's too much.

One thing I'm not a fan of is having certain tokens spread out to parse a node. The scope is the biggest one that's currently a bit spread. E.g.

Having it contained within the parsing method might help cleaning this up.

byCedric commented 3 years ago

This refactor seems good to me. It doesn't change the grammar at all, just moves repeated logic from token() and summary() into scope()?

Yep, it doesn't change anything in the output. We just contain our parsing logic within a single parsing method 😄 I think this is the method @wesleytodd mentioned too in Slack