From b21edbf86d067589feff5b31a2eedb30c647e16d Mon Sep 17 00:00:00 2001 From: webwarrior Date: Mon, 17 Jul 2023 11:03:18 +0200 Subject: [PATCH] commitlint(plugins): fix issue#124 Add exception to bodySoftMaxLineLength when line exceeds max length but ends with a git commit hash. Fixes https://github.com/nblockchain/conventions/issues/124. --- commitlint/plugins.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/commitlint/plugins.ts b/commitlint/plugins.ts index f772d83ef..1d5cb8af4 100644 --- a/commitlint/plugins.ts +++ b/commitlint/plugins.ts @@ -399,7 +399,15 @@ export abstract class Plugins { let lineIsFooterNote = Helpers.isFooterNote(line); - if (!isUrl && !lineIsFooterNote) { + let index = line.search(`([0-9a-f]{40})\.?$`); + let endsWithCommitHashButRestIsNotTooLong = + index != -1 && index < bodyMaxLineLength; + + if ( + !isUrl && + !lineIsFooterNote && + !endsWithCommitHashButRestIsNotTooLong + ) { offence = true; break; }