Skip to content

Commit a3a6654

Browse files
authored
Merge pull request #146 from ioet/chore/add-formatting-in-commit-hook#144
chore(hooks): 🧙 add code formatter in commit hook
2 parents a1f67f5 + e43e0ab commit a3a6654

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
13
repos:
24
- repo: local
35
hooks:
@@ -6,3 +8,10 @@ repos:
68
entry: python ./commons/git_hooks/enforce_semantic_commit_msg.py
79
language: python
810
stages : [commit-msg]
11+
- repo: https://github.com/psf/black
12+
rev: stable
13+
hooks:
14+
- id: black
15+
args: [--line-length=79, --skip-string-normalization]
16+
name: Check formatted code
17+
stages: [commit]

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Remember to do it with Python 3.
5151
Bear in mind that the requirements for `time_tracker_events`, must be located on its local requirements.txt, by
5252
[convention](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python#folder-structure).
5353
54-
- Run `pre-commit install`. For more details, check out Development > Git hooks.
54+
- Run `pre-commit install -t pre-commit -t commit-msg`. For more details, see section Development > Git hooks.
5555
5656
### How to use it
5757
- Set the env var `FLASK_APP` to `time_tracker_api` and start the app:
@@ -153,11 +153,10 @@ func azure functionapp publish time-tracker-events --build local
153153
We use [pre-commit](https://github.com/pre-commit/pre-commit) library to manage local git hooks, as developers we just need to run in our virtual environment:
154154

155155
```
156-
pre-commit install
156+
pre-commit install -t pre-commit -t commit-msg
157157
```
158158
With this command the library will take configuration from `.pre-commit-config.yaml` and will set up the hooks by us.
159159

160-
Currently, we only have a hook to enforce semantic commit message.
161160

162161
### Test
163162
We are using [Pytest](https://docs.pytest.org/en/latest/index.html) for tests. The tests are located in the package

0 commit comments

Comments
 (0)