From 9fa5f27a8864e5d3b26136bbd21483e44f866259 Mon Sep 17 00:00:00 2001 From: Mersho Date: Tue, 15 Aug 2023 13:46:31 +0330 Subject: [PATCH 1/2] test: using ellipses in titles ending The SubjectFullStop failing test on a title that ends with ellipsis. --- @commitlint/rules/src/subject-full-stop.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/@commitlint/rules/src/subject-full-stop.test.ts b/@commitlint/rules/src/subject-full-stop.test.ts index fadae4ac85..3ed5f76f50 100644 --- a/@commitlint/rules/src/subject-full-stop.test.ts +++ b/@commitlint/rules/src/subject-full-stop.test.ts @@ -7,6 +7,7 @@ const messages = { without: `test: subject\n`, standardScopeWith: `type(scope): subject.\n`, nonStandardScopeWith: 'type.scope: subject.\n', + ellipsisMessage: 'test: subject ends with ellipsis...', }; const parsed = { @@ -15,6 +16,7 @@ const parsed = { without: parse(messages.without), standardScopeWith: parse(messages.standardScopeWith), nonStandardScopeWith: parse(messages.nonStandardScopeWith), + ellipsisMessage: parse(messages.ellipsisMessage), }; test('empty against "always" should succeed', async () => { @@ -72,3 +74,9 @@ test('commit message title with non standard scope and full-stop against "never const expected = false; expect(actual).toEqual(expected); }); + +test('ellipsis is not fullstop so commit title ending with it against "never ." should not fail', async () => { + const [actual] = subjectFullStop(await parsed.ellipsisMessage, 'never', '.'); + const expected = true; + expect(actual).toEqual(expected); +}); From 8a617c635c49bc200c722ecd5a93b5fbf85a29f2 Mon Sep 17 00:00:00 2001 From: Mersho Date: Tue, 15 Aug 2023 14:14:37 +0330 Subject: [PATCH 2/2] fix: subjectFullStop considering ellipsis --- @commitlint/rules/src/subject-full-stop.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/@commitlint/rules/src/subject-full-stop.ts b/@commitlint/rules/src/subject-full-stop.ts index c00161f5ab..2a30819b3a 100644 --- a/@commitlint/rules/src/subject-full-stop.ts +++ b/@commitlint/rules/src/subject-full-stop.ts @@ -14,7 +14,10 @@ export const subjectFullStop: SyncRule = ( const input = parsed.header; const negated = when === 'never'; - const hasStop = input[input.length - 1] === value; + let hasStop = input[input.length - 1] === value; + if (input.slice(-3) === '...') { + hasStop = false; + } return [ negated ? !hasStop : hasStop,