From 3dd9ed4faddbd699635b4787fe4994b7f12cce50 Mon Sep 17 00:00:00 2001 From: wit Date: Thu, 25 Sep 2025 10:45:20 +0800 Subject: [PATCH] docs: implement git client hook for developers, close #1578 --- .pre-commit-config.yaml | 20 ++++++++++++++++++++ docs/README.md | 1 + docs/develop.md | 14 ++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 docs/develop.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..115df443df3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/docs/README.md b/docs/README.md index 3c173cfae35..a1184823db4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,3 +2,4 @@ - [JSONRPC API](./xdc/jsonrpc.md) - [Validator Contract](./xdc/validator.md) +- [Development environment](develop.md) diff --git a/docs/develop.md b/docs/develop.md new file mode 100644 index 00000000000..93701a636bd --- /dev/null +++ b/docs/develop.md @@ -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 +```