Skip to content

BOT: Fix #975: Add print.scores() S3 method with metrics and vignette link#1078

Draft
nikosbosse wants to merge 1 commit intomainfrom
fix/975-print-scores-method
Draft

BOT: Fix #975: Add print.scores() S3 method with metrics and vignette link#1078
nikosbosse wants to merge 1 commit intomainfrom
fix/975-print-scores-method

Conversation

@nikosbosse
Copy link
Collaborator

Summary

  • Adds a print.scores() S3 method that displays the names of scoring metrics used and a link to the scoring rules vignette before printing the underlying data.table
  • Follows the existing print.forecast() pattern: uses cli_text() for formatted output, calls NextMethod() for data.table printing, returns x invisibly
  • Handles edge cases gracefully: missing metrics attribute (skips metrics display), renamed columns (warning via get_metrics.scores())

Closes #975
Related to #667

Root cause

Scores objects had no custom print method — they fell through to print.data.table(), providing no context about which scoring rules were used or where to find their definitions.

What changed

  • R/class-scores.R: New print.scores() S3 method that displays "Metrics: ..." and "Score definitions: " before delegating to data.table print
  • tests/testthat/test-class-scores.R: 6 new tests covering metrics display, vignette link, all forecast types, invisible return, data.table delegation, missing attributes, and renamed columns
  • tests/testthat/_snaps/class-forecast-multivariate-sample.md: Updated snapshot to include new print output
  • NAMESPACE / man/print.scores.Rd: Auto-generated exports and documentation

Test plan

  • 6 new tests for print.scores() covering core functionality and edge cases
  • Full test suite passes (725 tests, 0 failures)
  • R CMD check: 0 errors, 0 warnings, 2 notes (pre-existing)
  • Snapshot test updated for multivariate sample scores

🤖 Generated with Claude Code

Create a print.scores() method that displays the names of scoring metrics
used and a link to the scoring rules vignette before printing the underlying
data.table. This helps users discover what metrics are available and where
to find their definitions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.84%. Comparing base (ac0c01a) to head (8ace320).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1078      +/-   ##
==========================================
+ Coverage   97.83%   97.84%   +0.01%     
==========================================
  Files          35       35              
  Lines        1845     1856      +11     
==========================================
+ Hits         1805     1816      +11     
  Misses         40       40              

☔ 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.

Copy link
Collaborator Author

@nikosbosse nikosbosse left a comment

Choose a reason for hiding this comment

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

CLAUDE: Clean, well-scoped implementation that follows the existing print.forecast() pattern exactly. The method correctly displays metric names and a vignette link before delegating to data.table printing, with proper edge case handling (missing metrics attribute, renamed columns). All 6 tests match the specifications and cover core functionality plus edge cases. Two minor cosmetic nits (unnecessary #nolint annotation on URL cli_text block, \dontrun example could be runnable) — neither blocking. Verdict: approve.

@nikosbosse nikosbosse marked this pull request as draft February 13, 2026 08:27
@nikosbosse nikosbosse changed the title Fix #975: Add print.scores() S3 method with metrics and vignette link BOT: Fix #975: Add print.scores() S3 method with metrics and vignette link Feb 13, 2026
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.

Add link to score definitions in summarise_score()

1 participant