top | item 8587252

(no title)

eLobato | 11 years ago

Interesting, that makes sense. I'll check if the rest of the team would be ok with forcing commits to use colon as a separator until that feature is added. :)

Still, what does %{scope} actually catch? Anything that's not %{type}, %{description} or an explicit character?

discuss

order

Gazler|11 years ago

Glad it made sense!

So the match is exact between the non %{..} characters. The idea for scope is the context of the commit, in my libraries I use the name of the class as the scope.

For example with the default format string:

    test string: "fix(User): ensure email address is required"
    format:      "%{type}(%{scope}): %{description}"
    [type: "fix", scope: "User", description: "ensure email address is required"]
So any literal characters are matched exactly and anything inside the capturing %{...} is assigned to that variable.

This does fall over in the following case:

    "fix():(User): ensure email address is required"
    "%{type}(%{scope}): %{description}"
    [type: "fix", scope: "):(User", description: "ensure email address is required"]
It is certainly a candidate for improvement in the future.