1
0
mirror of https://github.com/j178/prek.git synced 2026-04-09 01:52:24 +02:00
Commit Graph

51 Commits

Author SHA1 Message Date
Jo
6dda4aa9f6 Do not dim the hook output (#1126)
* Do not dim the hook output

* Update snapshots
2025-11-20 19:16:55 +08:00
Jo
ce8faf7ea5 Add some more error context (#1097) 2025-11-17 18:30:05 +08:00
Jo
e672f83235 Support language: unsupported and language: unsupported_script introduced in pre-commit v4.4 (#1073)
* Support `language: unsupported` and `language: unsupported_script` introduced in pre-commit v4.4

Honestly, I have no idea why `system` and `script` got deprecated or what we're supposed to use instead. I probably won't deprecate them in prek.

* Fix lint
2025-11-14 15:53:21 +08:00
Copilot
011a0b3ff1 Rename crate lib/constants to crates/prek-consts and rename lib to crates (#1026)
* Initial plan

* Rename crate lib/constants to lib/prek-consts and fix all references

Co-authored-by: j178 <10510431+j178@users.noreply.github.com>

* Rename lib directory to crates and update all references

Co-authored-by: j178 <10510431+j178@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
2025-11-03 23:16:58 +08:00
is-alnilam
d9baf0a5f1 Add Ruby support (no download support yet) (#993)
* Add Ruby support (no download support yet)

Currently only pre-existing Rubies are used, although the code will
search for and consider multiple versions. This allows a hook to require
3.4.7 when the default system Ruby is 3.4.6, but RVM (or a similar tool)
has installed 3.4.7. If a suitable Ruby cannot be found, the user is
prompted to install one manually and re-run.

Hooks get an isolated GEM_HOME, based on the hook repository, any
additional_dependencies, and the interpreter version/path. Any Ruby
upgrade would therefore re-install the gems to ensure that stale
versions aren't used. Repository gem dependencies are installed based on
the included gemspec files, combined with the additional_dependencies
field.

* Add pins for CI 'install Ruby' action

* Update setup-ruby pin

* Tweak version parsing

* Tweak env vars

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-11-03 19:12:25 +08:00
Jo
4a864b33db Minor tweaks (#994)
* Minor tweaks

* Fix snaps
2025-10-30 16:49:33 +08:00
Jo
ab6bb6aa64 Add a warning for unimplemented hooks (#976) 2025-10-27 17:43:12 +08:00
Jo
b6c6ba8461 Fail windows CI when an error occured (#971)
* Fail windows CI when an error occured

* Fix tests
2025-10-26 19:04:02 +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
a4e8f20c8d Support language_version: system (#949)
* .

* Support `language_version: system`

* Fix python downloads
2025-10-21 20:23:32 +08:00
Jo
20c24af285 Fix golang hook install local dependencies (#902) 2025-10-16 18:34:52 +08:00
Jo
0dd84cd620 Improve language version download tests (#832) 2025-10-01 22:31:57 +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
e78b46cc46 Bump rust toolchain to 1.90 (#760) 2025-09-19 22:59:01 +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
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
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
2cd8f0fcb8 Fix local script hook entry path in workspace mode (#603) 2025-09-06 16:44:22 +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
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
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
a29e32de61 Reduce slow go tests (#457) 2025-08-15 00:23:47 +08:00
Jo
9986cb7e74 Test remote hooks with system go (#417)
* Revert "Do not set `GOROOT` and `GOPATH` for system found go (#415)"

This reverts commit 32d57905e4.

* Test remote hooks with system go

* Reapply "Do not set `GOROOT` and `GOPATH` for system found go (#415)"

This reverts commit e16e7df60d.
2025-08-10 23:17:15 +08:00
Jo
b2ab1fdaea Implement pygrep language support (#383)
* Implement `pygrep` language support

* Add failing tests

* .

* .

* Reimplement in Python
2025-08-10 17:32:21 +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
b24d9f349e Fix script command path (#398)
* Fix `script` command path

* rename

* Fix windows
2025-08-08 12:03:39 +08:00
Jo
7bd667e0c1 Improve language tests (#382)
* Exclude `go`/`node` from PATH when running tests

* Improve language tests
2025-08-07 16:17:22 +08:00
Jo
321f384ec7 Fix npm install on Windows (#374)
* Mask system node when running `doctoc` test

* fix

* test

* fix

* fix
2025-08-06 22:06:20 +08:00
Jo
b46822d236 Support golang hooks and golang toolchain management (#355)
* .

# Conflicts:
#	src/languages/node/installer.rs
#	src/languages/version.rs

* .

# Conflicts:
#	src/languages/node/version.rs
#	src/languages/python/version.rs

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

* .

# Conflicts:
#	src/languages/node/node.rs

* .

* .

* .

* fix tests

* Add a remote test

* minor
2025-08-05 19:17:50 +08:00
Jo
36ea6e63dc Add --install-links to npm install (#347)
* Add `--install-links` to `npm install`

* Add test
2025-08-05 01:06:46 +08:00
Jo
7bc0a164ed Support python311 as a valid language version (#321) 2025-08-03 12:29:19 +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
172abf4d59 Improve error message for hook installation and run (#310) 2025-08-02 19:35:21 +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
ca12c55c1b Support nodejs language hook (#298)
* .

* Support `nodejs` language

* add run

* .

* Fix

* Improve

* Test

* add test

* Debug

* Fix npm name

* oh my, windows

* Fix

* Fix
2025-08-02 06:33:16 +08:00
Jo
7b8576e4df Move local_need_install test to python (#297) 2025-08-02 01:53:01 +08:00
Jo
c28ca26c47 Try default uv managed python first, fallback to download (#291)
* .

* Try default uv managed python first, fallback to download

* Fix
2025-08-01 12:07:33 +08:00
Jo
6c205b2270 Add asserts to tests (#283)
* Add asserts to tests

* Fix

* Debug

* Use a old python 3.12 that github action does not installed
2025-08-01 02:09:52 +08:00
Jo
b9acf150d1 Support downloading requested Python version automatically (#281)
* Support auto download requested Python version

* Add test

* Fix

* Fix windows test
2025-08-01 00:27:02 +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
Jo
73493aa6ff Implement language specific version parsing (#273)
* Implement language specific version parsing

* Fix test

* Add tests
2025-07-29 22:36:31 +08:00
Jo
1c034a1afb Ignore config not staged error for config outside the repo (#270)
* Use `sync_all` over `flush`

* Ignore config not staged for config outside the repo

* improve test
2025-07-29 09:56:09 +08:00
Jo
0f8704d6f8 Upgrade to Rust 2024 edition (#196) 2025-02-21 17:56:12 +08:00
Jo
6d5f6eff0a Add progress bar for hook init and install (#122)
* Add progress bar for hook init and install

* Fix tests
2024-12-06 20:28:09 +08:00
Lemon
b3619bada8 feat: support docker_image (#113)
* feat: support docker_image

* test: add docker_image test case

* test: fix test failed when git default branch set `main`

* Minor tweaks

---------

Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
2024-11-25 15:32:15 +08:00