BOT: Fix #445: Remove redundant namespace qualifiers#1098
BOT: Fix #445: Remove redundant namespace qualifiers#1098nikosbosse wants to merge 1 commit intomainfrom
Conversation
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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
nikosbosse
left a comment
There was a problem hiding this comment.
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.
Summary
pkg::fn()calls across 8 R files where functions are already imported viaimportFromin NAMESPACEscoringRules::prefix onlogs_sample,dss_sample,crps_samplewrappers andutils::tailintail.forecast()to prevent infinite recursion from name shadowingDetails
Fixes #445
Root cause: Many function calls used explicit
data.table::,cli::,purrr::, andscoringRules::prefixes even though the functions were already imported viaimportFromin NAMESPACE. This is redundant and inconsistent with the rest of the codebase.What changed:
R/get-correlations.R— removed 2data.table::prefixes (as.data.table,melt)R/class-forecast-sample.R— removed 1data.table::dcastprefixR/helper-quantile-interval-range.R— removed 1data.table::rbindlistprefixR/pairwise-comparisons.R— removed 8data.table::prefixes (rbindlist,as.data.table,copy,data.table,setnames)R/class-forecast-quantile.R— removedpurrr::partialandcli::cli_warnprefixesR/class-forecast.R— removeddata.table::is.data.tableprefixR/metrics-ordinal.R— removedscoringRules::rps_probsprefixR/metrics-sample.R— removedcli::cli_warnprefixWhat was intentionally kept:
scoringRules::logs_sample(),scoringRules::dss_sample(),scoringRules::crps_sample()— the wrapper functions shadow the imported names, so the::prefix is necessary disambiguationutils::tail()intail.forecast()— prevents S3 dispatch recursionTest plan
test-namespace-imports.Rwith 7 test cases (39 expectations) verifying import correctness and regression safety🤖 Generated with Claude Code