Skip to content

Commit

Permalink
feature: add pre-commit hooks (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
almostinf authored Aug 22, 2023
1 parent 27f09dd commit 2da331a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Check if any of the specified files are staged for commit
if git diff --name-only --cached | grep -E 'api/'; then
echo "Format swaggo annotations (swag fmt)"
swag fmt
fi

make lint
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ For full local deployment of all services, including web, graphite and metrics r
docker-compose up
```

Before pushing your changes don't forget about linter:
Before pushing, don't forget to write this command please, it will activate the pre-commit hook on the linter and auto formatting swagger documentation:

```bash
make lint
git config --local core.hooksPath .githooks/
```

0 comments on commit 2da331a

Please sign in to comment.