Skip to content

Commit 6647960

Browse files
committed
fix #153
1 parent 3738c1a commit 6647960

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

.pre-commit-config.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: lint
5+
name: Lint
6+
entry: just lint
7+
language: system
8+
pass_filenames: false
9+
- id: format
10+
name: Format
11+
entry: just format
12+
language: system
13+
pass_filenames: false

doc/source/changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Change Log
77
v3.0.0 (202X-XX-XX)
88
===================
99

10+
* Implemented `Add precommit hook to fix safe lint and format issues <https://github.com/django-commons/django-typer/issues/153>`_
1011
* BREAKING `Remove name parameter from initialize()/callback(). <https://github.com/django-commons/django-typer/issues/150>`_
1112
* Implemented `Run full test suite on mac osx <https://github.com/django-commons/django-typer/issues/148>`_
1213
* Implemented `Convert check.sh to justfile <https://github.com/django-commons/django-typer/issues/147>`_

justfile

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ init:
1212
poetry config --local virtualenvs.in-project true
1313
poetry run pip install --upgrade pip setuptools wheel
1414

15+
install-precommit:
16+
poetry run pre-commit install
17+
1518
install *PACKAGES="Django":
1619
poetry env use python
1720
poetry lock
1821
poetry install -E rich
22+
poetry run pre-commit install
1923
poetry run pip install -U {{ PACKAGES }}
2024

2125
install-colorama:
@@ -95,7 +99,7 @@ sort-imports:
9599
lint: sort-imports
96100
poetry run ruff check --fix
97101

98-
fix: format lint
102+
fix: lint format
99103

100104
check: check-lint check-format check-types check-package check-docs check-docs-links check-readme
101105

@@ -115,7 +119,8 @@ test: test-rich test-no-rich install-colorama
115119
test-cases +TESTS:
116120
poetry run pytest {{ TESTS }}
117121

118-
precommit: fix
122+
precommit:
123+
poetry run pre-commit
119124

120125
coverage:
121126
poetry run coverage combine --keep *.coverage

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ graphviz = ">=0.20.3"
9595
pluggy = ">=1.5.0"
9696
pywinpty = { version = ">=2.0.14", markers = "sys_platform == 'win32'" }
9797
pytest-timeout = ">=2.3.1"
98+
pre-commit = ">=4.0.1"
9899

99100
[tool.poetry.extras]
100101
rich = ["rich"]

0 commit comments

Comments
 (0)