1
0
mirror of https://github.com/j178/prek.git synced 2026-04-25 02:11:36 +02:00
Commit Graph

928 Commits

Author SHA1 Message Date
Copilot f43b60f97c Improve hint to remove core.hooksPath (#1074)
* Support rootless container (#1018)

* Initial plan

* Update hint to include both local and global core.hooksPath removal commands

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-14 22:51:36 +08:00
Steven Taylor e879894759 Support rootless container (#1018)
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
2025-11-14 22:42:21 +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
Sandu 597ad58b22 Run uv pip install from the current directory (#1068) (#1069) 2025-11-14 13:36:38 +08:00
Jo cc6fb514e3 Fix --files argument - files referencing other projects aren’t being filtered (#1064) 2025-11-14 13:35:52 +08:00
Copilot 04377fe568 Document workspace file visibility constraints (#1071)
* Initial plan

* Add documentation clarifying workspace file visibility constraints

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

* Make File Visibility Constraints a subsection and condense content

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-14 13:35:34 +08:00
Jo dc3d061e44 Add scoop to installation (#1067) 2025-11-12 19:09:02 +08:00
Copilot e08a239420 Add humanize to list of projects using prek (#1063) 2025-11-12 12:19:05 +08:00
yihong 86f4d60a59 Use temp dir for ruby test (#1058)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
2025-11-10 23:05:41 +08:00
Jo 2765bdee15 Save rust cache for CI jobs on main only (#1056)
Take inspiration from https://github.com/astral-sh/ruff/pull/21359
2025-11-10 17:39:59 +08:00
Jo 2f524787e7 Unset objectFormat in git init (#1048)
* Unset `extensions.objectFormat` in the remote repo

* Use `init.defaultObjectFormat=`
2025-11-09 17:46:26 +08:00
Jo 93accca92c Update project status in docs (#1052)
This is missed from #1005
2025-11-09 13:36:25 +08:00
Jo 1032757a83 Add a hint to use --refresh when no configuration found (#1046) 2025-11-08 18:45:51 +08:00
Jo 45e33109ad Remove examples directory (#1047) 2025-11-08 15:02:31 +08:00
Jo 2a77fd57a5 Add a hint to install when running inside a sub-project (#1045)
* Add a hint to install when running inside a sub-project

* Fix snap
2025-11-07 18:28:56 +08:00
Jo 7b608841b0 Mention PREK_CONTAINER_RUNTIME in diff.md (#1043) 2025-11-07 17:24:15 +08:00
Steven Taylor b957e17dd1 Support PREK_CONTAINER_RUNTIME=podman to override container runtime (#1033)
* feat: container runtime selection

use both docker and podman runtimes

1. if only docker on path use docker runtime
2. if only podman on path use podman runtime
3. to specify runtime use PREK_CONTAINER_RUNTIME

Signed-off-by: Steven Taylor <steven@taylormuff.co.uk>

* Tweak detection

---------

Signed-off-by: Steven Taylor <steven@taylormuff.co.uk>
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-11-07 17:12:35 +08:00
Jo fc52e3657b Add msgspec to "Who is using prek" (#1042) 2025-11-07 17:08:32 +08:00
nate nowack 6b72fdf5d5 Fix grammar in install message: use past tense 'moved' (#1041)
The install command actually moves the existing hook file automatically,
so the message should say 'moved it to' rather than 'move it to' (which
reads like an instruction to the user).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-07 11:00:44 +08:00
yihong 6c187f2c21 Add iceberg-python to "who is using prek" (#1039)
* docs: add new user

Signed-off-by: yihong0618 <zouzou0208@gmail.com>

* docs: nit the root PR

Signed-off-by: yihong0618 <zouzou0208@gmail.com>

---------

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
2025-11-06 16:10:40 +08:00
Jo c4016e3011 Limit container id from /proc/self/cgroup must the 64 characters (#1038) 2025-11-05 11:18:18 +08:00
Steven Taylor d971404061 Update regex to parse mountinfo for container id (#1037)
update regex to parse mountinfo for container id so that it supports
docker rootful, docker rootless, podman rootful and podman rootless.
unit tests updated to cover thee 4 variations

Signed-off-by: Steven Taylor <steven@taylormuff.co.uk>
2025-11-05 11:03:16 +08:00
Jo 9c70b50930 Bump version to 0.2.13 (#1036) v0.2.13 2025-11-04 22:05:02 +08:00
Steven Taylor 0318e3673a Improve container id detection (#1031)
* fix: improve container id detection

improve the detection of contiainer id when prek running in container
tries to match on cgroups v1 first then cgroups v2, far from perfect but
there is no concrete method for this

Signed-off-by: Steven Taylor <steven@taylormuff.co.uk>

* Improve container id parsing

---------

Signed-off-by: Steven Taylor <steven@taylormuff.co.uk>
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-11-04 21:24:37 +08:00
Jo e62fffb256 Minor tweaks for parse_boolish (#1035) 2025-11-04 12:25:16 +08:00
nate nowack a8dbefe602 Add FastMCP to users list (#1034) 2025-11-04 10:46:43 +08:00
Steven Taylor e4334198f3 Move parse_boolish to EnvVars (#1030)
refactor parse boolish, moved into env_vars and additional convenience
method to read env var and treat as bool

Signed-off-by: Steven Taylor <steven@taylormuff.co.uk>
2025-11-04 03:21:18 +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
Jo ee0acf25a3 Rename pty crate to prek-pty (#1025) 2025-11-03 22:16:22 +08:00
Jo f6d873c48e Vendor yaml-merge-keys to reduce dependencies (#1024) 2025-11-03 20:36:23 +08:00
renovate[bot] e14219154d Update taiki-e/install-action action to v2.62.45 (#1007)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-03 19:38:24 +08:00
Jo e608155aaf Disable renovate update for ilammy/msvc-dev-cmd (#1023) 2025-11-03 19:36:04 +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 156f06977a Fix YAML with nested merge keys (#1020) 2025-11-03 15:36:40 +08:00
yihong c1e69ce1af Use temp dir in tests (#1017)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
2025-11-01 19:31:26 +08:00
renovate[bot] 0869a57bcb Update Rust crate assert_cmd to v2.1.1 (#1015)
* Update Rust crate assert_cmd to v2.1.1

* Fix

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-11-01 18:16:10 +08:00
renovate[bot] 23bf3e3784 Update pre-commit hook crate-ci/typos to v1.39.0 (#1014)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-01 18:05:15 +08:00
renovate[bot] 4c08dce4d5 Update dependency uv to v0.9.7 (#1008) 2025-11-01 12:10:00 +08:00
renovate[bot] ac4fccf323 Update Rust crate ctrlc to v3.5.1 (#1011) 2025-11-01 12:08:56 +08:00
renovate[bot] df6179017c Update dependency python to 3.14 (#1013) 2025-11-01 12:00:26 +08:00
renovate[bot] 4f6798d244 Update Rust crate ignore to v0.4.25 (#1012) 2025-11-01 11:59:23 +08:00
renovate[bot] 73bb025c08 Update Rust crate clap to v4.5.51 (#1009) 2025-11-01 11:58:22 +08:00
renovate[bot] 43999dcec0 Update Rust crate clap_complete to v4.5.60 (#1010) 2025-11-01 11:57:44 +08:00
renovate[bot] a69adc3791 Update GitHub Actions and speed up Windows CI (#1001)
* Update GitHub Actions

* Try to speed up windows CI

* Use `leafo/gh-actions-luarocks`

* Fix luarocks install failure

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-10-31 17:41:46 +08:00
Jo 6e69f990a9 Bump Rust toolchain to 1.91 (#1004)
* Bump Rust toolchain to 1.91

* Fix lint
2025-10-31 16:30:30 +08:00
Jo b8ea831189 Update project stability status (#1005)
Yeah, I’m taking on the stable responsibility!
2025-10-31 16:11:36 +08:00
renovate[bot] 189d89ab77 Update Rust crate indicatif to v0.18.2 (#1000)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-31 15:27:55 +08:00
renovate[bot] b1d9fc1e62 Update GitHub Actions (#1003)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-31 15:24:12 +08:00
renovate[bot] ad5c374032 Update Rust crate etcetera to 0.11.0 (#1002)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-31 15:23:06 +08:00
Copilot 03d17c054d Optimize hot paths: reduce allocations (#997)
* Initial plan

* Optimize hot paths: reduce allocations and add inline hints

- Eliminate duplicate tags_from_path calls in file filtering
- Avoid string allocation for lowercase extensions (fast path for already lowercase)
- Remove unnecessary String clones in environment variable setting
- Add inline hints to hot path functions (TagSet methods, filters, etc.)
- Use lookup table for is_text_char for faster binary detection

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

* Additional optimizations: avoid allocations in hot paths

- Optimize Partitions iterator to use as_os_str().len() instead of to_string_lossy().len()
- Optimize normalize_path on Windows to avoid intermediate String allocation when possible

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

* Revert incorrect filter.rs optimization

The previous change to combine filters was actually less efficient than the original.
The original code correctly filters by filename patterns first, then only calls
tags_from_path on files that pass the filename filter. My change was based on
a misunderstanding - there was no duplication of tags_from_path calls.

Keeping the other optimizations:
- Inline hints on filter functions
- String allocation optimizations in identify.rs
- Environment variable clone removal
- Lookup table for is_text_char
- Partitions iterator optimization
- normalize_path optimization

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

* Optimize IS_TEXT_CHAR to use 256 bits instead of 256 bytes

Changed from [bool; 256] (256 bytes) to [u32; 8] (32 bytes) using bitfield.
This reduces memory footprint by 8x while maintaining O(1) lookup performance.

The lookup now uses bit manipulation:
- table[idx / 32] gets the u32 containing the bit
- (1 << (idx % 32)) creates a mask for the specific bit
- Bitwise AND checks if the bit is set

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

* Lint

* .

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
2025-10-31 01:30:25 +08:00