Skip to content

Improve validate option messages#219

Merged
rengelke merged 5 commits intomainfrom
improve-validate-option-messages
Mar 17, 2026
Merged

Improve validate option messages#219
rengelke merged 5 commits intomainfrom
improve-validate-option-messages

Conversation

@rengelke
Copy link
Member

@rengelke rengelke commented Mar 17, 2026

  • validateIsOption() aggregated error messages no longer include internal function name prefixes
  • errorValueNotAllowed now formats disallowed values as "x" not allowed. Allowed values: ...

Summary by CodeRabbit

  • Bug Fixes

    • Validation error messages now display more cleanly by removing leading internal context and function-name prefixes.
    • Long lists of disallowed option values are truncated to the first five items with an ellipsis for improved readability.
  • Tests

    • Test assertions updated to rely on standardized message patterns/helpers rather than exact literal strings.

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2ad2695f-5b05-47a6-98c6-c842f0548d10

📥 Commits

Reviewing files that changed from the base of the PR and between f1a960c and 678b2f7.

📒 Files selected for processing (2)
  • R/messages.R
  • R/validation-options.R
🚧 Files skipped from review as they are similar to previous changes (1)
  • R/messages.R

📝 Walkthrough

Walkthrough

Refactors internal error-message formatting: strips internal function-name prefixes from aggregated validation errors and truncates long allowed/not-allowed value lists with an ellipsis. Tests and NEWS updated to match the new message patterns.

Changes

Cohort / File(s) Summary
Error Message Formatting
R/messages.R
Rewrote internal formatting in errorValueNotAllowed() to compute unique not-included/parent value vectors, truncate to first five items with a " ..." suffix when needed, and removed retrieval of the calling function name.
Validation Error Handling
R/validation-options.R
Changed validateIsOption() error handler to return a trimmed message via sub("^[^]*\\: ", "", e$message), removing leading internal function-name context.
Tests
tests/testthat/test-validation-options.R, tests/testthat/test-validation-vector.R
Updated expectations to use helper-generated messages (messages$errorValueNotAllowed(...)) or regex-based assertions instead of exact literal strings.
Changelog
NEWS.md
Added entry noting removal of internal function-name prefixes from aggregated validation error messages.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • Yuri05
  • nautilus69
  • PavelBal

Poem

🐰 I hopped through messages, trimmed and bright,

No hidden names to cloud the sight,
Lists now tidy, five then dots,
Clean errors sing—no tangled plots! 🥕

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Improve validate option messages' directly and clearly describes the main change across all modified files, which focuses on improving error messages from validateIsOption() and errorValueNotAllowed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-validate-option-messages
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can suggest fixes for GitHub Check annotations.

Configure the reviews.tools.github-checks setting to adjust the time to wait for GitHub Checks to complete.

coderabbitai[bot]

This comment was marked as resolved.

@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (e1994eb) to head (678b2f7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #219   +/-   ##
=======================================
  Coverage   98.65%   98.65%           
=======================================
  Files          23       23           
  Lines         741      741           
=======================================
  Hits          731      731           
  Misses         10       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rengelke rengelke merged commit 20d444d into main Mar 17, 2026
12 checks passed
@rengelke rengelke deleted the improve-validate-option-messages branch March 17, 2026 10:12
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.

3 participants