Skip to content

Commit

Permalink
Documentation for pre-commit (#474)
Browse files Browse the repository at this point in the history
* test

* Added documentation for pre-commit
  • Loading branch information
ivntsng authored Oct 14, 2024
1 parent e749e09 commit 0fba230
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ out*/

# .DS_Store
.DS_Store

# pre-commit
.pre-commit-config.yaml
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,31 @@ make test
make test-frontend # Run only the frontend tests
make test-backend # Run only the backend tests
```

## Optional

Install pre-commit from [here](https://pre-commit.com/) to run the formatting and static checks automatically when you commit.

Here's the pre-commit yaml configuration:

```yaml
fail_fast: true
repos:
- repo: local
hooks:
- id: format
name: Format
entry: bash -c 'make format || (echo "❌ Formatting failed. Please run make format manually and commit the changes." && exit 1) && git diff --exit-code || (echo "❌ Formatting failed but formatted file. Please add and commit again." && exit 1)'
language: system
pass_filenames: false
- id: static-checks
name: Static Checks
entry: bash -c 'make static-checks || (echo "❌ Static checks failed. Please fix the issues and try again." && exit 1)'
language: system
pass_filenames: false
- id: test
name: Run Tests
entry: bash -c 'make test || (echo "❌ Tests failed. Please fix the failing tests and try again." && exit 1)'
language: system
pass_filenames: false
```

0 comments on commit 0fba230

Please sign in to comment.