docs: implement git client hook for developers, close #1578 (#1584)

This commit is contained in:
wit liu 2025-10-08 12:32:26 +08:00 committed by GitHub
parent 486d4cae73
commit 42da35b86c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 0 deletions

20
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,20 @@
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
- id: check-toml
- id: check-symlinks
- id: fix-byte-order-marker
- id: check-added-large-files
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-fmt
- id: go-vet
- id: go-imports
- id: go-mod-tidy

View file

@ -2,3 +2,4 @@
- [JSONRPC API](./xdc/jsonrpc.md)
- [Validator Contract](./xdc/validator.md)
- [Development environment](develop.md)

14
docs/develop.md Normal file
View file

@ -0,0 +1,14 @@
# How to setup development environment
## pre-commit
```bash
# Install pre-commit
pipx install pre-commit
# Install git hook
pre-commit install
# Uninstall git hook
pre-commit uninstall
```