fix(json): Preserve nested empty arrays when rewriting package.json.#110
fix(json): Preserve nested empty arrays when rewriting package.json.#110terabytesoftw merged 1 commit intomainfrom
package.json.#110Conversation
terabytesoftw
commented
Jan 22, 2026
| Q | A |
|---|---|
| Is bugfix? | ✔️ |
| New feature? | ❌ |
| Breaks BC? | ❌ |
📝 WalkthroughSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThis PR fixes a bug where nested empty arrays in package.json files were not being preserved during rewrites. The regex pattern used to detect array keys was updated to accommodate flexible whitespace around colons and brackets, and the replacement logic was refactored to use regex-based matching instead of direct string substitution. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (4)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings🧬 Code graph analysis (1)tests/Json/JsonFormatterTest.php (1)
🪛 PHPMD (2.15.0)tests/Json/JsonFormatterTest.php48-48: Avoid using static access to class '\PHPForge\Support\Assert' in method 'testFormat'. (undefined) (StaticAccess) 48-48: Avoid using static access to class '\Foxy\Json\JsonFormatter' in method 'testFormat'. (undefined) (StaticAccess) 75-75: Avoid using static access to class '\Foxy\Json\JsonFormatter' in method 'testGetArrayKeysWithoutSpacesBeforeArray'. (undefined) (StaticAccess) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (6)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #110 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 342 343 +1
===========================================
Files 26 26
Lines 786 787 +1
===========================================
+ Hits 786 787 +1 ☔ View full report in Codecov by Sentry. |