feat: migrate from pre-commit to prek

Replace pre-commit with prek, a faster Rust-based alternative that is
7x faster for installation and 6x faster for execution while being
fully compatible with .pre-commit-config.yaml.

Changes:
- Remove pre-commit from pyproject.toml dev dependencies
- Update scripts/setup-git-hooks.sh to use prek
- Update developer documentation (introduction.mdx)
- Update security documentation (software-security.mdx)
- Update AGENTS.md files with new commands
- Regenerate poetry.lock

prek is installed as a standalone tool via:
- pipx install prek (recommended)
- brew install prek
- uv tool install prek

Benchmarks on Prowler codebase:
- Cold install: 25.18s → 3.42s (7.37x faster)
- Warm execution: 87.53s → 14.80s (5.92x faster)
- Cache size: 170MB → 154MB (9.4% smaller)
This commit is contained in:
alejandrobailo
2026-01-26 18:05:33 +01:00
parent 34787659b9
commit d46f649ff1
7 changed files with 62 additions and 125 deletions
+20 -4
View File
@@ -116,18 +116,34 @@ In case you have any doubts, consult the [Poetry environment activation guide](h
</Warning>
### Pre-Commit Hooks
### Git Hooks with prek
This repository uses Git pre-commit hooks managed by the [pre-commit](https://pre-commit.com/) tool, it is installed with `poetry install --with dev`. Next, run the following command in the root of this repository:
This repository uses Git hooks managed by [prek](https://github.com/j178/prek), a fast pre-commit alternative written in Rust. It is ~7x faster than traditional pre-commit while being fully compatible with `.pre-commit-config.yaml`.
Install prek (choose one method):
```shell
pre-commit install
pipx install prek # recommended
# or: brew install prek
# or: uv tool install prek
```
Then run the following command in the root of this repository:
```shell
prek install
```
Successful installation should produce the following output:
```shell
pre-commit installed at .git/hooks/pre-commit
prek hook installed at .git/hooks/pre-commit
```
To run hooks manually on all files:
```shell
prek run --all-files
```
### Code Quality and Security Checks