From 423bf05976a1b99bbc508c06582c640e9f96a19f Mon Sep 17 00:00:00 2001 From: Renegade334 Date: Fri, 10 Apr 2026 18:53:36 +0200 Subject: [PATCH] fix(rules): add line-length exemptions for DCO sign-offs Refs: https://github.com/nodejs/core-validate-commit/pull/141 --- lib/rules/line-length.js | 4 ++++ test/rules/line-length.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/lib/rules/line-length.js b/lib/rules/line-length.js index 3a568a9..9a3be31 100644 --- a/lib/rules/line-length.js +++ b/lib/rules/line-length.js @@ -36,6 +36,10 @@ export default { if (/https?:\/\//.test(line)) { continue } // Skip co-authorship. if (/^co-authored-by:/i.test(line)) { continue } + // Skip DCO sign-offs. + if (/^signed-off-by:/i.test(line)) { continue } + // Skip agentic assistants. + if (/^assisted-by:/i.test(line)) { continue } if (line.length > len) { failed = true diff --git a/test/rules/line-length.js b/test/rules/line-length.js index 1eb781d..78e8f33 100644 --- a/test/rules/line-length.js +++ b/test/rules/line-length.js @@ -161,5 +161,37 @@ https://${'very-'.repeat(80)}-long-url.org/ tt.end() }) + t.test('Signed-off-by and Assisted-by lines', (tt) => { + const v = new Validator() + + const good = new Commit({ + sha: '016b3921626b58d9b595c90141e65c6fbe0c78e2', + author: { + name: 'John Connor', + email: '9092381+JConnor1985@users.noreply.github.com', + date: '2026-04-10T16:38:01Z' + }, + message: [ + 'Signed-off-by: John Connor <9092381+JConnor1985@users.noreply.github.com>', + 'Assisted-by: The Longest-Named Code Agent In The World ' + ].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(good, { + options: { + length: 72 + } + }) + + tt.end() + }) + t.end() })