# commitlint
[![PyPI version](https://badge.fury.io/py/commitlint.svg)](https://badge.fury.io/py/commitlint)
[![CI status](https://github.com/opensource-nepal/commitlint/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/opensource-nepal/commitlint/actions)
[![Downloads](https://img.shields.io/pypi/dm/commitlint.svg?maxAge=180)](https://pypi.org/project/commitlint/)
[![codecov](https://codecov.io/github/opensource-nepal/commitlint/graph/badge.svg?token=lRmPZsIHb6)](https://codecov.io/github/opensource-nepal/commitlint)
[![License](https://img.shields.io/pypi/l/commitlint?label=License)](https://github.com/opensource-nepal/commitlint/blob/main/LICENSE)
commitlint is a tool designed to lint your commit messages according to the [Conventional Commits](https://www.conventionalcommits.org/) standard for your pre-commit hook and GitHub Actions.
## How to use
### For pre-commit
1. Add the following configuration on `.pre-commit-config.yaml`.
```yaml
repos:
...
- repo: https://github.com/opensource-nepal/commitlint
rev: v0.2.1
hooks:
- id: commitlint
...
```
2. Install the `commit-msg` hook in your project repo:
```bash
pre-commit install --hook-type commit-msg
```
> **_NOTE:_** Installing using only `pre-commit install` will not work.
### For github-actions
If you have any existing workflows, add the following steps:
```yaml
...
steps:
...
- name: Run commitlint
uses: opensource-nepal/commitlint@v0.2.1
...
```
If you don't have any workflows, create a new GitHub workflow, e.g. `.github/workflows/commitlint.yaml`.
```yaml
name: Commitlint
on:
push:
branches: ['main']
pull_request:
jobs:
commitlint:
runs-on: ubuntu-latest
name: Commitlint
steps:
- uses: actions/checkout@v4
- name: Run commitlint
uses: opensource-nepal/commitlint@v0.2.1
```
> **_NOTE:_** commitlint GitHub Actions will only be triggered by "push" or "pull_request" events.
#### GitHub Action Inputs
| # | Name | Type | Default | Description |
| --- | ----------------- | ------- | ------- | --------------------------------------------------------------------- |
| 1 | **fail_on_error** | Boolean | true | Determines whether the GitHub Action should fail if commitlint fails. |
#### GitHub Action Outputs
| # | Name | Type | Description |
| --- | ------------- | ------- | ---------------------------------------------------------------------------- |
| 1 | **exit_code** | Integer | The exit code of the commitlint step. |
| 2 | **status** | String | The outcome of the commitlint step. Possible values: 'success' or 'failure'. |
## CLI (Command Line Interface)
### Installation
```shell
pip install commitlint
```
### Usage
```
$ commitlint --help
usage: commitlint [-h] [-V] [--file FILE] [--hash HASH] [--from-hash FROM_HASH] [--to-hash TO_HASH] [--skip-detail] [commit_message]
Check if a commit message follows the conventional commit format.
positional arguments:
commit_message The commit message to be checked.
optional arguments:
-h, --help show this help message and exit
-V, --version show program's version number and exit
--file FILE Path to a file containing the commit message.
--hash HASH Commit hash
--from-hash FROM_HASH
From commit hash
--to-hash TO_HASH To commit hash
--skip-detail Skip the detailed error message check
```
### Examples
Check commit message directly:
```shell
$ commitlint "chore: my commit message"
```
Check commit message from file:
```shell
$ commitlint --file /foo/bar/commit-message.txt
```
Check commit message of a hash:
```shell
$ commitlint --hash 9a8c08173
```
Check commit message of a hash range:
```shell
$ commitlint --from-hash 00bf73fef7 --to-hash d6301f1eb0
```
Check commit message skipping the detail check:
```shell
$ commitlint --skip-detail "chore: my commit message"
# or
$ commitlint --skip-detail --hash 9a8c08173
```
Version check:
```shell
$ commitlint --version
# or
$ commitlint -V
```
## Contribution
We appreciate feedback and contribution to this package. To get started please see our [contribution guide](./CONTRIBUTING.md).
Raw data
{
"_id": null,
"home_page": "https://github.com/opensource-nepal/commitlint",
"name": "commitlint-autorelease",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "commitlint, commit lint, python commitlint, conventional commit, conventional commit message, python commit, github actions, pre-commit",
"author": "opensource-nepal",
"author_email": "aj3sshh@gmail.com, sugatbajracharya49@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c5/21/d423889b358775f85a64deb94f94946804238f321b2ffad98502144fd81f/commitlint_autorelease-1.3.1.tar.gz",
"platform": null,
"description": "# commitlint\n\n[![PyPI version](https://badge.fury.io/py/commitlint.svg)](https://badge.fury.io/py/commitlint)\n[![CI status](https://github.com/opensource-nepal/commitlint/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/opensource-nepal/commitlint/actions)\n[![Downloads](https://img.shields.io/pypi/dm/commitlint.svg?maxAge=180)](https://pypi.org/project/commitlint/)\n[![codecov](https://codecov.io/github/opensource-nepal/commitlint/graph/badge.svg?token=lRmPZsIHb6)](https://codecov.io/github/opensource-nepal/commitlint)\n[![License](https://img.shields.io/pypi/l/commitlint?label=License)](https://github.com/opensource-nepal/commitlint/blob/main/LICENSE)\n\ncommitlint is a tool designed to lint your commit messages according to the [Conventional Commits](https://www.conventionalcommits.org/) standard for your pre-commit hook and GitHub Actions.\n\n## How to use\n\n### For pre-commit\n\n1. Add the following configuration on `.pre-commit-config.yaml`.\n\n ```yaml\n repos:\n ...\n\n - repo: https://github.com/opensource-nepal/commitlint\n rev: v0.2.1\n hooks:\n - id: commitlint\n\n ...\n ```\n\n2. Install the `commit-msg` hook in your project repo:\n\n ```bash\n pre-commit install --hook-type commit-msg\n ```\n\n> **_NOTE:_** Installing using only `pre-commit install` will not work.\n\n### For github-actions\n\nIf you have any existing workflows, add the following steps:\n\n```yaml\n...\nsteps:\n ...\n - name: Run commitlint\n uses: opensource-nepal/commitlint@v0.2.1\n ...\n```\n\nIf you don't have any workflows, create a new GitHub workflow, e.g. `.github/workflows/commitlint.yaml`.\n\n```yaml\nname: Commitlint\n\non:\n push:\n branches: ['main']\n pull_request:\n\njobs:\n commitlint:\n runs-on: ubuntu-latest\n name: Commitlint\n steps:\n - uses: actions/checkout@v4\n\n - name: Run commitlint\n uses: opensource-nepal/commitlint@v0.2.1\n```\n\n> **_NOTE:_** commitlint GitHub Actions will only be triggered by \"push\" or \"pull_request\" events.\n\n#### GitHub Action Inputs\n\n| # | Name | Type | Default | Description |\n| --- | ----------------- | ------- | ------- | --------------------------------------------------------------------- |\n| 1 | **fail_on_error** | Boolean | true | Determines whether the GitHub Action should fail if commitlint fails. |\n\n#### GitHub Action Outputs\n\n| # | Name | Type | Description |\n| --- | ------------- | ------- | ---------------------------------------------------------------------------- |\n| 1 | **exit_code** | Integer | The exit code of the commitlint step. |\n| 2 | **status** | String | The outcome of the commitlint step. Possible values: 'success' or 'failure'. |\n\n\n## CLI (Command Line Interface)\n\n### Installation \n\n```shell\npip install commitlint\n```\n\n### Usage\n```\n$ commitlint --help\nusage: commitlint [-h] [-V] [--file FILE] [--hash HASH] [--from-hash FROM_HASH] [--to-hash TO_HASH] [--skip-detail] [commit_message]\n\nCheck if a commit message follows the conventional commit format.\n\npositional arguments:\n commit_message The commit message to be checked.\n\noptional arguments:\n -h, --help show this help message and exit\n -V, --version show program's version number and exit\n --file FILE Path to a file containing the commit message.\n --hash HASH Commit hash\n --from-hash FROM_HASH\n From commit hash\n --to-hash TO_HASH To commit hash\n --skip-detail Skip the detailed error message check\n```\n\n### Examples\nCheck commit message directly:\n \n```shell\n$ commitlint \"chore: my commit message\"\n```\n\nCheck commit message from file:\n\n```shell\n$ commitlint --file /foo/bar/commit-message.txt\n```\n\nCheck commit message of a hash:\n\n```shell\n$ commitlint --hash 9a8c08173\n```\n\nCheck commit message of a hash range:\n\n```shell\n$ commitlint --from-hash 00bf73fef7 --to-hash d6301f1eb0\n```\n\nCheck commit message skipping the detail check:\n\n```shell\n$ commitlint --skip-detail \"chore: my commit message\"\n# or\n$ commitlint --skip-detail --hash 9a8c08173\n```\n\nVersion check:\n\n```shell\n$ commitlint --version\n# or\n$ commitlint -V\n```\n\n## Contribution\n\nWe appreciate feedback and contribution to this package. To get started please see our [contribution guide](./CONTRIBUTING.md).\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "commitlint is is a pre-commit hook designed to lint your commit messages according to the Conventional Commits standard.",
"version": "1.3.1",
"project_urls": {
"Changelog": "https://github.com/opensource-nepal/commitlint/blob/main/CHANGELOG.md",
"Homepage": "https://github.com/opensource-nepal/commitlint",
"Source": "https://github.com/opensource-nepal/commitlint"
},
"split_keywords": [
"commitlint",
" commit lint",
" python commitlint",
" conventional commit",
" conventional commit message",
" python commit",
" github actions",
" pre-commit"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eb91a1b6fd19fd78429da3e121a735a907c61600e77abb8a3845983789245668",
"md5": "5fa21fb8f438b3afc14f04d10257c40b",
"sha256": "3fc5eebadcc9cd6ac7a64008c6cbcced235b9795b5da10ed8a6ea19ad5c0541f"
},
"downloads": -1,
"filename": "commitlint_autorelease-1.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5fa21fb8f438b3afc14f04d10257c40b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 24768,
"upload_time": "2024-05-11T12:16:37",
"upload_time_iso_8601": "2024-05-11T12:16:37.659388Z",
"url": "https://files.pythonhosted.org/packages/eb/91/a1b6fd19fd78429da3e121a735a907c61600e77abb8a3845983789245668/commitlint_autorelease-1.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c521d423889b358775f85a64deb94f94946804238f321b2ffad98502144fd81f",
"md5": "c167b636787476ceef80c2e6055e19c9",
"sha256": "af46a521f172b435f74789e9bd4c470eb129eb158b034a9686d5d92de8c752cf"
},
"downloads": -1,
"filename": "commitlint_autorelease-1.3.1.tar.gz",
"has_sig": false,
"md5_digest": "c167b636787476ceef80c2e6055e19c9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25057,
"upload_time": "2024-05-11T12:16:39",
"upload_time_iso_8601": "2024-05-11T12:16:39.511949Z",
"url": "https://files.pythonhosted.org/packages/c5/21/d423889b358775f85a64deb94f94946804238f321b2ffad98502144fd81f/commitlint_autorelease-1.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-11 12:16:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "opensource-nepal",
"github_project": "commitlint",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "commitlint-autorelease"
}