Package: ao-conventional-pre-commit
ao-conventional-pre-commitApre-commithook to check commit messages forConventional Commitsformatting, customized for Anderson Optimization format to include JIRA ticket numbers.See the GitBook for more details.Forked fromcompilerla/conventional-pre-commitWorks with Python >= 3.8.UsageMake surepre-commitisinstalled.Create a blank configuration file at the root of your repo, if needed:touch .pre-commit-config.yamlAdd a new repo entry to your configuration file:repos:# - repo: ...-repo:https://github.com/anderson-optimization/ao-conventional-pre-commitrev:<git sha or tag>hooks:-id:ao-conventional-pre-commitstages:[commit-msg]args:[]Install thepre-commitscript:pre-commit install --hook-type commit-msgMake a (normal) commit :x::$gitcommit-m"add a new feature"[INFO] Initializing environment for ....AO Conventional Commit......................................................Failed- hook id: ao-conventional-pre-commit- duration: 0.07s- exit code: 1[Bad Commit message] >> add a new featureYour commit message does not follow Conventional Commits formattinghttps://www.conventionalcommits.org/AO Conventional Commits start with one of the below types, followed by a colon,followed by a ticket number and colon, followed by the commit message:build chore ci docs feat fix perf refactor revert style testExample commit message adding a feature:feat: SVCOR-12: implement new APIExample commit message fixing an issue:fix: DTCT-99: remove infinite loopExample commit with scope in parentheses after the type for more context:fix(account): PROSP-55: remove infinite loopExample commit with a body:fix: DATLA-42: remove infinite loopAdditional information on the issue caused by the infinite loopMake a (conventional) commit :heavy_check_mark::$gitcommit-m"feat: DTCT-33 add a new feature"[INFO] Initializing environment for ....AO Conventional Commit......................................................Passed- hook id: ao-conventional-pre-commit- duration: 0.05sInstall with pipao-conventional-pre-commitcan also be installed and used from the command line:pipinstallao-conventional-pre-commitThen run the command line script:ao-conventional-pre-commit[types]input[types]is an optional list of Conventional Commit types to allow (e.g.feat fix chore)inputis a file containing the commit message to check:ao-conventional-pre-commitfeatfixchorecitest.git/COMMIT_MSGOr from a Python program:fromao_conventional_pre_commit.formatimportis_conventional# prints Trueprint(is_conventional("feat: DTCT-99: this is a conventional commit"))# prints Falseprint(is_conventional("nope: DTCT-99: this is not a conventional commit"))# prints Trueprint(is_conventional("custom: DTCT-99: this is a conventional commit",types=["custom"]))# prints Trueprint(is_conventional("feat: this is a conventional commit",optional_ticket=True))# prints Falseprint(is_conventional("feat: DTCT-99 this is not a conventional commit",optional_colon_after_ticket=False))Passingargsao-conventional-pre-commitsupports a number of arguments to configure behavior:$ao-conventional-pre-commit-h
usage:ao-conventional-pre-commit[-h][--force-scope][--strict][types...]input

CheckagitcommitmessageforConventionalCommitsformatting.

positionalarguments:typesOptionallistoftypestosupportinputAfilecontainingagitcommitmessage

options:-h,--helpshowthishelpmessageandexit--force-scopeForcecommittohavescopedefined.--strictForcecommittostrictlyfollowConventionalCommitsformatting.Disallowsfixup!stylecommits.--optional-ticketAllowforoptionalticketnumber.Thisenablesdefaultconventionalcommitstyle.--force-colon-after-ticketForcecommittocontainacolonafterticketnumber.Supply arguments on the command-line, or via the pre-commithooks.argsproperty:repos:-repo:https://github.com/anderson-optimization/ao-conventional-pre-commitrev:<git sha or tag>hooks:-id:ao-conventional-pre-commitstages:[commit-msg]args:[--strict,--force-scope,feat,fix,chore,test,custom]NOTE:when using as a pre-commit hook,inputis supplied automatically (with the current commit's message).Developmentao-conventional-pre-commitcomes with aVS Code devcontainerconfiguration to provide a consistent development environment.With theRemote - Containersextension enabled, open the folder containing this repository inside Visual Studio Code.You should receive a prompt in the Visual Studio Code window; clickReopen in Containerto run the development environment
inside the devcontainer.If you do not receive a prompt, or when you feel like starting from a fresh environment:Ctrl/Cmd+Shift+Pto bring up the command palette in Visual Studio CodeTypeRemote-Containersto filter the commandsSelectRebuild and Reopen in Containerto completely rebuild the devcontainerSelectReopen in Containerto reopen the most recent devcontainer buildVersioningVersioning generally followsSemantic Versioning.Making a releaseReleases to PyPI and GitHub are triggered by pushing a tag.Ensure all changes for the release are present in themainbranchTag with the new version:git tag vX.Y.Zfor regular release,git tag vX.Y.Z-preNfor pre-releasePush the new version tag:git push origin vX.Y.ZLicenseApache 2.0Inspired by matthorgan'spre-commit-conventional-commits.