Skip to content

Clarify CLI usage error path - #6

Merged
leynos merged 1 commit into
mainfrom
codex/add-clarifying-comments-in-cli.py
Oct 6, 2025
Merged

Clarify CLI usage error path#6
leynos merged 1 commit into
mainfrom
codex/add-clarifying-comments-in-cli.py

Conversation

@leynos

@leynos leynos commented Oct 6, 2025

Copy link
Copy Markdown
Owner

Summary

  • document the intention behind the CLI usage-error path in main()

Testing

  • not run

https://chatgpt.com/codex/tasks/task_e_68e377d8682c8322b4d54ee16e83f6f8

Summary by Sourcery

Clarify the CLI usage-error path in the main function by adding inline comments to explain printing the usage message and returning exit code 2 for missing subcommands.

Enhancements:

  • Add comment to indicate printing of usage message for missing subcommand
  • Add comment to explain return code 2 as the standard exit code for missing subcommand

Summary by CodeRabbit

  • Documentation
    • Clarified inline comments in the CLI regarding behavior when no subcommand is provided, noting that usage is displayed and the standard exit code is returned. No functional changes.
  • Chores
    • Added non-functional annotations to improve code clarity and maintainability. No user-facing impact or behavior changes.

@sourcery-ai

sourcery-ai Bot commented Oct 6, 2025

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Document the intention behind the CLI usage-error path in main() by adding inline comments clarifying the printed message and exit code semantics.

Sequence diagram for CLI usage error handling in main()

sequenceDiagram
    participant User as actor User
    participant CLI as main(argv)
    participant Workspace as _extract_workspace_override
    participant Env as _workspace_env
    participant Dispatcher as _dispatch_and_print
    User->>CLI: Run CLI with argv
    CLI->>Workspace: _extract_workspace_override(argv)
    Workspace-->>CLI: workspace_override, remaining
    CLI->>CLI: normalise_workspace_root(workspace_override)
    alt No remaining subcommand
        CLI->>Dispatcher: _dispatch_and_print(remaining)
        CLI-->>User: Print usage message
        CLI-->>User: Exit with code 2
    else Subcommand present
        CLI->>Env: _workspace_env(workspace_root)
        Env-->>CLI: (context)
        CLI->>Dispatcher: _dispatch_and_print(remaining)
        CLI-->>User: Return dispatch result
    end
Loading

File-Level Changes

Change Details Files
Clarify CLI usage-error path with explanatory comments
  • Add comment to dispatch call explaining it prints the usage message
  • Add comment to return statement explaining the standard exit code for a missing subcommand
lading/cli.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Oct 6, 2025

Copy link
Copy Markdown

Walkthrough

Inline comments were added in lading/cli.py to annotate the usage-printing call to _dispatch_and_print(remaining) and the return code (2) for missing subcommand. No functional behavior changed.

Changes

Cohort / File(s) Summary of Changes
CLI comment annotations
lading/cli.py
Added inline comments clarifying that _dispatch_and_print(remaining) prints usage and that returning 2 signifies a missing subcommand; no logic changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I nibble at code with whiskers keen,
A note here, a hint there—tidy and clean.
Usage prints when paths are few,
Exit two says what to do.
Hop-hop! Comments bloom in light—
Same old flow, just clearer sight. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Clarify CLI usage error path” succinctly and accurately summarizes that the PR adds documentation and comments to the CLI’s usage-error handling branch, aligning perfectly with the change focus.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/add-clarifying-comments-in-cli.py

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@leynos
leynos merged commit eeca4f3 into main Oct 6, 2025
4 checks passed
@leynos
leynos deleted the codex/add-clarifying-comments-in-cli.py branch October 6, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant