Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore(hooks): 🧙 add code formatter in commit hook
  • Loading branch information
Angeluz-07 committed May 19, 2020
commit e43e0abba48760de4fde14cdec40e60320ea966e
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
Expand All @@ -6,3 +8,10 @@ repos:
entry: python ./commons/git_hooks/enforce_semantic_commit_msg.py
language: python
stages : [commit-msg]
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
args: [--line-length=79, --skip-string-normalization]
name: Check formatted code
stages: [commit]
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Remember to do it with Python 3.
Bear in mind that the requirements for `time_tracker_events`, must be located on its local requirements.txt, by
[convention](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python#folder-structure).

- Run `pre-commit install`. For more details, check out Development > Git hooks.
- Run `pre-commit install -t pre-commit -t commit-msg`. For more details, see section Development > Git hooks.

### How to use it
- Set the env var `FLASK_APP` to `time_tracker_api` and start the app:
Expand Down Expand Up @@ -153,11 +153,10 @@ func azure functionapp publish time-tracker-events --build local
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:

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

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

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