Skip to content

Commit 35d938b

Browse files
committed
chore: added docs for precommit setup
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
1 parent 624e80d commit 35d938b

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

docs/sdk_developers/setup.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,42 @@ Optional: To install all available extras (useful full-matrix testing):
174174
uv sync --dev --all-extras
175175
```
176176

177+
## Pre-Commit Tool Setup
178+
179+
To maintain high code quality and security, this repository uses `re-commit` hooks. These hooks automatically run checks (like `Ruff` for linting and `Gitleaks` for security) every time you attempt to commit code.
180+
181+
**Option 1: Using `uv` (Recommended)**
182+
183+
`uv` is recommended because it manages pre-commit within your project’s locked environment, ensuring your local linting matches the CI exactly.
184+
185+
1. **Install the git hooks:**
186+
```bash
187+
uv run pre-commit install
188+
```
189+
190+
2. **Verify your setup (Optional):**
191+
```bash
192+
uv run pre-commit run --all-files
193+
```
194+
195+
**Option 2: Using pip**
196+
197+
If you are using a standard virtual environment:
198+
199+
1. **Install the package:**
200+
```bash
201+
pip install pre-commit
202+
```
203+
204+
2. **Install the git hooks:**
205+
```bash
206+
pre-commit install
207+
```
208+
209+
Once installed, `git commit` will automatically trigger the checks.
210+
- If they **pass**: Your commit is created normally.
211+
- If they **fail**: The hooks will often fix the files for you (e.g., `Ruff` reformatting). Simply `git add` the changed files and commit again.
212+
177213
## Generate Protocol Buffers
178214

179215
The SDK uses protocol buffers to communicate with the Hedera network. Generate the Python code from the protobuf definitions:

0 commit comments

Comments
 (0)