Skip to content

fix(completion): disable settings warning in completion mode#118

Merged
water-sucks merged 1 commit intonix-community:mainfrom
water-sucks:disable-settings-warning-in-completion-mode
Oct 29, 2025
Merged

fix(completion): disable settings warning in completion mode#118
water-sucks merged 1 commit intonix-community:mainfrom
water-sucks:disable-settings-warning-in-completion-mode

Conversation

@water-sucks
Copy link
Copy Markdown
Collaborator

@water-sucks water-sucks commented Oct 29, 2025

Description

The no settings file warning mangles completion output, so disable it in completion mode.

Closes #117.

Summary by CodeRabbit

  • Improvements
    • Enhanced error handling to suppress unnecessary warnings when the CLI is used within shell completion contexts.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 29, 2025

Walkthrough

Error handling in mainCommand's ParseSettings path now checks carapace.IsCallback() and suppresses error logging and default warnings when running in a Carapace completion callback context.

Changes

Cohort / File(s) Summary
ParseSettings error handling
cmd/root/root.go
Added condition to check carapace.IsCallback() before logging ParseSettings errors and emitting default warnings. Errors are suppressed when invoked within a Carapace completion callback.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify the Carapace callback check is placed correctly in the condition logic
  • Confirm carapace.IsCallback() is the appropriate function to detect completion context
  • Validate that suppressing warnings during callbacks doesn't mask other legitimate issues

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix(completion): disable settings warning in completion mode" accurately and specifically describes the main change. The raw summary confirms that the code modification adds a check for carapace.IsCallback() to suppress error logging and the defaults warning during completion mode, which directly aligns with the title. The title is concise, follows conventional commit format, and clearly communicates the primary change without ambiguity.
Linked Issues Check ✅ Passed The code changes meet the requirements of issue #117. The PR specifically addresses the issue where tab completion produces mangled output with error and warning messages when no config file exists. By adding a carapace.IsCallback() check in the ParseSettings error handling path, the code now suppresses both the error logging and the "proceeding with defaults only" warning during completion mode, which directly resolves the reported problem of mangled completion output.
Out of Scope Changes Check ✅ Passed The changes are narrowly scoped to the stated objective. Only cmd/root/root.go is modified, with a focused update to the error handling logic in mainCommand that adds a carapace.IsCallback() condition. This modification directly addresses the requirement to disable the settings warning in completion mode as specified in issue #117, and no unrelated changes are evident in the codebase.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e504f6 and bb92e0f.

📒 Files selected for processing (1)
  • cmd/root/root.go (1 hunks)
⏰ 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)
  • GitHub Check: Build/Test
🔇 Additional comments (1)
cmd/root/root.go (1)

68-71: Fix is complete and correct; default settings always pass validation.

The code review is sound. NewSettings() creates default settings with no aliases, and Validate() only validates aliases. Since the default settings contain no aliases, validation always succeeds cleanly and produces no warnings during completion mode.

The change correctly addresses the reported issue using carapace.IsCallback(), the standard carapace API for detecting completion context. No additional fixes are needed.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@water-sucks water-sucks merged commit 40b86e9 into nix-community:main Oct 29, 2025
2 checks passed
@water-sucks water-sucks deleted the disable-settings-warning-in-completion-mode branch November 3, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running Using Nix Shells doesn't work without a config.toml file

1 participant