Skip to content

Commit 075a26e

Browse files
author
yanghao14
committed
chore: configure pre-commit hooks for code formatting (apache#73)
- Install pre-commit when using make setup. - Add pre-commit hooks for Python and Rust code formatting.
1 parent 3e71bb0 commit 075a26e

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.pre-commit-config.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-json
9+
- id: check-added-large-files
10+
- id: check-merge-conflict
11+
12+
- repo: https://github.com/charliermarsh/ruff-pre-commit
13+
rev: v0.2.0
14+
hooks:
15+
- id: ruff
16+
args: [--fix]
17+
- id: ruff-format
18+
19+
- repo: https://github.com/pre-commit/mirrors-mypy
20+
rev: v1.11.0
21+
hooks:
22+
- id: mypy
23+
24+
- repo: local
25+
hooks:
26+
- id: cargo-fmt
27+
name: cargo fmt
28+
entry: cargo fmt --all -- --check
29+
language: system
30+
types: [rust]
31+
pass_filenames: false

python/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ setup-venv: ## Setup the virtualenv
3030
setup: ## Setup the requirements
3131
$(info --- Setup dependencies ---)
3232
pip install "$(MATURIN_VERSION)"
33+
pip install pre-commit
34+
pre-commit install
3335

3436
.PHONY: build
3537
build: setup ## Build Python binding of delta-rs

0 commit comments

Comments
 (0)