BOT: Fix #975: Add print.scores() S3 method with metrics and vignette link#1078
BOT: Fix #975: Add print.scores() S3 method with metrics and vignette link#1078nikosbosse wants to merge 1 commit intomainfrom
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
nikosbosse
left a comment
There was a problem hiding this comment.
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.
Summary
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.tableprint.forecast()pattern: usescli_text()for formatted output, callsNextMethod()for data.table printing, returnsxinvisiblyget_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: Newprint.scores()S3 method that displays "Metrics: ..." and "Score definitions: " before delegating to data.table printtests/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 columnstests/testthat/_snaps/class-forecast-multivariate-sample.md: Updated snapshot to include new print outputNAMESPACE/man/print.scores.Rd: Auto-generated exports and documentationTest plan
print.scores()covering core functionality and edge cases🤖 Generated with Claude Code