{"id":19549031,"url":"https://github.com/dtaivpp/commit-msg-regex-hook","last_synced_at":"2025-04-26T20:30:59.317Z","repository":{"id":62563985,"uuid":"381493381","full_name":"dtaivpp/commit-msg-regex-hook","owner":"dtaivpp","description":"A simple repository for bashing commit messages against regex","archived":false,"fork":false,"pushed_at":"2023-12-06T17:22:21.000Z","size":40,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T17:47:47.298Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dtaivpp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2021-06-29T20:49:25.000Z","updated_at":"2022-03-30T21:49:39.000Z","dependencies_parsed_at":"2022-11-03T16:45:32.390Z","dependency_job_id":null,"html_url":"https://github.com/dtaivpp/commit-msg-regex-hook","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtaivpp%2Fcommit-msg-regex-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtaivpp%2Fcommit-msg-regex-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtaivpp%2Fcommit-msg-regex-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtaivpp%2Fcommit-msg-regex-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtaivpp","download_url":"https://codeload.github.com/dtaivpp/commit-msg-regex-hook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251051289,"owners_count":21528786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T03:57:43.740Z","updated_at":"2025-04-26T20:30:58.857Z","avatar_url":"https://github.com/dtaivpp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# commit-msg-regex-hook\n\nThis hook is designed to be used with the [pre-commit](https://pre-commit.com/) hook framework. It will check your commit string against the provided regex. \n\n\n### Using the commit-msg-regex-hook\n\nFirst you will need to setup [pre-commit](https://pre-commit.com/) using their documentation. \n\nNext you will need to enable commit message hooks: \n`pre-commit install --hook-type commit-msg`\n\nFinally you can add this to your .pre-commit-config.yaml:\n\n```\n- repo: https://github.com/dtaivpp/commit-msg-regex-hook\n  rev: v0.2.2\n  hooks:\n    - id: commit-msg-regex-hook\n      args: [\"--pattern='[A-Z]{3,4}-[0-9]{3,6} \\\\| [\\\\w\\\\s]* \\\\| .+'\",\n             \"--failure_message='Commits should match the pattern: Card-ID | Name | Message'\"]\n      stages: [commit-msg]\n```\n\n**note: the backslashes in regex need to be escaped need to be escaped\n**double note: if you are having issues you can run with the --debug argument as well for additional logging.\n\nWith this you can achieve so many things. A good example is verifing deveopers have signed the DCO before allowing a commit. \n\n```\n- repo: https://github.com/dtaivpp/commit-msg-regex-hook\n  rev: v0.2.2\n  hooks:\n    - id: commit-msg-regex-hook\n      args: [\"--pattern='Signed-off-by: .* \u003c(?:[a-z0-9!#$%\u0026'*+/=?^_`{|}~-]+(?:\\\\.[a-z0-9!#$%\u0026'*+/=?^_`{|}~-]+)*|'(?:[\\\\x01-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\x21\\\\x23-\\\\x5b\\\\x5d-\\\\x7f]|\\\\\\\\[\\\\x01-\\\\x09\\\\x0b\\\\x0c\\\\x0e-\\\\x7f])*')@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\\\x01-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\x21-\\\\x5a\\\\x53-\\\\x7f]|\\\\\\\\[\\\\x01-\\\\x09\\\\x0b\\\\x0c\\\\x0e-\\\\x7f])+)\\\\])\u003e'\",\n             \"--failure_message='Ensure you are signing the DCO'\"]\n      stages: [commit-msg]\n```\n\n### Developing this project\n\nIf you would like to contribute to this project I am happy to accept contributions. Small note I use two spaces for indents and am not looking to swap. \n\nHere is how you can contribute: \n\n1. Fork the repo\n2. Create a virtual envrionment `python -m venv venv`\n3. Activate the virtual environment:\n  - Windows: `venv\\Scripts\\activate`\n  - Mac/Linux: `source venv/bin/activate`\n4. Install the reqirements `python -m pip install -r requirements.txt`\n5. Install our hooks:\n  - `pre-commit install`\n\nAnd you are off to the races!\n\nBefore committing I would reccomend checking your build against unittest and the linter. If it doesn't pass it wont pass! \n- `python -m unittest test/test.py`\n- `python -m pylint commit_msg_regex_hook`\n\nMake sure if you add a check to add a test case!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtaivpp%2Fcommit-msg-regex-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtaivpp%2Fcommit-msg-regex-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtaivpp%2Fcommit-msg-regex-hook/lists"}