When multiple groups are present in the Commit Message Regex only the first group is checked for a JIRA key

Description

The current implementation of YaccServiceImpl forces the JIRA key group to be the first group in the Commit Message RegEx. Instead of setting it to the first group, the user should be able to specify the group ID to use and the extractJiraIssuesFromCommitMessages() should use that value to determine where to look for the JIRA key. That way a user can write a regex looking for multiple key words and identify specifically the one that is required for JIRA.
This was found during some testing where I was trying to verify that a standard commit template would verify and that I could extract the JIRA key. The short answer is to change my standard commit template but given that it is used across the company and would impact multiple programs, my hands are bound. So in an effort to enforce standardized commit practices I was looking to use this tool to ensure that all the required fields are present and that a JIRA key was available

Steps to reproduce:

1 - Configure the Commit Message Regex with the following:


2 - Force the Require Valid JIRA issue and configure the No Jira Issue Error with a custom error
3 - Attempt to push a change to a repo with the following commit message
DESCRIPTION: FOO
ACCOUNT MANAGER: BLAH
WORK ORDER: yup
JIRA ISSUE: AS-1234

Note that it should get rejected due to the system not finding the JIRA key. That is because the JIRA key is not in Group 1, but instead Group 8 based on the regular expression. It would be super helpful to specify that I want the checker to use Group 8 as the JIRA key so I can id the key in isolation

Assignee

Unassigned

Reporter

Mohammed Davoodi

Sprint

None

Labels

Priority

Medium
Configure