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

93 Commits

Author SHA1 Message Date
Jo
4a864b33db Minor tweaks (#994)
* Minor tweaks

* Fix snaps
2025-10-30 16:49:33 +08:00
Les Freire
ed3f357f85 Support language: lua hooks (#954)
* Add Lua language support

Refactor Lua integration: streamline async functions and improve rockspec file handling

Add Lua and LuaRocks installation steps to CI workflow

Add MSVC development command to CI workflow

Update CI workflow to specify Windows-only dependencies for MSVC and Lua installations

Update CI workflow to use official Lua and LuaRocks GitHub actions

Update CI workflow to specify Windows-only dependencies for Lua and LuaRocks installations

Update CI workflow to use PowerShell for Cargo test execution and improve command formatting

Add platform-specific command snapshots for Lua tests

Enhance the Lua test environment by adding separate command snapshots for Windows and non-Windows platforms. This ensures accurate output handling based on the operating system, improving test reliability and clarity.

Update CI workflow to use specific versions of Lua and LuaRocks actions

Refactor Lua dependency installation and update test cases

Refactor Lua command execution to streamline environment path handling

Fix dependencies installing

Fix remote repo hook

* Add lua remote_hook test

* Tweaks

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-10-24 19:36:38 +08:00
Jo
697b101b6d Improve styling for stashing error message (#953) 2025-10-22 16:34:08 +08:00
Jo
a4e8f20c8d Support language_version: system (#949)
* .

* Support `language_version: system`

* Fix python downloads
2025-10-21 20:23:32 +08:00
Jo
054e1fbb00 Error out if not projects found (#913) 2025-10-17 16:16:05 +08:00
Aditya Yadav
67d956e8a0 Add --fail-fast CLI flag to stop after first hook failure (#908)
* Add --fail-fast CLI flag to stop after first hook failure

- Add fail_fast field to RunArgs struct with CLI flag support
- Fix in hook_impl.rs where fail_fast was hardcoded to false
- Update run() and run_hooks() to accept and propagate fail_fast parameter
- CLI flag overrides config file setting (enables fail-fast mode)
- Ensure try-repo and main entry point pass fail_fast correctly

* Update test snapshots for --fail-fast flag

* Add CLI flag test for --fail-fast

* Fix trailing whitespace in test comment
2025-10-17 11:07:27 +08:00
Nyakku Shigure
88b1e796cd Allow run --files with zero args (#831) 2025-10-01 21:22:54 +08:00
Nyakku Shigure
7b8cb627bd Support pass multiple files like prek run --files a b c d (#828) 2025-10-01 19:32:27 +08:00
Jo
0adb26401d Add a global --log-file flag to specify the log file path (#817) 2025-09-29 16:30:48 +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
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
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
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
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
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
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
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
e9232f1a30 Drop support .yml config file (#493)
* Drop support `.yml` config file

* Fix test
2025-08-19 11:53:55 +08:00
Jo
bcb2218d8a Fix git commit -a does not pick up staged files correctly (#487) 2025-08-18 16:16:39 +08:00
Jo
3f1f9e1056 Various fixes to init-templdate-dir and directory related bug (#484)
* various fixes

* Fix tests

* Fix
2025-08-18 14:30:18 +08:00
Jo
3ac5e2beb0 Fix inde.lock file exists error when running git commit -p or git commit -a (#482)
* Fix `inde.lock file exists` error when running `git commit -p` or `git commit -a`

* Add test

* Add tests

* Windows
2025-08-18 11:00:51 +08:00
Jo
6f6278f54b Refactor project constructure (#476)
* Refactor project constructure

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

* Clean

* Fix tests
2025-08-16 22:45:31 +08:00
Jo
f83f9a8668 Resolve script shebang before running (#475)
* Resolve script shebang on Windows

* Fix test

* Simplify node

* Improve
2025-08-16 19:52:52 +08:00
Jo
0844d73be0 Run hooks with pty if color enabled (#471)
* .

* 。

* .

* Vendor pty-process

* Use pty_output

* Fix windows

* No need pty for docker commands

* Fix windows

* Fix windows

* Add test

* Try

* Fix linux hang

* Remove read

* try

* Revert "try"

This reverts commit 8298ea6619.

* Add comment
2025-08-16 11:49:32 +08:00
tmdhhl
b1f929a1b6 Warn unexpected keys in config (#463)
* warn unexpected keys.

* Tweak

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-08-15 21:13:37 +08:00
Jo
e0426ed6f4 Bump version to 0.0.25 (#456) 2025-08-15 00:15:51 +08:00
Jo
b0ca7f157e Add warning for non-existent hook id (#450)
* Add warning for non-existent hook id

* Improve
2025-08-13 19:46:42 +08:00
Jo
b10330456d Add check for minimum_prek_version (#437)
* Add check for `minimum_prek_version`

* Fix

* Fix
2025-08-12 13:54:40 +08:00
Jo
cb43e982a7 Support prek run multiple hooks (#423)
* Support `prek run` multiple hooks

* Update diff

* update tests
2025-08-11 17:03:12 +08:00
Miao
79fa466406 Make error message handling in tests more robust (#403)
* Make error message handling in tests more robust

* Check node versions more reliably
2025-08-09 00:44:51 +08:00
Jo
23f865819a Rename project to prek from prefligit (#402) 2025-08-08 23:12:20 +08:00
Jo
9de06bc221 Fix meta hook check_useless_excludes (#401)
* Fix meta hook `check_useless_excludes`

* move tests
2025-08-08 21:57:29 +08:00
Jo
e7e227a53e Fix bug that default hook stage should be pre-commit (#367)
* Fix bug that default hook stage should be pre-commit

* fix test
2025-08-06 18:33:03 +08:00
Jo
f1baa8a15b Add --directory to prefligit run (#358)
* Add `--directory` to `prefligit run`

* Add tests

* Normalize path
2025-08-05 23:27:00 +08:00
luo jiyin
91f88f209d Add --last-commit flag to prefligit run (#351)
* feat: last commit flag

* fix: lint error

* fix: clippy error

* test: last commit

* fix(test): more clear test case

* fix: lint error
2025-08-05 16:32:47 +08:00
Jo
2e2b9dea94 Fix bug that directories are ignored (#350)
* Fix bug that directories are ignored

Also add a friendly warning for files that aren't exist.

* Add test

* Add tests

* Fix test
2025-08-05 12:04:29 +08:00
Jo
0253181df8 Reimplement find matching env logic (#327)
* Reimplement find matching env logic

* Fix test

* Fix
2025-08-03 20:35:03 +08:00
Jo
5ac91b9be3 Fix issue that entry of pygrep is not shell commands (#316)
* Fix issue that `entry` of `pygrep` is not shell commands

* Fix snap
2025-08-03 10:40:09 +08:00
Jo
c7641c41e5 Improve error message for hook (#308)
* .

* Improve error message for hook

* Improve

* Add test

* Fix

* Fix
2025-08-02 18:44:59 +08:00
Jo
157d5ee7ac Improve hook invalid error message (#307) 2025-08-02 16:46:28 +08:00
Jo
e663be632e Parse entry when constructing hook (#306)
* Parse `entry` when constructing hook

* Add test
2025-08-02 16:31:22 +08:00
Jo
7b8576e4df Move local_need_install test to python (#297) 2025-08-02 01:53:01 +08:00
Jo
a7fb956ec4 Remove LanguagePreference and improve language check (#277) 2025-07-31 20:16:27 +08:00
Jo
152c8d51d1 Fix python version matching (#275)
* Minor improvements to tests

* fix python version match

* Improve
2025-07-30 14:27:51 +08:00