1
0
mirror of https://github.com/j178/prek.git synced 2026-04-03 17:34:03 +02:00
Commit Graph

174 Commits

Author SHA1 Message Date
Jo
0adb26401d Add a global --log-file flag to specify the log file path (#817) 2025-09-29 16:30:48 +08:00
Jo
1c425e43ad Implement hook health check (#798)
* Implement hook health check

* Add node health check

* Add health check for pygrep

* Add test
2025-09-29 10:47:14 +08:00
Jo
d7c39b5733 Show error message in quiet mode (#807)
* Show error message in quiet mode

In quiet mode (`-q`), error messages will still be printed.
In silent mode (`-qq`), nothing gets printed.

* Generate cli doc

* Add test
2025-09-28 13:50:16 +08:00
Jo
d0f7c4d6b0 Add --dry-run to prek auto-update (#806) 2025-09-28 12:06:44 +08:00
Jo
df852e914a Add a hint when hooks failed in CI (#800)
* .

* Add a hint when hooks failed in CI

* Fix tests
2025-09-26 13:27:55 +08:00
Jo
04bb76fcb4 Add prek cache dir, move prek gc and prek clean under prek cache (#795)
`prek gc` and `prek clean` are still available but hidden.
2025-09-25 13:36:41 +08:00
Jo
63fc5fc8da Improve arg parsing for builtin hooks (#789)
* Improve arg parsing for builtin hooks

* Fix tests
2025-09-24 13:36:30 +08:00
Jo
4c0eb8337c Remove some unused code (#763) 2025-09-19 23:54:13 +08:00
Jo
9298e0b49e Bump pre-commit-hooks in sample-config to v6.0.0 (#761) 2025-09-19 23:36:15 +08:00
Jo
e78b46cc46 Bump rust toolchain to 1.90 (#760) 2025-09-19 22:59:01 +08:00
Jo
022ef1824c auto-update: prefer tags that are most similar to the current version (#719)
* auto-update: prefer tags that are most similar to the current version

* Add test
2025-09-15 21:35:44 +08:00
Jo
d7815f61ec Clean working tree of current workspace only (#747)
* .

* Clean working tree of current workspace only

* Fix write-tree

* Fix windows
2025-09-15 21:21:35 +08:00
Jo
6e6374dd13 Fix hook-impl don't run hooks when specified allow missing config (#716)
Closes #715
2025-09-11 16:46:07 +08:00
Kushagra Udai
4b89c003f2 Add built in byte-order-marker fixer (#700)
* Add built in byte-order-marker fixer

* fmt

* feedback

* fmt
2025-09-11 10:39:42 +08:00
Jo
3d6f9f1d5a Fix trailing-whitespace & mixed-line-ending write file path (#708) 2025-09-10 23:46:27 +08:00
Jo
56bcab7337 Fix file path handling for meta hooks in workspace mode (#699) 2025-09-10 11:39:14 +08:00
Jo
736768b4f6 Support selectors in prek install/install-hooks/hook-impl (#683)
* .

* Support selectors in `prek install`

* Support `prek install-hooks` too

* Add tests
2025-09-09 23:39:41 +08:00
Aravindan M
62438bc9dc Fix Docker image and Go version test issues for portability (#692)
* Update docker_image.rs

* Update golang.rs

* Update tests/languages/golang.rs

* Fix clippy

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-09-09 22:36:05 +08:00
Jo
9eb3a23d74 Fix check_toml and check_yaml in workspace mode (#688)
* Fix `check_toml` and `check_yaml` in workspace mode

Fixes #686

* Add test
2025-09-09 22:22:56 +08:00
Jo
d65723522f Ignore two node flaky tests for now (#691) 2025-09-09 22:03:03 +08:00
Jo
bc1b423a94 Bring back .pre-commit-config.yml support (#676)
* Bring back `.pre-commit-config.yml` support

* Fix snaps
2025-09-08 19:39:46 +08:00
Jo
4cb4f7ca54 Add a warning to hook-impl when the script needs reinstall (#647)
* Add a warning to `hook-impl` when the script needs reinstall

* add hook type

* update snaps
2025-09-07 20:35:52 +08:00
Jo
2ad6d1b2da Bump version to 0.2.0-alpha.1 (#640)
* Bump version to 0.2.0a1

* Fix version regex

* Update doc
2025-09-07 15:24:27 +08:00
Jo
1bc65c8283 Implement selector completion in workspace mode (#639)
* .

* Implement selector completion
2025-09-07 15:05:19 +08:00
Jo
d1f364278c Fix docker mount in workspace mode (#638)
* Fix docker mount in workspace mode

* Add test
2025-09-07 03:00:07 +08:00
Jo
ef7d73b9ac Show project line when project is not root (#637)
* Show project line when project is not root

* Update snap
2025-09-07 02:27:02 +08:00
Jo
3dfab69c1d Cache workspace discovery result (#636)
* Cache workspace discovery result

* Add `--refresh` to refresh cached data

* Add docs about workspace cache
2025-09-07 00:26:38 +08:00
Luiz Otavio Vilas Boas Oliveira
7b58c02700 Add a --dry-run flag to prek run (#622)
* Add dry-run argument

* Add unit tests

* Clippy

* Fix unit test

* Lint

* Tweak

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-09-06 19:24:43 +08:00
Jo
e9fc08bc6b Implement project and hook selector (#623)
* selection

* .

* complete

* rewrite

* Fix

* Fix docs

* Update doc

* Fix single config mode

* Improve

* Fix doc

* Fixes and tweaks

* Fix tests

* Fixes and tests

* Use path clean instead of canonicalized
2025-09-06 16:44:22 +08:00
Jo
6f8ee64df6 Simplify auto-update implementation (#608) 2025-09-06 16:44:22 +08:00
Jo
1b1eddf7e7 Implement auto-update in workspace mode (#605)
* Implement `auto-update` in workspace mode

* Deduplicate remote hooks

* Minor
2025-09-06 16:44:22 +08:00
Jo
2cd8f0fcb8 Fix local script hook entry path in workspace mode (#603) 2025-09-06 16:44:22 +08:00
Jo
f6034483a5 Fix hook-impl allow missing config (#600) 2025-09-06 16:44:22 +08:00
Jo
055e493fac Support prek install|install-hooks|hook-impl|init-template-dir in workspace mode (#595)
* Support `prek install|install-hooks|hook-impl|init-template-dir` in workspace mode

* Fix

* Fix windows
# Conflicts:
#	src/cli/hook_impl.rs
#	tests/hook_impl.rs

# Conflicts:
#	src/cli/install.rs
2025-09-06 16:44:22 +08:00
Jo
7f10e34e23 Support prek list in workspace mode (#586)
* Support `prek list` in workspace mode

* Update snapshot
2025-09-06 16:44:22 +08:00
Jo
8d644ef337 Fix config not staged relative filename display (#585)
* .

* Fix config not staged relative filename display
2025-09-06 16:44:22 +08:00
Jo
f089db0699 Add prek run --cd <dir> to change directory before running (#581) 2025-09-06 16:44:22 +08:00
Jo
a5a1b3b2b0 Support multiple .pre-commit-config.yaml in a workspace (monorepo mode) (#481)
* Remove color from trace log

Since `tracing-subscriber 0.3.20`, ANSI codes will be escaped so that color can not be shown in log. 4c52ca5266

* Refactor project constructure

# Conflicts:
#	src/cli/run/run.rs

* .

# Conflicts:
#	src/workspace.rs

# Conflicts:
#	src/workspace.rs

# Conflicts:
#	src/workspace.rs

.

# Conflicts:
#	src/git.rs

# Conflicts:
#	src/git.rs

# Conflicts:
#	src/git.rs
#	src/languages/script.rs

Support multiple `.pre-commit-connfig.yaml` in a workspace (monorepo mode)

.

.

Make it compile

Fix

.

.

.

Fix

Fix

Fix

.

.

.

# Conflicts:
#	src/builtin/pre_commit_hooks/fix_trailing_whitespace.rs
#	src/builtin/pre_commit_hooks/mod.rs
#	src/hook.rs
#	src/languages/docker.rs
#	src/languages/docker_image.rs
#	src/languages/golang/golang.rs
#	src/languages/node/node.rs
#	src/languages/python/python.rs
#	src/languages/system.rs
#	src/run.rs

* Refactor

* Fix

* .

* Fix `--config FILE`

* Add docs

* Misc

* Fix
# Conflicts:
#	README.md
2025-09-06 16:44:22 +08:00
Jo
e1efb81842 Reuse environment only for hooks with exactly same dependencies (#609)
* Reuse hook env only for exactly same dependencies

* Add test
2025-09-02 18:32:48 +08:00
Jo
70261e9bf6 Implement pre-push hook type (#598)
* Implement `pre-push` hook type

* Skip if nothing to push

* Improve test
2025-09-02 02:40:07 +08:00
Miao
fec96272a7 Implement check_yaml as builtin hook (#557)
* Implement `check_yaml` as built hook

* Add `args` check for `check-yaml`

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-08-27 14:31:24 +08:00
Jo
e4f642c912 Use mise for tools and tasks (#558)
* .

* Migrate more
2025-08-26 23:36:47 +08:00
Jo
c5fb6ec7f6 Support PEP 723 scripts for Python hooks (#529)
* Support PEP723 scripts for local Python hooks

Fix

Debug windows

debug

Fix

# Conflicts:
#	tests/languages/python.rs

* Fix
2025-08-25 17:07:48 +08:00
Jo
c1930b2b13 Add test for hook id completion (#532)
* Add test for hook id completion

* ignore windows
2025-08-24 18:33:58 +08:00
Jo
a0019ca9ee Fix Python hook stderr are not captured (#530)
* Fix that Python hook stderr are not captured

* Fix windows
2025-08-22 15:35:13 +08:00
Jo
d19ad4fbce Fix language: script entry join issue (#525) 2025-08-21 11:40:00 +08:00
Jo
7e080ddaeb Add check for missing hooks in new revision (#521) 2025-08-20 20:42:50 +08:00
Jo
8e230b1141 Implement prek auto-update (#511)
* .

* Implement `pre auto-update`

* .

* Add tests

* Windows

* Update tests
2025-08-20 18:17:40 +08:00
Luiz Otavio Vilas Boas Oliveira
e5b2375fe7 Add moving rev warning (#488)
* Warn user when revs are found

* Lint

* Update test snapshots

* Fix snapshot

* Tweak message

* Update tests

* fix tests

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-08-20 18:14:55 +08:00
Jo
e9232f1a30 Drop support .yml config file (#493)
* Drop support `.yml` config file

* Fix test
2025-08-19 11:53:55 +08:00