Skip to content

Harden CLI with error handling, overwrite protection, and tests#36

Merged
calebevans merged 1 commit into
mainfrom
feat/cli-hardening
May 23, 2026
Merged

Harden CLI with error handling, overwrite protection, and tests#36
calebevans merged 1 commit into
mainfrom
feat/cli-hardening

Conversation

@calebevans

Copy link
Copy Markdown
Owner

Summary

  • Wrap analysis calls in try/except so failures on one file don't stop processing of remaining files
  • Add output file write error handling (OSError, PermissionError)
  • Add --force flag for output file overwrite protection (existing files are not overwritten without it)
  • Add KeyboardInterrupt handler for clean Ctrl+C exit (exit code 130)
  • Refactor analyze_file into smaller focused functions: _validate_file, _write_output, analyze_file
  • Add comprehensive CLI test suite

@calebevans calebevans self-assigned this May 23, 2026
@calebevans calebevans added the enhancement New feature or request label May 23, 2026
@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@calebevans, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 2 reviews/hour. Refill in 11 minutes and 7 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58f8b1ff-336f-410b-a7ac-63afdaf71d2c

📥 Commits

Reviewing files that changed from the base of the PR and between beb2d6b and 35a9aa4.

📒 Files selected for processing (3)
  • space/cordon
  • src/cordon/cli.py
  • tests/test_cli.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-hardening

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.

- Wrap analysis calls in try/except to continue on errors
- Add output file write error handling
- Add --force flag for output file overwrite protection
- Add KeyboardInterrupt handler for clean Ctrl+C exit
- Refactor analyze_file into smaller focused functions
- Add comprehensive CLI test suite

Co-authored-by: Cursor <cursoragent@cursor.com>
@calebevans
calebevans force-pushed the feat/cli-hardening branch from 71ad38d to 35a9aa4 Compare May 23, 2026 06:52
@sonarqubecloud

Copy link
Copy Markdown

@calebevans
calebevans merged commit 736c9a9 into main May 23, 2026
14 checks passed
@calebevans
calebevans deleted the feat/cli-hardening branch May 23, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant