Warn when config file exists but fails to parse#1487
Merged
j178 merged 2 commits intoj178:masterfrom Jan 30, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds warnings when prek install encounters a configuration file that exists but fails to parse, preventing silent fallback to default behavior that could mask configuration errors.
Changes:
- Warning message now displays the specific parse error when config file is invalid
- Fallback to default hook types still occurs, but users are notified
- Test coverage added for invalid config warning behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
crates/prek/tests/install.rs |
Adds integration test verifying warning appears for invalid config |
crates/prek/src/cli/install.rs |
Implements warning logic for config parse errors in two code paths |
📦 Cargo Bloat ComparisonBinary size change: +0.00% (22.5 MiB → 22.5 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1487 +/- ##
==========================================
+ Coverage 91.35% 91.51% +0.15%
==========================================
Files 87 87
Lines 18187 18167 -20
==========================================
+ Hits 16615 16625 +10
+ Misses 1572 1542 -30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Previously, `prek install` would silently fall back to default hook types when the config file existed but contained errors. Now it shows a warning with the specific error (e.g., "missing field `rev`"). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6c3e430 to
fdb1e2b
Compare
Owner
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Previously,
prek installwould silently fall back to default hook types when the config file existed but contained errors (e.g., invalid YAML or missing required fields). This made it hard to notice configuration mistakes.Now it shows a warning with the specific error:
Test plan
install_invalid_config_warningtest🤖 Generated with Claude Code