Skip to content

Commit a427a79

Browse files
authored
fix: allows correct chars in conventional commit prefixes (#62)
Fixes: #56
1 parent 523a1a4 commit a427a79

File tree

5 files changed

+30353
-32386
lines changed

5 files changed

+30353
-32386
lines changed

corpus/subject.txt

+60-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ feat(issue42): allow numbers in scope
157157
--------------------------------------------------------------------------------
158158

159159
(source
160-
(subject))
160+
(subject
161+
(prefix
162+
(type)
163+
(scope))))
161164

162165
================================================================================
163166
Parse fixup!
@@ -234,3 +237,59 @@ o
234237

235238
(source
236239
(subject))
240+
241+
================================================================================
242+
Allows numbers and symbols in conventional commit type
243+
================================================================================
244+
f-e_a12t*$(test): allow numbers and symbols
245+
246+
--------------------------------------------------------------------------------
247+
248+
(source
249+
(subject
250+
(prefix
251+
(type)
252+
(scope))))
253+
254+
================================================================================
255+
Not conventional commit if starts with a !
256+
================================================================================
257+
!test(test): allow numbers and symbols
258+
259+
--------------------------------------------------------------------------------
260+
261+
(source
262+
(subject))
263+
264+
================================================================================
265+
Not conventional commit if starts with a :
266+
================================================================================
267+
:test: allow numbers and symbols
268+
269+
--------------------------------------------------------------------------------
270+
271+
(source
272+
(subject))
273+
274+
================================================================================
275+
Not conventional commit if starts with a space
276+
================================================================================
277+
test: allow numbers and symbols
278+
279+
--------------------------------------------------------------------------------
280+
281+
(source
282+
(subject))
283+
284+
================================================================================
285+
Scope can contain a special chars
286+
================================================================================
287+
test(10_-#{} test): scope
288+
289+
--------------------------------------------------------------------------------
290+
291+
(source
292+
(subject
293+
(prefix
294+
(type)
295+
(scope))))

grammar.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const BRANCH_NAME = /[^\s'”»"“]+/;
88
const COMMIT = /[0-9a-f]{7,40}/;
99
const FILEPATH = /\S+/;
1010
const WHITESPACE = /[\f\v ]+/;
11-
const SCOPE = /[a-zA-Z0-9_-]+/;
11+
const SCOPE = /[^\n\r\(\)]+/;
1212
const COMMENT = /[^\n\r]*\r?\n/;
1313
const COMMENT_TITLE = /[^\n\r:\uff1a]+[:\uff1a]\s*\r?\n/;
1414
const TRAILER_TOKEN = /[a-zA-Z-]+[ ]*[:\uff1a] /;

src/grammar.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
"type": "ALIAS",
214214
"content": {
215215
"type": "PATTERN",
216-
"value": "[a-zA-Z0-9_-]+"
216+
"value": "[^\\n\\r\\(\\)]+"
217217
},
218218
"named": true,
219219
"value": "scope"

0 commit comments

Comments
 (0)