Skip to content

Remove opensource jira req#32

Merged
mmaharjan-ccdc merged 3 commits intomainfrom
remove-opensource-jira-req
Feb 25, 2026
Merged

Remove opensource jira req#32
mmaharjan-ccdc merged 3 commits intomainfrom
remove-opensource-jira-req

Conversation

@layfield-ccdc
Copy link
Contributor

This has been properly tested now

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables the exemption of JIRA ID requirements for commits to ccdc-opensource repositories to accommodate external contributors. The changes uncomment previously commented-out logic that checks the repository name and bypasses JIRA validation for opensource repos. The implementation adds a repo parameter to the check_commit_msg function and updates all call sites to pass the repository name obtained via get_repo().

Changes:

  • Added repo parameter to check_commit_msg function to enable repository-specific validation logic
  • Uncommented and activated the logic that exempts ccdc-opensource repositories from JIRA ID requirements
  • Updated all function call sites in both main.py and githooks.py to pass the repository parameter

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
main/githooks.py Added repo parameter to check_commit_msg function signature, uncommented opensource repo exemption logic with improved regex pattern (added trailing slash), and updated test and commit_msg_hook call sites
main.py Retrieved repo name using get_repo() and passed it to check_commit_msg function call
Comments suppressed due to low confidence (2)

main/githooks.py:915

  • The test cases do not cover the new opensource repository exception logic. Consider adding test cases that verify:
  1. A commit without a JIRA ID is rejected for a regular repo (e.g., "fake/repo")
  2. A commit without a JIRA ID is accepted for an opensource repo (e.g., "ccdc-opensource/test-repo")

This will ensure the new conditional logic works correctly and prevent future regressions.

class TestCheckCommitMessage(unittest.TestCase):
    def test_various_strings(self):
        def _test(input, is_good=True):
            rc = check_commit_msg(input, [], "fake/repo")
            self.assertEqual(rc == 0, is_good)
        _test('ABC-1234')
        _test('Some changes for ABC-1234 ticket')
        _test('Trivial change NO_JIRA')
        _test("Merge branch 'main' into my_branch")
        _test("Merge branch 'branch_1' into branch_2")
        _test("Merge branch 'jira_pyapi_123_abc' of github.com:ccdc-confidential/cpp-apps-main into jira_pyapi_123_abc")
        _test("Merge commit 'abcdef' into jira_mer_123_abc")
        _test("Merge remote-tracking branch 'origin/release/2022.1' into merge_from_release")
        _test("Merge pull request #1 from patch-1")
        _test('I forgot to add the jira marker!', False)
        _test('Close but no cigar abc-1234', False)

main/githooks.py:844

  • The docstring for this function should be updated to document the new 'repo' parameter. Consider adding a parameter description that explains it should be in the format "owner/repo" and is used to determine if JIRA checks should be bypassed for opensource repositories.
def check_commit_msg(message, files, repo):
    '''Check commit message (and file size).

    Abort if file size exceeds hard (github.com) limit.

    If file size exceeds our soft (internal) limit, flag up if commit message
    does not contain required marker.

    '''

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mmaharjan-ccdc mmaharjan-ccdc merged commit b79871b into main Feb 25, 2026
10 checks passed
@mmaharjan-ccdc mmaharjan-ccdc deleted the remove-opensource-jira-req branch February 25, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants