Skip to content

Commit 94575ce

Browse files
authored
build: update build tool to poetry and use ruff for linting (#69)
1 parent 02e7ff4 commit 94575ce

File tree

11 files changed

+615
-401
lines changed

11 files changed

+615
-401
lines changed

.github/workflows/ci.yaml

+7-33
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
python-version: ['3.8']
14+
python-version: ['3.10']
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -24,48 +24,22 @@ jobs:
2424
- name: Install Pipenv
2525
run: |
2626
python -m pip install --upgrade pip
27-
python -m pip install pipenv
27+
python -m pip install poetry
2828
2929
- name: Install dependencies
3030
run: |
31-
pipenv install --dev
31+
poetry install
32+
33+
- name: Run Lint
34+
uses: astral-sh/ruff-action@v3
3235

3336
- name: Run tests with coverage
3437
run: |
35-
pipenv run coverage-xml
38+
poetry run pytest --cov=src/ --cov-report=xml --no-cov-on-fail
3639
3740
- name: Send coverage to CodeCov
3841
uses: codecov/codecov-action@v3
3942
with:
4043
token: ${{ secrets.CODECOV_TOKEN }}
4144
fail_ci_if_error: false
4245
verbose: true
43-
44-
linting:
45-
runs-on: ubuntu-latest
46-
steps:
47-
- uses: actions/checkout@v4
48-
49-
- name: Set up Python
50-
uses: actions/setup-python@v5
51-
with:
52-
python-version: '3.8'
53-
54-
- name: Install lint dependencies
55-
run: pip install flake8 mypy isort
56-
57-
- name: flake8
58-
uses: liskin/gh-problem-matcher-wrap@v3
59-
with:
60-
linters: flake8
61-
run: flake8 --max-line-length=88 --ignore=E203,W503 src/
62-
- name: mypy
63-
uses: liskin/gh-problem-matcher-wrap@v3
64-
with:
65-
linters: mypy
66-
run: mypy --strict --show-column-numbers src/
67-
- name: isort
68-
uses: liskin/gh-problem-matcher-wrap@v3
69-
with:
70-
linters: isort
71-
run: isort --line-length=88 --check --profile black src/

.pre-commit-config.yaml

+6-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ repos:
33
hooks:
44
- id: run-tests
55
name: Run tests
6-
entry: pipenv run test
6+
entry: poetry run pytest
77
language: system
88
pass_filenames: false
99

@@ -24,20 +24,9 @@ repos:
2424
- id: end-of-file-fixer
2525
- id: trailing-whitespace
2626

27-
- repo: https://github.com/akaihola/darker
28-
rev: 1.7.1
27+
- repo: https://github.com/astral-sh/ruff-pre-commit
28+
rev: v0.9.6
2929
hooks:
30-
- id: darker
31-
args:
32-
- --isort
33-
- --flynt
34-
- --lint=flake8 --max-line-length=88 --ignore=E203,W503
35-
- --lint=mypy --strict
36-
- --lint=pylint --max-line-length=88 --disable=W0511
37-
additional_dependencies:
38-
- black==23.3.0
39-
- flake8==5.0.4
40-
- flynt==0.77
41-
- isort==5.12.0
42-
- mypy==1.8.0
43-
- pylint==2.17.4
30+
- id: ruff
31+
args: [ --fix ]
32+
- id: ruff-format

CONTRIBUTING.md

+90-22
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,111 @@
1-
# How to Contribute
1+
# Contributing Guide
22

3-
## Install Development Dependencies (Using Pipenv)
3+
Thank you for your interest in contributing to the **commitlint** project!
4+
Your contributions will help improve and enhance this tool.
5+
Please take a moment to review the following guidelines before getting started.
46

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.html](https://pipenv.pypa.io/en/latest/installation.html).
7+
## Prerequisites
68

7-
Once Pipenv is installed, you can install the development dependencies by running the following command:
9+
Before contributing, ensure that you have the following:
10+
11+
- **Python 3.10 or higher** installed. Download it from the [official Python website](https://www.python.org/downloads/).
12+
- **Poetry** installed for dependency management. Follow the [Poetry installation guide](https://python-poetry.org/docs/#installation).
13+
14+
## Getting Started
15+
16+
To set up the project on your local machine, follow these steps:
17+
18+
1. **Fork** the repository on GitHub.
19+
2. **Clone** the forked repository to your local machine:
20+
21+
```bash
22+
git clone https://github.com/<your-username>/commitlint.git
23+
cd commitlint
24+
```
25+
26+
3. **Install dependencies**:
27+
28+
```bash
29+
poetry install
30+
```
31+
32+
4. **Verify your setup**:
33+
34+
```bash
35+
poetry run commitlint --version
36+
```
37+
38+
## Tests
39+
40+
Run tests
841

942
```bash
10-
pipenv install --dev
43+
poetry run pytest
1144
```
1245

13-
## Install pre-commit hooks
46+
Run tests with coverage
47+
48+
```bash
49+
poetry run pytest --cov=src
50+
```
1451

15-
To install pre-commit and commit-msg hook for this project, run the following command:
52+
Generate html coverage
1653

1754
```bash
18-
pipenv run install-hooks
55+
poetry run pytest --cov=src/ --cov-report=html
1956
```
2057

21-
## Run tests
58+
## Use pre-commit hook
2259

23-
Run the tests using the below command:
60+
Install pre-commit hook using the command below.
2461

2562
```bash
26-
pipenv run test
63+
poetry run pre-commit install --hook-type pre-commit --hook-type commit-msg
2764
```
2865

29-
## Before submitting
66+
## Pull Requests
67+
68+
We welcome and appreciate pull requests from the community. To contribute:
69+
70+
1. **Fork** the repository and create a new branch based on the `main` branch:
71+
72+
```bash
73+
git checkout -b <your-branch-name>
74+
```
75+
76+
2. **Write tests** for your changes if applicable.
77+
3. **Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)** for commit messages.
78+
Examples:
79+
80+
- `feat: add commit message validation`
81+
- `fix(parser): resolve message parsing issue`
82+
83+
4. **Push** your branch to your forked repository:
84+
85+
```bash
86+
git push origin <your-branch-name>
87+
```
88+
89+
5. **Create a Pull Request**:
90+
91+
- Open a pull request from your branch to the `main` branch of the original repository.
92+
- Provide a clear and concise description of the changes, along with relevant context.
93+
94+
6. **Review & Feedback**:
95+
96+
- Participate in the code review process and address any feedback promptly.
97+
98+
## License
99+
100+
By contributing to this project, you agree that your contributions will be licensed under the **GPL-3.0 License**.
101+
Refer to the [LICENSE](./LICENSE) file for more details.
30102

31-
Before submitting your Pull Request, please do the following steps:
103+
## Other Ways to Contribute
32104

33-
1. Add any changes you want.
34-
1. Add tests for the new changes.
35-
1. Edit documentation (`README.md`) if you have changed something significant.
36-
1. Commit your changes using [semantic commit message](https://seesparkbox.com/foundry/semantic_commit_messages).
37-
Examples: `"fix: Fixed foobar bug"`, `"feat(accounts): Added foobar feature on accounts"`.
105+
Even if you don’t contribute code, you can still help:
38106

39-
## Other help
107+
- **Spread the word** about this tool.
108+
- Write a blog or article about how you use this project.
109+
- Share your best practices, examples, or ideas with us.
40110

41-
You can contribute by spreading a word about this library.
42-
It would also be a huge contribution to write a short article on how you are using this project.
43-
You can also share your best practices with us.
111+
Thank you for contributing to **commitlint**! 🎉

Pipfile

-18
This file was deleted.

0 commit comments

Comments
 (0)