From 37e4e88303df1a80ebbfb0a48a5a5c53ed41e0c8 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Tue, 9 Dec 2025 22:20:35 +0100 Subject: [PATCH 1/8] feat: support co-authorship lines in body --- lib/rules/line-length.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rules/line-length.js b/lib/rules/line-length.js index 2d5b60c..92aa665 100644 --- a/lib/rules/line-length.js +++ b/lib/rules/line-length.js @@ -29,10 +29,14 @@ export default { let failed = false for (let i = 0; i < parsed.body.length; i++) { const line = parsed.body[i] + // Skip quoted lines, e.g. for original commit messages of V8 backports. if (line.startsWith(' ')) { continue } // Skip lines with URLs. if (/https?:\/\//.test(line)) { continue } + // Skip co-authorship. + if (line.startsWith('Co-Authored-By')) { continue } + if (line.length > len) { failed = true context.report({ From f1496de5a7d5474e39eafaafe6f79befe5883a5b Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Mon, 22 Dec 2025 10:40:42 +0100 Subject: [PATCH 2/8] fixup!: apply case-insensitive suggestion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michaël Zasso --- lib/rules/line-length.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/line-length.js b/lib/rules/line-length.js index 92aa665..3a568a9 100644 --- a/lib/rules/line-length.js +++ b/lib/rules/line-length.js @@ -35,7 +35,7 @@ export default { // Skip lines with URLs. if (/https?:\/\//.test(line)) { continue } // Skip co-authorship. - if (line.startsWith('Co-Authored-By')) { continue } + if (/^co-authored-by:/i.test(line)) { continue } if (line.length > len) { failed = true From f778e67f429665fe5f46f3959f30a8968191f051 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Mon, 22 Dec 2025 13:27:45 +0100 Subject: [PATCH 3/8] fixup!: account for optional leading whitespace per existing `co-authored-by-is-trailer` rule's regex --- lib/rules/line-length.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/line-length.js b/lib/rules/line-length.js index 3a568a9..6c0cdec 100644 --- a/lib/rules/line-length.js +++ b/lib/rules/line-length.js @@ -35,7 +35,7 @@ export default { // Skip lines with URLs. if (/https?:\/\//.test(line)) { continue } // Skip co-authorship. - if (/^co-authored-by:/i.test(line)) { continue } + if (/^\s*Co-authored-by:/i.test(line)) { continue } if (line.length > len) { failed = true From 5004df947fb845226dfc316297fcf14555493d65 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Mon, 22 Dec 2025 13:28:04 +0100 Subject: [PATCH 4/8] test: add case for long co-author line --- test/rules/line-length.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/rules/line-length.js b/test/rules/line-length.js index d8bda5f..afc5468 100644 --- a/test/rules/line-length.js +++ b/test/rules/line-length.js @@ -129,5 +129,36 @@ https://${'very-'.repeat(80)}-long-url.org/ tt.end() }) + t.test('Co-author lines', (tt) => { + const v = new Validator() + const context = new Commit({ + sha: 'f1496de5a7d5474e39eafaafe6f79befe5883a5b', + author: { + name: 'Jacob Smith', + email: '3012099+JakobJingleheimer@users.noreply.github.com', + date: '2025-12-22T09:40:42Z', + }, + message: ` + fixup!: apply case-insensitive suggestion + Co-authored-by: Michaël Zasso <37011812+targos@users.noreply.github.com> + `, + }, v) + + + context.report = (opts) => { + tt.pass('called report') + tt.equal(opts.id, 'line-length', 'id') + tt.equal(opts.string, '', 'string') + tt.equal(opts.level, 'pass', 'level') + } + + Rule.validate(context, { + options: { + length: 72 + } + }) + tt.end() + }) + t.end() }) From d7c76aa23bc1155e98cc249e7b7a7ed765545704 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Mon, 22 Dec 2025 13:30:17 +0100 Subject: [PATCH 5/8] fixup!: de-lint --- test/rules/line-length.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/rules/line-length.js b/test/rules/line-length.js index afc5468..7702381 100644 --- a/test/rules/line-length.js +++ b/test/rules/line-length.js @@ -136,15 +136,14 @@ https://${'very-'.repeat(80)}-long-url.org/ author: { name: 'Jacob Smith', email: '3012099+JakobJingleheimer@users.noreply.github.com', - date: '2025-12-22T09:40:42Z', + date: '2025-12-22T09:40:42Z' }, message: ` fixup!: apply case-insensitive suggestion Co-authored-by: Michaël Zasso <37011812+targos@users.noreply.github.com> - `, + ` }, v) - context.report = (opts) => { tt.pass('called report') tt.equal(opts.id, 'line-length', 'id') From dc6b810bf1fdfcccfc2d904a17e7438c1468fa74 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Thu, 1 Jan 2026 17:40:24 -0500 Subject: [PATCH 6/8] fixup!: align co-author regex to newly corrected pattern Co-authored-by: Antoine du Hamel --- lib/rules/line-length.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/line-length.js b/lib/rules/line-length.js index 6c0cdec..3a568a9 100644 --- a/lib/rules/line-length.js +++ b/lib/rules/line-length.js @@ -35,7 +35,7 @@ export default { // Skip lines with URLs. if (/https?:\/\//.test(line)) { continue } // Skip co-authorship. - if (/^\s*Co-authored-by:/i.test(line)) { continue } + if (/^co-authored-by:/i.test(line)) { continue } if (line.length > len) { failed = true From f05715d5325da6dc65a3f3b5fa98b1e231bdec68 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Mon, 12 Jan 2026 20:10:58 +0100 Subject: [PATCH 7/8] fixup!: add contrapositive test-case --- test/rules/line-length.js | 51 +++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/test/rules/line-length.js b/test/rules/line-length.js index 7702381..84b004c 100644 --- a/test/rules/line-length.js +++ b/test/rules/line-length.js @@ -130,32 +130,57 @@ https://${'very-'.repeat(80)}-long-url.org/ }) t.test('Co-author lines', (tt) => { + const sha = 'f1496de5a7d5474e39eafaafe6f79befe5883a5b' + const author = { + name: 'Jacob Smith', + email: '3012099+JakobJingleheimer@users.noreply.github.com', + date: '2025-12-22T09:40:42Z' + } + const v = new Validator() - const context = new Commit({ - sha: 'f1496de5a7d5474e39eafaafe6f79befe5883a5b', - author: { - name: 'Jacob Smith', - email: '3012099+JakobJingleheimer@users.noreply.github.com', - date: '2025-12-22T09:40:42Z' - }, - message: ` - fixup!: apply case-insensitive suggestion - Co-authored-by: Michaël Zasso <37011812+targos@users.noreply.github.com> - ` + const overlongMessage = `fixup!: apply case-insensitive suggestion + Co-authored-by: Michaël Zasso <37011812+targos@users.noreply.github.com>` + const bad = new Commit({ + sha, + author, + message: overlongMessage, }, v) - context.report = (opts) => { + bad.report = (opts) => { + tt.pass('called report') + tt.equal(opts.id, 'line-length', 'id') + tt.equal(opts.string, overlongMessage.split('\n')[1], 'string') + tt.equal(opts.level, 'fail', 'level') + } + + Rule.validate(bad, { + options: { + length: 72 + } + }) + + const good = new Commit({ + sha, + author, + message: [ + 'fixup!: apply case-insensitive suggestion', + 'Co-authored-by: Michaël Zasso <37011812+targos@users.noreply.github.com>' + ].join('\n') + }, v) + + good.report = (opts) => { tt.pass('called report') tt.equal(opts.id, 'line-length', 'id') tt.equal(opts.string, '', 'string') tt.equal(opts.level, 'pass', 'level') } - Rule.validate(context, { + Rule.validate(good, { options: { length: 72 } }) + tt.end() }) From 69779f028385581016e21bf344b26de1e03a79e1 Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Mon, 12 Jan 2026 20:42:09 +0100 Subject: [PATCH 8/8] eff this linter --- test/rules/line-length.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/rules/line-length.js b/test/rules/line-length.js index 84b004c..1de6420 100644 --- a/test/rules/line-length.js +++ b/test/rules/line-length.js @@ -143,7 +143,7 @@ https://${'very-'.repeat(80)}-long-url.org/ const bad = new Commit({ sha, author, - message: overlongMessage, + message: overlongMessage }, v) bad.report = (opts) => {