Conversation
📦 Cargo Bloat ComparisonBinary size change: +0.00% (22.3 MiB → 22.3 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1367 +/- ##
==========================================
+ Coverage 90.04% 90.23% +0.19%
==========================================
Files 80 81 +1
Lines 15928 15952 +24
==========================================
+ Hits 14342 14395 +53
+ Misses 1586 1557 -29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request adds support for check-json5 as a builtin hook to validate JSON5 files, addressing issue #823. JSON5 is an extension of JSON that allows comments, unquoted keys, trailing commas, and other features that make configuration files more human-friendly.
Changes:
- Added
check-json5builtin hook with full validation support for JSON5 files - Refactored multiple hook implementations to use a new shared
run_concurrent_file_checkshelper function - Updated documentation to list the new
check-json5hook - Added comprehensive tests for the new hook
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/prek/src/hooks/builtin_hooks/check_json5.rs | New module implementing JSON5 validation logic with unit tests |
| crates/prek/src/hooks/builtin_hooks/mod.rs | Registered check-json5 hook in the builtin hooks enum and manifest |
| crates/prek/src/hooks/mod.rs | Added reusable run_concurrent_file_checks helper function |
| crates/prek/tests/builtin_hooks.rs | Added integration test for check-json5 hook |
| docs/builtin.md | Updated documentation to include check-json5 in supported hooks list |
| Cargo.toml, crates/prek/Cargo.toml | Added json5 dependency |
| Cargo.lock | Lock file updates for json5 and ucd-trie dependencies |
| Multiple hook files | Refactored to use new run_concurrent_file_checks helper |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "#}; | ||
| let file_path = create_test_file(&dir, "duplicate.json5", content.as_bytes()).await?; | ||
| let (code, output) = check_file(dir.path(), &file_path).await?; | ||
| assert_eq!(code, 0); |
There was a problem hiding this comment.
The test for duplicate keys expects the check to pass (code 0), but the check-json hook explicitly fails on duplicate keys. This inconsistency may be intentional if JSON5 allows duplicate keys by spec, but it should be documented. Consider adding a comment explaining why duplicate keys are acceptable in JSON5 but not in JSON, or if this is a limitation of the json5 library being used.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
* Initial plan * Add documentation explaining duplicate key behavior in JSON5 Co-authored-by: j178 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: j178 <[email protected]>
Closes #823