Skip to content

fix(cli): validate --exclude regex pattern before use#262

Closed
evanofficial wants to merge 1 commit intorafaeltonholo:mainfrom
evanofficial:fix/validate-exclude-regex
Closed

fix(cli): validate --exclude regex pattern before use#262
evanofficial wants to merge 1 commit intorafaeltonholo:mainfrom
evanofficial:fix/validate-exclude-regex

Conversation

@evanofficial
Copy link
Copy Markdown
Contributor

Summary

Invalid regex patterns passed to --exclude caused an unhandled PatternSyntaxException with a raw stack trace. Now the pattern is validated early using Clikt's validate {} block, displaying a clear error message instead.

Before:

Exception in thread "main" java.util.regex.PatternSyntaxException: ...
    at java.util.regex.Pattern.error(...)
    ...

After:

Error: Invalid regex pattern for --exclude: "[invalid(regex". Unclosed character class near index 14

Changes

  • Main.kt — Added .validate {} on the --exclude option that wraps Regex() in a try-catch and calls fail() with a descriptive message

Closes #239

Invalid regex patterns passed to --exclude caused an unhandled
PatternSyntaxException with a stack trace. Now validates the
pattern early using Clikt's validate {} and shows a clear error.

Closes rafaeltonholo#239
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

Warning

Rate limit exceeded

@evanofficial has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 59 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 14 minutes and 59 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ff885f56-9fe7-45c1-865f-e5d0ade46516

📥 Commits

Reviewing files that changed from the base of the PR and between acc3b26 and b94c0bc.

📒 Files selected for processing (1)
  • svg-to-compose/src/nativeMain/kotlin/Main.kt
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@evanofficial
Copy link
Copy Markdown
Contributor Author

Closing — just noticed #251 already addresses this. Apologies for the duplicate!

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.

[Bug]: CLI --exclude regex not validated, crashes with unhelpful error on invalid patterns

1 participant