Repository navigation
feat: read global rc from xdg config dir - #328
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughGlobal RC discovery now reads the user configuration directory and the legacy home file. Tests cover lookup precedence, fallback behavior, project overrides, and ChangesGlobal RC discovery
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to The change is localized to loading the global configuration from the XDG config directory, with accompanying documentation and tests; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 #328 +/- ##
==========================================
+ Coverage 76.92% 77.92% +1.00%
==========================================
Files 7 5 -2
Lines 806 367 -439
Branches 80 142 +62
==========================================
- Hits 620 286 -334
+ Misses 184 67 -117
- Partials 2 14 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
test/global-rc.test.ts (2)
17-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMove internal helpers to the bottom of the file.
Move
restoreEnvandloadbelow theitblocks, before the closingdescribeblock.As per coding guidelines,
**/*.{ts,tsx,js,jsx}requires internal helper functions at the bottom of files.Also applies to: 43-43
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/global-rc.test.ts` around lines 17 - 25, Move the internal helper functions restoreEnv and load below all it blocks in the describe block, placing them immediately before the closing describe brace. Keep their implementations and test behavior unchanged.Source: Coding guidelines
45-88: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftUse checked-in RC fixtures.
Move the RC file contents into
test/fixture/and use those files to construct each test case. Keep the temporary environment roots forHOMEandXDG_CONFIG_HOME.As per coding guidelines,
test/**/*.test.{ts,tsx,js,jsx}must use fixture-based testing with real config files fromtest/fixture/.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/global-rc.test.ts` around lines 45 - 88, Move the inline RC contents in the global configuration tests into checked-in files under test/fixture/, then update each test in the relevant suite to copy or use those fixture files when constructing HOME, XDG_CONFIG_HOME, and project configurations. Preserve the temporary environment roots and all existing precedence and empty-file scenarios, including the XDG_CONFIG_HOME isolation case; do not pass configuration contents directly to writeFile.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 105-107: Update the RC configuration source documentation in
README.md to list the complete loading order: workspace directory first, then
the user config directory from $XDG_CONFIG_HOME or ~/.config, then the user home
directory. Keep the stated precedence aligned with this order and avoid
describing the home directory as the sole global source.
---
Nitpick comments:
In `@test/global-rc.test.ts`:
- Around line 17-25: Move the internal helper functions restoreEnv and load
below all it blocks in the describe block, placing them immediately before the
closing describe brace. Keep their implementations and test behavior unchanged.
- Around line 45-88: Move the inline RC contents in the global configuration
tests into checked-in files under test/fixture/, then update each test in the
relevant suite to copy or use those fixture files when constructing HOME,
XDG_CONFIG_HOME, and project configurations. Preserve the temporary environment
roots and all existing precedence and empty-file scenarios, including the
XDG_CONFIG_HOME isolation case; do not pass configuration contents directly to
writeFile.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: fa31bda9-68ca-4c07-bbff-b44db8a7a67d
📒 Files selected for processing (3)
README.mdsrc/loader.tstest/global-rc.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 79-80: Update the README priority list and the globalRc
description to state that the XDG_CONFIG_HOME RC file is used instead of the
legacy home-directory RC file when XDG_CONFIG_HOME is set; otherwise, the
home-directory file remains the fallback.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
spotted when reviewing nuxt/telemetry#465
we don't respect global rc from xdg config dir, even though this is where the non-deprecated helpers from
rc9write configuration...Summary by CodeRabbit
Documentation
Bug Fixes
Tests