By default, prek executes hooks sequentially. While safe, this is inefficient for independent tasks (e.g., linting different languages). This proposal introduces per-hook priorities to allow safe, parallel execution of hooks.
https://prek.j178.dev/proposals/concurrency/
prek includes fast, Rust-native implementations of popular hooks for speed and low overhead. These hooks are bundled directly into the prek binary, eliminating the need for external interpreters like Python for these specific checks.
https://prek.j178.dev/builtin/
refs #3011
refs #2986
refs #3081
In the context of the prek Git hook runner, Priority 0 means a hook is placed in the highest tier of the parallel execution order.
Here is how priorities work in prek:
- Parallel Execution: Unlike the traditional Python-based pre-commit tool, which runs hooks sequentially one by one, prek can run multiple hooks concurrently if they share the same priority.
- Priority Levels: Hooks can be assigned different priority numbers. Hooks with a priority of 0 (or a higher numerical value, depending on configuration) run first or alongside other zero-priority hooks to decrease total end-to-end execution time.
- Performance: Grouping non-overlapping, independent hooks into the same priority allows prek to utilize your CPU more efficiently.
Built-in Fast Hooks from Prek
Prek is a fast, Rust-based, drop-in replacement for the standard Git pre-commit framework. It features built-in hooks that are written natively in Rust, eliminating the need to install heavy external environments or manage runtime dependencies for common linting and formatting tasks.
Key Advantages of Prek's Built-in Hooks
- Blazing Fast: Built-in hooks run natively, avoiding the startup and execution overhead of Python processes.
- Read-Only Optimizations: Prek automatically optimizes its performance on large repositories by skipping expensive file-diff checks for built-in hooks that are known to be read-only.
- Drop-In Compatibility: You can use them directly within your existing
.pre-commit-config.yaml files alongside your standard hooks.
How to Use Prek Built-in Hooks
You can inspect which built-in hooks are natively available and how to configure them in your workflow:
- Discover Built-ins: Use the
prek util list-builtins command to see all the native, ready-to-use hooks provided by prek
- Setup Your Config: Reference them in your
.pre-commit-config.yaml using the prek repository URL.
- Execution: You can install them with
prek install and execute them locally using prek run.
sedona % prek util list-builtins
check-added-large-files
check-case-conflict
check-executables-have-shebangs
check-illegal-windows-names
check-json
check-json5
check-merge-conflict
check-shebang-scripts-are-executable
check-symlinks
check-toml
check-vcs-permalinks
check-xml
check-yaml
destroyed-symlinks
detect-private-key
end-of-file-fixer
file-contents-sorter
fix-byte-order-marker
forbid-new-submodules
mixed-line-ending
no-commit-to-branch
pretty-format-json
trailing-whitespace
By default, prek executes hooks sequentially. While safe, this is inefficient for independent tasks (e.g., linting different languages). This proposal introduces per-hook priorities to allow safe, parallel execution of hooks.
https://prek.j178.dev/proposals/concurrency/
prek includes fast, Rust-native implementations of popular hooks for speed and low overhead. These hooks are bundled directly into the prek binary, eliminating the need for external interpreters like Python for these specific checks.
https://prek.j178.dev/builtin/
refs #3011
refs #2986
refs #3081
In the context of the prek Git hook runner, Priority 0 means a hook is placed in the highest tier of the parallel execution order.
Here is how priorities work in prek:
Built-in Fast Hooks from Prek
Prek is a fast, Rust-based, drop-in replacement for the standard Git
pre-commitframework. It features built-in hooks that are written natively in Rust, eliminating the need to install heavy external environments or manage runtime dependencies for common linting and formatting tasks.Key Advantages of Prek's Built-in Hooks
.pre-commit-config.yamlfiles alongside your standard hooks.How to Use Prek Built-in Hooks
You can inspect which built-in hooks are natively available and how to configure them in your workflow:
prek util list-builtinscommand to see all the native, ready-to-use hooks provided by prek.pre-commit-config.yamlusing the prek repository URL.prek installand execute them locally usingprek run.