Skip to content

Commit

Permalink
fix: allows correct chars in conventional commit prefixes (#62)
Browse files Browse the repository at this point in the history
Fixes: #56
  • Loading branch information
gbprod authored Mar 22, 2024
1 parent 523a1a4 commit a427a79
Show file tree
Hide file tree
Showing 5 changed files with 30,353 additions and 32,386 deletions.
61 changes: 60 additions & 1 deletion corpus/subject.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ feat(issue42): allow numbers in scope
--------------------------------------------------------------------------------

(source
(subject))
(subject
(prefix
(type)
(scope))))

================================================================================
Parse fixup!
Expand Down Expand Up @@ -234,3 +237,59 @@ o

(source
(subject))

================================================================================
Allows numbers and symbols in conventional commit type
================================================================================
f-e_a12t*$(test): allow numbers and symbols

--------------------------------------------------------------------------------

(source
(subject
(prefix
(type)
(scope))))

================================================================================
Not conventional commit if starts with a !
================================================================================
!test(test): allow numbers and symbols

--------------------------------------------------------------------------------

(source
(subject))

================================================================================
Not conventional commit if starts with a :
================================================================================
:test: allow numbers and symbols

--------------------------------------------------------------------------------

(source
(subject))

================================================================================
Not conventional commit if starts with a space
================================================================================
test: allow numbers and symbols

--------------------------------------------------------------------------------

(source
(subject))

================================================================================
Scope can contain a special chars
================================================================================
test(10_-#{} test): scope

--------------------------------------------------------------------------------

(source
(subject
(prefix
(type)
(scope))))
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const BRANCH_NAME = /[^\s'”»"“]+/;
const COMMIT = /[0-9a-f]{7,40}/;
const FILEPATH = /\S+/;
const WHITESPACE = /[\f\v ]+/;
const SCOPE = /[a-zA-Z0-9_-]+/;
const SCOPE = /[^\n\r\(\)]+/;
const COMMENT = /[^\n\r]*\r?\n/;
const COMMENT_TITLE = /[^\n\r:\uff1a]+[:\uff1a]\s*\r?\n/;
const TRAILER_TOKEN = /[a-zA-Z-]+[ ]*[:\uff1a] /;
Expand Down
2 changes: 1 addition & 1 deletion src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "[a-zA-Z0-9_-]+"
"value": "[^\\n\\r\\(\\)]+"
},
"named": true,
"value": "scope"
Expand Down
Loading

0 comments on commit a427a79

Please sign in to comment.