From 7ab4bab31f4b19ddedd850e435398037437007b6 Mon Sep 17 00:00:00 2001 From: Default One Date: Wed, 28 Aug 2024 12:39:49 +0600 Subject: [PATCH] fix(rules): handle blank commit message in signed-off-by check (#4124) Signed-off-by: Default One --- @commitlint/rules/src/signed-off-by.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/@commitlint/rules/src/signed-off-by.ts b/@commitlint/rules/src/signed-off-by.ts index 674a206197..0a30c03e23 100644 --- a/@commitlint/rules/src/signed-off-by.ts +++ b/@commitlint/rules/src/signed-off-by.ts @@ -18,7 +18,9 @@ export const signedOffBy: SyncRule = ( const last = lines[lines.length - 1]; const negated = when === 'never'; - const hasSignedOffBy = last.startsWith(value); + const hasSignedOffBy = + // empty commit message + last ? last.startsWith(value) : false; return [ negated ? !hasSignedOffBy : hasSignedOffBy,