Skip to content

Commit 8ae6110

Browse files
committed
feat: add pre-commit hooks for cargo fmt and cargo clippy
1 parent 3612735 commit 8ae6110

3 files changed

Lines changed: 39 additions & 3 deletions

File tree

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: cargo-fmt
5+
name: cargo fmt (rustfmt)
6+
entry: cargo fmt --all
7+
language: system
8+
pass_filenames: false
9+
stages: [commit, push]
10+
- id: cargo-clippy
11+
name: cargo clippy (deny warnings)
12+
entry: cargo clippy --all-targets --all-features -- -D warnings
13+
language: system
14+
pass_filenames: false
15+
stages: [commit, push]

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,29 @@ GitDatabase é uma solução que indexa repositórios Git e expõe os dados em P
3131

3232
---
3333

34+
## Pre-commit (fmt + clippy)
35+
36+
Este repositório inclui hooks via **pre-commit** para rodar `cargo fmt` e `cargo clippy`
37+
antes de commitar e antes de fazer push.
38+
39+
### Instalação
40+
41+
Instale o pre-commit (exemplos):
42+
43+
- `pipx install pre-commit`
44+
- `pip install --user pre-commit`
45+
- `brew install pre-commit`
46+
47+
Depois, ative os hooks:
48+
49+
- `pre-commit install --hook-type pre-commit --hook-type pre-push`
50+
51+
Para rodar manualmente em todos os arquivos:
52+
53+
- `pre-commit run --all-files`
54+
55+
---
56+
3457
## Subindo o Postgres (Docker)
3558

3659
```bash

crates/gitbase-pgwire/src/handler.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ impl GitbaseHandler {
137137
&self.blob_config,
138138
)
139139
.await
140-
.map_err(|e| {
141-
PgWireError::ApiError(Box::new(std::io::Error::other(e.to_string())))
142-
})?;
140+
.map_err(|e| PgWireError::ApiError(Box::new(std::io::Error::other(e.to_string()))))?;
143141

144142
Ok(())
145143
}

0 commit comments

Comments
 (0)