jbauer opened 11 months ago
|
|||||
I am aware of the spec putting strict constraints over the spaces and texts. But just want to relax it to allow unintentional extra spaces in the commit message. You are right, the relaxed form violates conventional commit convention. I will fix that. |
|||||
OneDev changed state to 'Closed' 11 months ago
|
|||||
State changed as code fixing the issue is committed (8290cf51) |
|||||
Referenced from commit 11 months ago
|
|||||
OneDev changed state to 'Released' 11 months ago
|
|||||
State changed as build #3704 is successful |
|||||
In code line you split the Additionally I feel like the split on What do you think? |
|||||
Thanks for pointing this out. Will make it consistent with regex. For '/', I was originally thinking of using it as separator for multiple scopes. I ever see this separator in some examples. Do you know the recommended separator for multiple scopes? Or is this still not allowed in the spec? |
|||||
@robin I googled a bit and it seems that the spec itself strictly means a single noun. See answer in: https://github.com/conventional-commits/conventionalcommits.org/issues/472 However the answer also states that a linter might be a bit forgiving if desired since you never know how teams want to define scopes. However I think a linter should not be too forgiving so that a parser / changelog generator still work correctly. I have also seen an example using So I would always treat the content within the parenthesis as a single scope and allow the user to define scopes containing
I would not support Something like: https://regex101.com/r/f6syXh/1 |
|||||
Thanks for the investigation. Will do as you suggested. |
|||||
Referenced from commit 11 months ago
|
|||||
@robin Quickly tried the new regex on regex101.com and german umlauts do not work anymore because the But beside the umlaut issue the regex seems fine in terms of checking commit subject line structure. Given that you also aim for I18N in OneDev any regex in OneDev might need to be unicode compatible in the future. The page https://www.regular-expressions.info/unicode.html has a pretty good description of unicode support in regex. After reading it twice I think According to the linked page
These categories can be looked up at https://www.compart.com/en/unicode/category |
|||||
That is very good to know. Really appreciated! Will change to use |
Type |
Improvement
|
Priority |
Normal
|
Assignee |
Currently the regex is
which has some issues. I have prepared some example commit messages using the above regex at https://regex101.com/r/9XWUhp/1 . On the right side is a "MATCH INFORMATION" section that shows matching details for each line.
So we can see that:
type
, optionalscope
, optional!
, terminal:
and after the terminal:
. E.g.feat:message
andfix (test) ! : message
are valid in OneDev.The spec says:
Rule 1. and 5. make it pretty clear that no whitespace is between type, scope,
!
and:
and that:
needs a single following space. Rule 4. makes it clear that a scope must be a noun. Whitespace is not a letter and thus whitespace can not be part of a noun. That means whitespace surrounding the noun is not allowed. Generally only a single noun is allowed but OneDev allows whitespace and some special characters_-/,.
. I assume you allow this in order to support some form of namespace, e.g.type(security/login): message
. But I would strongly discourage,
and whitespace an possibly also.
because the whole point of conventional commits is to generate changelogs and if you have multiple scopes you don't really want to show up the same commit in multiple sections of the changelog. So usually you just want a single noun as a scopeIf you look closely at the example lines of the link above you can see some tricky messages:
fix(fix:pe)!:message
matches againstfix:pe)!:message
with group 2 beingfix
and no further groups. This would pass OneDev checks because if checksfix
and does not detect ascope
fix(scope):
matches because OneDev allows empty messagemy:fix(sco: message
: matches with group 2 beingmy
and no group 4. This would be allowed if no types are configured ormy
was configuredmy/fix(scope)!: message
matches againstfix(scope)!: message
which would be allowed because group 2 is fix and group 4 is scopererevert "message"
matches because it does not check the start of lineSo I would vote for using the regex used in https://regex101.com/r/BPgw1H/1