Skip to content

BOT: Fix #445: Remove redundant namespace qualifiers#1098

Draft
nikosbosse wants to merge 1 commit intomainfrom
fix/445-cleanup-redundant-namespace
Draft

BOT: Fix #445: Remove redundant namespace qualifiers#1098
nikosbosse wants to merge 1 commit intomainfrom
fix/445-cleanup-redundant-namespace

Conversation

@nikosbosse
Copy link
Collaborator

Summary

  • Removes 15 redundant pkg::fn() calls across 8 R files where functions are already imported via importFrom in NAMESPACE
  • Retains scoringRules:: prefix on logs_sample, dss_sample, crps_sample wrappers and utils::tail in tail.forecast() to prevent infinite recursion from name shadowing
  • Adds safety-net tests verifying NAMESPACE imports are correct and that the cleanup doesn't cause regressions

Details

Fixes #445

Root cause: Many function calls used explicit data.table::, cli::, purrr::, and scoringRules:: prefixes even though the functions were already imported via importFrom in NAMESPACE. This is redundant and inconsistent with the rest of the codebase.

What changed:

  • R/get-correlations.R — removed 2 data.table:: prefixes (as.data.table, melt)
  • R/class-forecast-sample.R — removed 1 data.table::dcast prefix
  • R/helper-quantile-interval-range.R — removed 1 data.table::rbindlist prefix
  • R/pairwise-comparisons.R — removed 8 data.table:: prefixes (rbindlist, as.data.table, copy, data.table, setnames)
  • R/class-forecast-quantile.R — removed purrr::partial and cli::cli_warn prefixes
  • R/class-forecast.R — removed data.table::is.data.table prefix
  • R/metrics-ordinal.R — removed scoringRules::rps_probs prefix
  • R/metrics-sample.R — removed cli::cli_warn prefix

What was intentionally kept:

  • scoringRules::logs_sample(), scoringRules::dss_sample(), scoringRules::crps_sample() — the wrapper functions shadow the imported names, so the :: prefix is necessary disambiguation
  • utils::tail() in tail.forecast() — prevents S3 dispatch recursion

Test plan

  • New test-namespace-imports.R with 7 test cases (39 expectations) verifying import correctness and regression safety
  • Full test suite passes (717 tests, 0 failures)
  • R CMD check passes (0 errors, 0 warnings)

🤖 Generated with Claude Code

Remove 15 redundant `pkg::fn()` calls across 8 R files where the
functions are already imported via `importFrom` in NAMESPACE. Keep
`scoringRules::` prefix on wrapper functions (logs_sample, dss_sample,
crps_sample) that shadow the imported names, and `utils::tail` in
tail.forecast() to prevent recursion.

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

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.83%. Comparing base (ac0c01a) to head (473f558).

Files with missing lines Patch % Lines
R/class-forecast-quantile.R 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1098   +/-   ##
=======================================
  Coverage   97.83%   97.83%           
=======================================
  Files          35       35           
  Lines        1845     1845           
=======================================
  Hits         1805     1805           
  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: Review verdict: APPROVE. Clean, well-scoped mechanical refactor. All 17 redundant pkg::fn() qualifier removals are verified safe — each function has a corresponding importFrom in NAMESPACE, and none shadow same-named functions in scoringutils. The 4 retained :: prefixes (scoringRules::logs_sample/dss_sample/crps_sample, utils::tail) are correctly identified as necessary to prevent infinite recursion. Tests match specifications and provide appropriate safety-net coverage. No issues found.

@nikosbosse nikosbosse marked this pull request as draft February 13, 2026 08:28
@nikosbosse nikosbosse changed the title Fix #445: Remove redundant namespace qualifiers BOT: Fix #445: Remove redundant namespace qualifiers 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.

Cleanup: delete calls that use :: or ::: and add to imports instead

1 participant

Comments