From 68ab1396afd15553689e58a14b940f76db069454 Mon Sep 17 00:00:00 2001 From: Danny Martini Date: Fri, 26 Jan 2024 19:52:53 +0100 Subject: [PATCH 1/3] fix error message Since 66e0bf18e0a811e6ffddef29b224e1899299f38b the messages need to start with an uppercase character. --- src/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.js b/src/constants.js index dbf2a51..58e604e 100644 --- a/src/constants.js +++ b/src/constants.js @@ -21,7 +21,7 @@ const ERRORS = { "PR title does not match PR title convention: type: subject or type(scope): subject", `For \`type\`, use \`type:\` or \`type(scope):\`, where \`type\` is one of ${displayTypes}`, `If present, \`scope\` must be one of ${displayScopes} or \` Node\``, - "For the subject, mind the whitespace, start with lowercase and omit final period", + "For the subject, mind the whitespace, start with uppercase and omit final period", ].join(". "), TICKET_NUMBER_PRESENT: "PR title must not contain a ticket number", TYPE_NOT_FOUND: `Failed to find \`type\` in PR title. Expected one of ${displayTypes}`, From b5bf9d8b668bb0ba69438e587d23c9a1865f58a5 Mon Sep 17 00:00:00 2001 From: Danny Martini Date: Fri, 26 Jan 2024 20:01:54 +0100 Subject: [PATCH 2/3] rename constant to match error described in value --- src/constants.js | 2 +- src/validatePrTitle.js | 2 +- src/validatePrTitle.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/constants.js b/src/constants.js index 58e604e..d2dacae 100644 --- a/src/constants.js +++ b/src/constants.js @@ -27,7 +27,7 @@ const ERRORS = { TYPE_NOT_FOUND: `Failed to find \`type\` in PR title. Expected one of ${displayTypes}`, INVALID_TYPE: `Unknown \`type\` in PR title. Expected one of ${displayTypes}`, INVALID_SCOPE: `Unknown \`scope\` in PR title. Expected one of ${displayScopes} or \` Node\``, - LOWERCASE_INITIAL_IN_SUBJECT: "First char of subject must be uppercase", + UPPERCASE_INITIAL_IN_SUBJECT: "First char of subject must be uppercase", FINAL_PERIOD_IN_SUBJECT: "Subject must not end with a period", NO_PRESENT_TENSE_IN_SUBJECT: "Subject must use present tense", SKIP_CHANGELOG_NOT_IN_FINAL_POSITION: `\`${NO_CHANGELOG}\` must be located at the end of the subject`, diff --git a/src/validatePrTitle.js b/src/validatePrTitle.js index 0e7bf7c..2753258 100644 --- a/src/validatePrTitle.js +++ b/src/validatePrTitle.js @@ -50,7 +50,7 @@ async function validatePrTitle(title) { const { subject } = match.groups; if (startsWithLowerCase(subject)) { - issues.push(ERRORS.LOWERCASE_INITIAL_IN_SUBJECT); + issues.push(ERRORS.UPPERCASE_INITIAL_IN_SUBJECT); } if (endsWithPeriod(subject)) { diff --git a/src/validatePrTitle.test.js b/src/validatePrTitle.test.js index 4205a30..1425bfd 100644 --- a/src/validatePrTitle.test.js +++ b/src/validatePrTitle.test.js @@ -105,7 +105,7 @@ describe("subject", () => { const issues = await validate("feat(core): implement feature"); expect(issues) .toHaveLength(1) - .toContain(ERRORS.LOWERCASE_INITIAL_IN_SUBJECT); + .toContain(ERRORS.UPPERCASE_INITIAL_IN_SUBJECT); }); test("Validation should fail for final period in subject", async () => { From 23c11cc43582d3a8ac2790bff476b649d158852e Mon Sep 17 00:00:00 2001 From: Danny Martini Date: Mon, 5 Feb 2024 10:28:06 +0100 Subject: [PATCH 3/3] Revert "rename constant to match error described in value" This reverts commit b5bf9d8b668bb0ba69438e587d23c9a1865f58a5. --- src/constants.js | 2 +- src/validatePrTitle.js | 2 +- src/validatePrTitle.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/constants.js b/src/constants.js index d2dacae..58e604e 100644 --- a/src/constants.js +++ b/src/constants.js @@ -27,7 +27,7 @@ const ERRORS = { TYPE_NOT_FOUND: `Failed to find \`type\` in PR title. Expected one of ${displayTypes}`, INVALID_TYPE: `Unknown \`type\` in PR title. Expected one of ${displayTypes}`, INVALID_SCOPE: `Unknown \`scope\` in PR title. Expected one of ${displayScopes} or \` Node\``, - UPPERCASE_INITIAL_IN_SUBJECT: "First char of subject must be uppercase", + LOWERCASE_INITIAL_IN_SUBJECT: "First char of subject must be uppercase", FINAL_PERIOD_IN_SUBJECT: "Subject must not end with a period", NO_PRESENT_TENSE_IN_SUBJECT: "Subject must use present tense", SKIP_CHANGELOG_NOT_IN_FINAL_POSITION: `\`${NO_CHANGELOG}\` must be located at the end of the subject`, diff --git a/src/validatePrTitle.js b/src/validatePrTitle.js index 2753258..0e7bf7c 100644 --- a/src/validatePrTitle.js +++ b/src/validatePrTitle.js @@ -50,7 +50,7 @@ async function validatePrTitle(title) { const { subject } = match.groups; if (startsWithLowerCase(subject)) { - issues.push(ERRORS.UPPERCASE_INITIAL_IN_SUBJECT); + issues.push(ERRORS.LOWERCASE_INITIAL_IN_SUBJECT); } if (endsWithPeriod(subject)) { diff --git a/src/validatePrTitle.test.js b/src/validatePrTitle.test.js index 1425bfd..4205a30 100644 --- a/src/validatePrTitle.test.js +++ b/src/validatePrTitle.test.js @@ -105,7 +105,7 @@ describe("subject", () => { const issues = await validate("feat(core): implement feature"); expect(issues) .toHaveLength(1) - .toContain(ERRORS.UPPERCASE_INITIAL_IN_SUBJECT); + .toContain(ERRORS.LOWERCASE_INITIAL_IN_SUBJECT); }); test("Validation should fail for final period in subject", async () => {