Skip to content

Commit 59fb241

Browse files
authored
test: integrate Lefthook (#296)
* test: integrate Lefthook Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com> * build: remove poethepoet tasks Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com> --------- Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
1 parent 65ba202 commit 59fb241

File tree

4 files changed

+40
-107
lines changed

4 files changed

+40
-107
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,13 @@ jobs:
3232
run: poetry install --with dev
3333

3434
- name: Check Format
35-
run: |
36-
poetry run poe format
37-
git diff --exit-code HEAD
35+
run: poetry run ruff format --diff
3836

3937
- name: Check Lint
40-
run: poetry run poe lint
38+
run: poetry run ruff check
4139

4240
- name: Test Package
43-
run: poetry run poe test
41+
run: poetry run pytest -v --cov
4442

4543
- name: Build Package
4644
run: poetry build

lefthook.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
pre-commit:
2+
piped: true
3+
jobs:
4+
- name: install dependencies
5+
run: poetry install --with dev
6+
glob:
7+
- poetry.lock
8+
- poetry.toml
9+
- pyproject.toml
10+
11+
- name: fix formatting
12+
run: poetry run ruff format
13+
glob: "*.py"
14+
15+
- name: fix lint
16+
run: poetry run ruff check --fix
17+
glob: "*.py"
18+
19+
- name: check diff
20+
run: git diff --exit-code dist {staged_files}

poetry.lock

Lines changed: 13 additions & 96 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,21 @@ python = "^3.10"
3232
optional = true
3333

3434
[tool.poetry.group.dev.dependencies]
35+
lefthook = "^1.11.14"
3536
pytest = "^8.4.0"
36-
poethepoet = "^0.35.0"
3737
pytest-cov = "^6.2.1"
3838
ruff = "^0.11.13"
3939

4040
[tool.poetry.scripts]
4141
my_fibonacci = "my_fibonacci.__main__:main"
4242

43-
[tool.poe.tasks]
44-
format = "ruff format lib tests"
45-
lint = "ruff check lib tests"
46-
test = "pytest -v --cov=my_fibonacci"
47-
4843
[tool.coverage.report]
4944
fail_under = 100
5045
omit = ["__main__.py"]
5146

47+
[tool.coverage.run]
48+
source = ["my_fibonacci"]
49+
5250
[tool.ruff.lint]
5351
select = ["ALL"]
5452
ignore = ["D"]

0 commit comments

Comments
 (0)