From be21bd38990aa3ab2c48d0b233093ce34c76702a Mon Sep 17 00:00:00 2001 From: Manav Tidhan Date: Tue, 24 May 2022 14:40:05 +0000 Subject: [PATCH] feat: added jira rules --- commitlint.config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/commitlint.config.js b/commitlint.config.js index 68811a6..ca4ca84 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -24,5 +24,17 @@ module.exports = { 'always', validateBodyMaxLengthIgnoringDeps, ], + 'function-rules/body-jira-id-check': [ + 2, // level: error + 'always', + (parsed) => { + const jiraRegex = parsed.body.match(/[A-Z]+[-\d]+/g); + const jiraIgnoreRegex = parsed.body.match(/I don’t have a ticket for this/g); + if ( jiraRegex != null || jiraIgnoreRegex != null) { + return [true]; + } + return [false, 'The body doesnot have Jira ID OR ignore quote']; + }, + ], }, }