* 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
* 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>
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>
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>
* 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>
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>
* 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>
* 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>
* 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>