Skip to content

Commit 60d361a

Browse files
committed
feat: added commitlint cli and pre-commit hooks
1 parent c44ebb0 commit 60d361a

12 files changed

+511
-1
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,6 @@ cython_debug/
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
#.idea/
161+
162+
.vscode
163+
.DS_Store

.pre-commit-config.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: commitlint
5+
name: Commitlint
6+
entry: python -m src.commitlint.cli --file
7+
language: python
8+
stages: [commit-msg]
9+
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v4.4.0
12+
hooks:
13+
- id: check-merge-conflict
14+
- id: check-added-large-files
15+
- id: check-yaml
16+
- id: pretty-format-json
17+
args: [--autofix]
18+
- id: end-of-file-fixer
19+
- id: trailing-whitespace
20+
21+
- repo: https://github.com/akaihola/darker
22+
rev: 1.7.1
23+
hooks:
24+
- id: darker
25+
args:
26+
- --isort
27+
- --flynt
28+
- --lint=flake8 --max-line-length=88 --ignore=E203,W503
29+
- --lint=mypy --strict
30+
- --lint=pylint --max-line-length=88 --disable=W0511
31+
additional_dependencies:
32+
- black==23.3.0
33+
- flake8==5.0.4
34+
- flynt==0.77
35+
- isort==5.12.0
36+
- mypy==1.8.0
37+
- pylint==2.17.4

.pre-commit-hooks.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- id: commitlint
2+
name: commitlint
3+
description: "commitlint for conventional commit message"
4+
entry: commitlint --file
5+
language: python
6+
stages: [commit-msg]

CONTRIBUTING.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# How to Contribute
2+
3+
## Install Development Dependencies (Using Pipenv)
4+
5+
All the dependencies are managed by Pipenv. Please install Pipenv on your system first by following the instructions at [https://pipenv.pypa.io/en/latest/installation/](https://pipenv.pypa.io/en/latest/installation/).
6+
7+
Once Pipenv is installed, you can install the development dependencies by running the following command:
8+
9+
```bash
10+
pipenv install --dev
11+
```
12+
13+
## Install pre-commit hooks
14+
15+
To install pre-commit and commit-msg hook for this project, run the following command:
16+
17+
```bash
18+
pipenv run install-hooks
19+
```

Pipfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
8+
[dev-packages]
9+
pre-commit = "*"
10+
pytest = "*"
11+
pytest-cov = "*"
12+
13+
[scripts]
14+
test = "pytest"
15+
coverage = "pytest --cov=src/ --no-cov-on-fail"
16+
install-hooks = "pre-commit install --hook-type pre-commit --hook-type commit-msg"

Pipfile.lock

+263
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
11
# commitlint
2-
commitlint is is a pre-commit hook designed to lint your commit messages according to the Conventional Commits standard.
2+
3+
commitlint is is a pre-commit hook designed to lint your commit messages according to the [Conventional Commits](https://www.conventionalcommits.org/) standard.
4+
5+
## How to use
6+
7+
1. Add the following configuration on `.pre-commit-config.yaml`.
8+
9+
```yaml
10+
repos:
11+
...
12+
13+
- repo: https://github.com/opensource-nepal/commitlint
14+
rev: 0.1.0
15+
hooks:
16+
- id: commitlint
17+
18+
...
19+
```
20+
21+
2. Install the `commit-msg` hook in your project repo:
22+
23+
```bash
24+
pre-commit install --hook-type commit-msg
25+
```
26+
27+
> **_NOTE:_** Installing just using `pre-commit install` will not work.
28+
29+
## Contribution
30+
31+
We appreciate feedback and contribution to this package. To get started please see our [contribution guide](./CONTRIBUTING.md).

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]
3+
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)