Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1407 +/- ##
==========================================
+ Coverage 90.39% 90.42% +0.02%
==========================================
Files 82 82
Lines 16262 16447 +185
==========================================
+ Hits 14700 14872 +172
- Misses 1562 1575 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📦 Cargo Bloat ComparisonBinary size change: +0.00% (22.5 MiB → 22.5 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
There was a problem hiding this comment.
Pull request overview
This PR refactors the configuration type hierarchy to better represent where hook fields like priority can be specified. The main goal is to enforce that priority can only be set in project config files (.pre-commit-config.yaml) and not in hook manifests (.pre-commit-hooks.yaml).
Changes:
- Introduced a new
HookSpectype as a unified internal representation for all hook types - Moved
priorityfield fromHookOptionsto individual config-level hook types (RemoteHook,LocalHook,MetaHook,BuiltinHook) - Refactored
LocalHook,MetaHook, andBuiltinHookfrom tuple structs wrappingManifestHookto proper structs with their own fields
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| prek.schema.json | Updated JSON schema: renamed ManifestHook to LocalHook in schema, moved definition order, and added documentation clarifying that priority is only allowed in project config files |
| crates/prek/src/config.rs | Core refactoring: introduced HookSpec type, moved priority from HookOptions to config-specific hook types, restructured LocalHook/MetaHook/BuiltinHook as proper structs, added From implementations, removed unused instrument import |
| crates/prek/src/workspace.rs | Updated to use HookSpec instead of ManifestHook, renamed variables for clarity, added conversions to HookSpec |
| crates/prek/src/hook.rs | Changed Repo enum to use HookSpec, updated HookBuilder to work with HookSpec, modified priority access to read from hook_spec.priority |
| crates/prek/src/hooks/meta_hooks.rs | Removed tuple struct wrapper access (.0), updated to construct MetaHook directly, removed unused import |
| crates/prek/src/hooks/builtin_hooks/mod.rs | Removed tuple struct wrapper access, updated to construct BuiltinHook directly with all required fields, removed unused Language import |
| crates/prek/src/cli/completion.rs | Updated field access to remove tuple struct wrapper (.0) |
| crates/prek/src/snapshots/* | Updated snapshots to reflect structural changes: priority moved out of HookOptions, LocalHook/MetaHook/BuiltinHook shown as proper structs |
No description provided.