Skip to content

Commit 7979b80

Browse files
thiagowfxAmp
andcommitted
chore: migrate from pre-commit to prek
Amp-Thread-ID: https://ampcode.com/threads/T-019c32cc-0f6a-75ff-8d0d-d3078604f2c8 Co-authored-by: Amp <amp@ampcode.com>
1 parent 5a056c2 commit 7979b80

4 files changed

Lines changed: 31 additions & 33 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pre-commit
1+
name: Prek
22

33
on:
44
pull_request:
@@ -11,13 +11,11 @@ permissions:
1111
contents: read
1212

1313
jobs:
14-
pre-commit:
14+
prek:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1818
with:
1919
persist-credentials: false
2020
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
21-
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
22-
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0
23-
if: always()
21+
- uses: j178/prek-action@564dda4cfa5e96aafdc4a5696c4bf7b46baae5ac # v1.1.0

.pre-commit-config.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
# yaml-language-server: $schema=https://json.schemastore.org/pre-commit-config.json
22
#
3-
# See https://pre-commit.com for more information
4-
# See https://pre-commit.com/hooks.html for more hooks
3+
# See https://prek.j178.dev for more information
4+
# Migrated from pre-commit to prek: https://prek.j178.dev/benchmark/
55
#
6-
# Install pre-commit itself:
7-
# $ pip install pre-commit
6+
# Install prek itself:
7+
# $ cargo install prek
88
# OR
9-
# $ brew install pre-commit
9+
# $ brew install prek
1010
#
11-
# Update all pre-commit hooks to latest version:
12-
# $ pre-commit autoupdate --freeze
11+
# Update all prek hooks to latest version:
12+
# $ prek auto-update --freeze
1313
#
14-
# Install all default pre-commit hooks locally:
15-
# $ pre-commit install
14+
# Install all default prek hooks locally:
15+
# $ prek install
1616
#
17-
# Apply a given pre-commit hook to all files:
18-
# $ pre-commit run --all-files <id>
17+
# Apply a given prek hook to all files:
18+
# $ prek run --all-files <id>
1919
#
20-
# Apply all pre-commit hooks to all files:
21-
# $ pre-commit run --all-files
20+
# Apply all prek hooks to all files:
21+
# $ prek run --all-files
2222
ci:
2323
autoupdate_schedule: monthly
2424
skip:

CLAUDE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ This is a collection of custom [pre-commit](https://pre-commit.com) hooks implem
99
## Development Commands
1010

1111
```bash
12-
# Run all pre-commit hooks on all files
13-
pre-commit run --all-files
12+
# Run all prek hooks on all files
13+
prek run --all-files
1414

1515
# Run a specific hook on all files
16-
pre-commit run --all-files <hook-id>
16+
prek run --all-files <hook-id>
1717

1818
# Update hooks to latest versions (with frozen revisions)
19-
pre-commit autoupdate --freeze
19+
prek auto-update --freeze
2020

2121
# Install hooks locally
22-
pre-commit install
22+
prek install
2323
```
2424

2525
## Architecture
2626

2727
- **`.pre-commit-hooks.yaml`**: Hook definitions that consumers reference. Uses `keep-sorted` directives to maintain alphabetical order.
2828
- **`scripts/`**: Shell script implementations for each hook. All scripts use `#!/usr/bin/env bash` and `set -euo pipefail`.
29-
- **`.pre-commit-config.yaml`**: This repo's own pre-commit configuration, used for self-validation and CI.
29+
- **`.pre-commit-config.yaml`**: This repo's own prek configuration, used for self-validation and CI.
3030

3131
## Adding New Hooks
3232

@@ -36,7 +36,7 @@ pre-commit install
3636

3737
## CI
3838

39-
- **pre-commit.yml**: Runs pre-commit hooks on all files
39+
- **prek.yml**: Runs prek hooks on all files
4040
- **ls-lint.yml**: Validates file naming conventions
4141

42-
The `just-format` hook is skipped in CI (pre-commit.ci) because `just` is not available there.
42+
The `just-format` hook is skipped in CI (prek) because `just` is not available there.

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ A collection of [pre-commit](https://pre-commit.com) hooks.
88

99
<!-- BEGIN mdsh -->
1010
[![ls-lint.yml](https://github.com/thiagowfx/pre-commit-hooks/actions/workflows/ls-lint.yml/badge.svg)](https://github.com/thiagowfx/pre-commit-hooks/actions/workflows/ls-lint.yml)
11-
[![pre-commit.yml](https://github.com/thiagowfx/pre-commit-hooks/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/thiagowfx/pre-commit-hooks/actions/workflows/pre-commit.yml)
11+
[![prek.yml](https://github.com/thiagowfx/pre-commit-hooks/actions/workflows/prek.yml/badge.svg)](https://github.com/thiagowfx/pre-commit-hooks/actions/workflows/prek.yml)
1212
<!-- END mdsh -->
1313

1414
## Installation
1515

16-
To use these hooks, you'll need to have `pre-commit` installed. You can install
17-
it using `pip`:
16+
To use these hooks, you'll need to have `prek` installed. You can install
17+
it using `cargo`:
1818

1919
```bash
20-
pip install pre-commit
20+
cargo install prek
2121
```
2222

2323
Or using Homebrew on macOS:
2424

2525
```bash
26-
brew install pre-commit
26+
brew install prek
2727
```
2828

2929
## Usage
@@ -45,8 +45,8 @@ repos:
4545
- id: sort-codeowners-sections
4646
```
4747
48-
Then, run `pre-commit autoupdate` to update the hooks to the latest version and
49-
`pre-commit install` to install the hooks in your local repository.
48+
Then, run `prek auto-update` to update the hooks to the latest version and
49+
`prek install` to install the hooks in your local repository.
5050

5151
## Available Hooks
5252

0 commit comments

Comments
 (0)