Skip to content

Commit f5abb2d

Browse files
committed
feat: remove overflow warning
1 parent edd817e commit f5abb2d

File tree

9 files changed

+35374
-36348
lines changed

9 files changed

+35374
-36348
lines changed

corpus/body.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ BREAKING CHANGE: My message with a long long text that will overflow with ease.
9393
(message
9494
(breaking_change
9595
(token)
96-
(value)
97-
(overflow))))
96+
(value))))
9897

9998
================================================================================
10099
Overflowed summary
@@ -108,8 +107,7 @@ This is a simple body
108107

109108
(source
110109
(subject)
111-
(message
112-
(overflow)))
110+
(message))
113111

114112
================================================================================
115113
Allows 1 char summary

corpus/subject.txt

+5-10
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ this is a simple subject with an awesome overflow because it's longer than 50 ch
7070
--------------------------------------------------------------------------------
7171

7272
(source
73-
(subject
74-
(overflow)))
73+
(subject))
7574

7675
================================================================================
7776
Not a comment
@@ -107,8 +106,7 @@ feat(git): allow provided config object to extend other configs
107106
(subject
108107
(prefix
109108
(type)
110-
(scope))
111-
(overflow)))
109+
(scope))))
112110

113111
================================================================================
114112
Subject complete
@@ -121,8 +119,7 @@ feat(git)!: allow provided config object to extend other configs
121119
(subject
122120
(prefix
123121
(type)
124-
(scope))
125-
(overflow)))
122+
(scope))))
126123

127124
================================================================================
128125
Subject type and BC
@@ -134,8 +131,7 @@ feat!: allow provided config object to extend other configs
134131
(source
135132
(subject
136133
(prefix
137-
(type))
138-
(overflow)))
134+
(type))))
139135

140136
================================================================================
141137
fix #36
@@ -199,8 +195,7 @@ amend! feat(test): allow fixup with an overflow on the subject
199195
(subject_prefix)
200196
(prefix
201197
(type)
202-
(scope))
203-
(overflow)))
198+
(scope))))
204199

205200
================================================================================
206201
Parse fixup! with conventional commit and no scope

corpus/trailers.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,4 @@ key: This is a very long value, with spaces and that will overflow the line size
122122
(message
123123
(trailer
124124
(token)
125-
(value)
126-
(overflow))))
125+
(value))))

grammar.js

+6-21
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
const NEWLINE = /\r?\n/;
2+
const ANYTHING_OR_NONE = /[^\n\r]*/;
23
const ANYTHING = /[^\n\r]+/;
3-
const SUBJECT = /[^\n\r]{0,49}/;
44
const NOT_A_COMMENT = /[^#]/;
5-
const SUMMARY = /[^\n\r]{0,72}/;
65
const SCISSORS = /# -+ >8 -+\r?\n/;
76
const BRANCH_NAME = /[^\s'»"]+/;
87
const COMMIT = /[0-9a-f]{7,40}/;
@@ -20,11 +19,7 @@ module.exports = grammar({
2019
name: 'gitcommit',
2120
extras: () => [],
2221

23-
externals: ($) => [
24-
$._conventional_type,
25-
$._conventional_subject,
26-
$._trailer_value,
27-
],
22+
externals: ($) => [$._conventional_type, $._trailer_value],
2823

2924
rules: {
3025
source: ($) =>
@@ -41,11 +36,7 @@ module.exports = grammar({
4136
optional(
4237
seq(alias(choice('fixup!', 'amend!'), $.subject_prefix), WHITESPACE)
4338
),
44-
choice(
45-
seq(NOT_A_COMMENT, SUBJECT),
46-
seq($.prefix, $._conventional_subject)
47-
),
48-
optional(alias(ANYTHING, $.overflow))
39+
choice(seq(NOT_A_COMMENT, ANYTHING_OR_NONE), seq($.prefix, ANYTHING))
4940
),
5041

5142
prefix: ($) =>
@@ -59,23 +50,17 @@ module.exports = grammar({
5950
_body_line: ($) =>
6051
choice($._message, $.breaking_change, $.trailer, $.comment, NEWLINE),
6152

62-
_message: ($) =>
63-
seq(seq(NOT_A_COMMENT, SUMMARY), optional(alias(ANYTHING, $.overflow))),
53+
_message: ($) => seq(seq(NOT_A_COMMENT, ANYTHING_OR_NONE)),
6454

6555
trailer: ($) =>
66-
seq(
67-
alias(TRAILER_TOKEN, $.token),
68-
alias($._trailer_value, $.value),
69-
optional(alias(ANYTHING, $.overflow))
70-
),
56+
seq(alias(TRAILER_TOKEN, $.token), optional(alias(ANYTHING, $.value))),
7157

7258
breaking_change: ($) =>
7359
seq(
7460
// BREAKING_CHANGE conflicts with TRAILER_TOKEN, an so requires higher
7561
// lexical precedence
7662
alias(token(prec(1, BREAKING_CHANGE)), $.token),
77-
alias($._trailer_value, $.value),
78-
optional(alias(ANYTHING, $.overflow))
63+
optional(alias(ANYTHING, $.value))
7964
),
8065

8166
comment: ($) =>

queries/highlights.scm

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515

1616
(subject) @markup.heading @spell
1717

18-
(subject
19-
(overflow) @none @spell)
20-
2118
(subject
2219
(subject_prefix) @function @nospell)
2320

src/grammar.json

+6-62
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
},
150150
{
151151
"type": "PATTERN",
152-
"value": "[^\\n\\r]{0,49}"
152+
"value": "[^\\n\\r]*"
153153
}
154154
]
155155
},
@@ -161,29 +161,12 @@
161161
"name": "prefix"
162162
},
163163
{
164-
"type": "SYMBOL",
165-
"name": "_conventional_subject"
164+
"type": "PATTERN",
165+
"value": "[^\\n\\r]+"
166166
}
167167
]
168168
}
169169
]
170-
},
171-
{
172-
"type": "CHOICE",
173-
"members": [
174-
{
175-
"type": "ALIAS",
176-
"content": {
177-
"type": "PATTERN",
178-
"value": "[^\\n\\r]+"
179-
},
180-
"named": true,
181-
"value": "overflow"
182-
},
183-
{
184-
"type": "BLANK"
185-
}
186-
]
187170
}
188171
]
189172
},
@@ -289,24 +272,7 @@
289272
},
290273
{
291274
"type": "PATTERN",
292-
"value": "[^\\n\\r]{0,72}"
293-
}
294-
]
295-
},
296-
{
297-
"type": "CHOICE",
298-
"members": [
299-
{
300-
"type": "ALIAS",
301-
"content": {
302-
"type": "PATTERN",
303-
"value": "[^\\n\\r]+"
304-
},
305-
"named": true,
306-
"value": "overflow"
307-
},
308-
{
309-
"type": "BLANK"
275+
"value": "[^\\n\\r]*"
310276
}
311277
]
312278
}
@@ -324,15 +290,6 @@
324290
"named": true,
325291
"value": "token"
326292
},
327-
{
328-
"type": "ALIAS",
329-
"content": {
330-
"type": "SYMBOL",
331-
"name": "_trailer_value"
332-
},
333-
"named": true,
334-
"value": "value"
335-
},
336293
{
337294
"type": "CHOICE",
338295
"members": [
@@ -343,7 +300,7 @@
343300
"value": "[^\\n\\r]+"
344301
},
345302
"named": true,
346-
"value": "overflow"
303+
"value": "value"
347304
},
348305
{
349306
"type": "BLANK"
@@ -371,15 +328,6 @@
371328
"named": true,
372329
"value": "token"
373330
},
374-
{
375-
"type": "ALIAS",
376-
"content": {
377-
"type": "SYMBOL",
378-
"name": "_trailer_value"
379-
},
380-
"named": true,
381-
"value": "value"
382-
},
383331
{
384332
"type": "CHOICE",
385333
"members": [
@@ -390,7 +338,7 @@
390338
"value": "[^\\n\\r]+"
391339
},
392340
"named": true,
393-
"value": "overflow"
341+
"value": "value"
394342
},
395343
{
396344
"type": "BLANK"
@@ -4281,10 +4229,6 @@
42814229
"type": "SYMBOL",
42824230
"name": "_conventional_type"
42834231
},
4284-
{
4285-
"type": "SYMBOL",
4286-
"name": "_conventional_subject"
4287-
},
42884232
{
42894233
"type": "SYMBOL",
42904234
"name": "_trailer_value"

src/node-types.json

-20
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
"multiple": true,
1313
"required": true,
1414
"types": [
15-
{
16-
"type": "overflow",
17-
"named": true
18-
},
1915
{
2016
"type": "token",
2117
"named": true
@@ -157,10 +153,6 @@
157153
"type": "comment",
158154
"named": true
159155
},
160-
{
161-
"type": "overflow",
162-
"named": true
163-
},
164156
{
165157
"type": "trailer",
166158
"named": true
@@ -250,10 +242,6 @@
250242
"multiple": true,
251243
"required": false,
252244
"types": [
253-
{
254-
"type": "overflow",
255-
"named": true
256-
},
257245
{
258246
"type": "prefix",
259247
"named": true
@@ -273,10 +261,6 @@
273261
"multiple": true,
274262
"required": true,
275263
"types": [
276-
{
277-
"type": "overflow",
278-
"named": true
279-
},
280264
{
281265
"type": "token",
282266
"named": true
@@ -1000,10 +984,6 @@
1000984
"type": "ny fil:",
1001985
"named": false
1002986
},
1003-
{
1004-
"type": "overflow",
1005-
"named": true
1006-
},
1007987
{
1008988
"type": "pick",
1009989
"named": false

0 commit comments

Comments
 (0)