Skip to content

feat: Add unused_function rule#362

Merged
etiennebacher merged 52 commits intomainfrom
unused-function
Feb 28, 2026
Merged

feat: Add unused_function rule#362
etiennebacher merged 52 commits intomainfrom
unused-function

Conversation

@etiennebacher
Copy link
Owner

@etiennebacher etiennebacher commented Feb 21, 2026

Would fix #360.

Some packages have their own internal mechanism that makes it almost impossible to detect unused function (polars, pkgcheck, tidypolars...). Violations are not reported if there are more than 50 for this rule, so some packages don't appear in ecosystem checks because of that.

Note to self: the inlineCxxPlugin in RcppArmadillo is a false positive but I doubt I can fix it because this function is fetched by inline (on which Rcpp depends): https://github.com/eddelbuettel/inline/blob/720c4209cb2df3c8aaefb15408b4bc4deabb21aa/R/cxxfunction.R#L25

@github-actions github-actions bot added the forgot-changelog This PR adds changes that should be documented in CHANGELOG.md and docs/changelog.md. label Feb 21, 2026
@github-actions
Copy link

github-actions bot commented Feb 21, 2026

Ecosystem checks

apache/arrow: +4 -0 violations
New violations (first 100):
r/R/dplyr-funcs-string.R[90:0]: unused_function -- `contains_regex` is defined but never called in this package.
r/R/util.R[104:0]: unused_function -- `all_names` is defined but never called in this package.
r/R/util.R[108:0]: unused_function -- `is_constant` is defined but never called in this package.
r/R/util.R[227:0]: unused_function -- `is_compressed` is defined but never called in this package.  
easystats/datawizard: +2 -0 violations
New violations (first 100):
R/utils.R[17:0]: unused_function -- `.is_deprecated` is defined but never called in this package.
R/utils.R[213:0]: unused_function -- `.get_object` is defined but never called in this package.  
lrberge/stringmagic: +5 -0 violations
New violations (first 100):
R/check.R[1171:0]: unused_function -- `deparse_long` is defined but never called in this package.
R/check.R[1322:0]: unused_function -- `.warn_hook` is defined but never called in this package.
R/misc_funs.R[797:0]: unused_function -- `names_xpd` is defined but never called in this package.
R/misc_funs.R[1187:0]: unused_function -- `extract_first` is defined but never called in this package.
R/test_funs.R[558:0]: unused_function -- `non_ascii` is defined but never called in this package.  
mlr-org/mlr3: +5 -0 violations
New violations (first 100):
R/assertions.R[373:0]: unused_function -- `assert_set` is defined but never called in this package.
R/helper.R[7:0]: unused_function -- `get_featureless_learner` is defined but never called in this package.
R/helper.R[46:0]: unused_function -- `clone_rep` is defined but never called in this package.
R/helper_hashes.R[5:0]: unused_function -- `phashes` is defined but never called in this package.
R/zzz.R[84:0]: unused_function -- `dummy_import` is defined but never called in this package.  
nlmixr2/nlmixr2est: +15 -0 violations
New violations (first 100):
R/focei.R[54:0]: unused_function -- `.lbfgsbO` is defined but never called in this package.
R/focei.R[135:0]: unused_function -- `.bobyqaNLopt` is defined but never called in this package.
R/mix.R[13:0]: unused_function -- `.getMixFromLog` is defined but never called in this package.
R/nlminb.R[386:0]: unused_function -- `.nlminbFitDataSetup` is defined but never called in this package.
R/nlmixr2output.R[1:0]: unused_function -- `.getBackTransformationFunction` is defined but never called in this package.
R/nls.R[869:0]: unused_function -- `.nlsFitDataSetup` is defined but never called in this package.
R/pkpars.R[145:0]: unused_function -- `.getParfn` is defined but never called in this package.
R/resid.R[314:0]: unused_function -- `.calcRes` is defined but never called in this package.
R/resid.R[368:0]: unused_function -- `.calcShrinkOnly` is defined but never called in this package.
R/saem.R[671:0]: unused_function -- `.saemGetCalcCwres` is defined but never called in this package.
R/sourceCppFunction.R[3:0]: unused_function -- `sourceCppFunction` is defined but never called in this package.
R/timing.R[6:0]: unused_function -- `.pushNlmixr2timing` is defined but never called in this package.
R/utils.R[120:0]: unused_function -- `refresh` is defined but never called in this package.
R/utils.R[126:0]: unused_function -- `nsis` is defined but never called in this package.
R/utils.R[243:0]: unused_function -- `.setRoot` is defined but never called in this package.  
R-ArcGIS/arcgisgeocode: +2 -0 violations
New violations (first 100):
R/core-batch-geocode.R[424:0]: unused_function -- `custom_locs_as_sfc_point` is defined but never called in this package.
R/utils-checks.R[69:0]: unused_function -- `check_locations` is defined but never called in this package.  
RcppCore/RcppArmadillo: +1 -0 violations
New violations (first 100):
R/inline.R[18:0]: unused_function -- `inlineCxxPlugin` is defined but never called in this package.  
Rdatatable/data.table: +9 -0 violations
New violations (first 100):
R/devel.R[50:0]: unused_function -- `.git` is defined but never called in this package.
R/fwrite.R[130:0]: unused_function -- `haszlib` is defined but never called in this package.
R/getdots.R[4:0]: unused_function -- `getdots` is defined but never called in this package.
R/mergelist.R[37:0]: unused_function -- `hasindex` is defined but never called in this package.
R/setkey.R[111:0]: unused_function -- `setreordervec` is defined but never called in this package.
R/test.data.table.R[353:0]: unused_function -- `INT` is defined but never called in this package.
R/test.data.table.R[355:0]: unused_function -- `gc_mem` is defined but never called in this package.
R/wrappers.R[6:0]: unused_function -- `setcoalesce` is defined but never called in this package.
R/wrappers.R[18:0]: unused_function -- `testMsg` is defined but never called in this package.  
ropensci-review-tools/pkgcheck: +29 -0 violations
New violations (first 100):
R/check-default-branch.R[11:0]: unused_function -- `pkgchk_branch_is_master` is defined but never called in this package.
R/check-fns-have-exs.R[8:0]: unused_function -- `pkgchk_fns_have_exs` is defined but never called in this package.
R/check-fns-have-return-vals.R[12:0]: unused_function -- `pkgchk_fns_have_return_vals` is defined but never called in this package.
R/check-has-citation.R[14:0]: unused_function -- `pkgchk_has_citation` is defined but never called in this package.
R/check-has-citation.R[20:0]: unused_function -- `output_pkgchk_has_citation` is defined but never called in this package.
R/check-has-contrib.R[11:0]: unused_function -- `pkgchk_has_contrib_md` is defined but never called in this package.
R/check-has-contrib.R[37:0]: unused_function -- `output_pkgchk_has_contrib` is defined but never called in this package.
R/check-license.R[11:0]: unused_function -- `pkgchk_license` is defined but never called in this package.
R/check-lintr.R[11:0]: unused_function -- `pkgchk_lintr` is defined but never called in this package.
R/check-lintr.R[18:0]: unused_function -- `output_pkgchk_lintr` is defined but never called in this package.
R/check-num-imports.R[8:0]: unused_function -- `pkgchk_num_imports` is defined but never called in this package.
R/check-obsolete-pkg-deps.R[15:0]: unused_function -- `pkgchk_obsolete_pkg_deps` is defined but never called in this package.
R/check-on-cran.R[12:0]: unused_function -- `pkgchk_on_cran` is defined but never called in this package.
R/check-pkgdown.R[4:0]: unused_function -- `output_pkgchk_pkgdown` is defined but never called in this package.
R/check-pkgname-available.R[6:0]: unused_function -- `pkgchk_pkgname_available` is defined but never called in this package.
R/check-renv.R[12:0]: unused_function -- `pkgchk_renv_activated` is defined but never called in this package.
R/check-unique-fn-names.R[12:0]: unused_function -- `pkgchk_unique_fn_names` is defined but never called in this package.
R/check-urls.R[4:0]: unused_function -- `pkgchk_has_url` is defined but never called in this package.
R/check-urls.R[18:0]: unused_function -- `pkgchk_has_bugs` is defined but never called in this package.
R/check-urls.R[28:0]: unused_function -- `output_pkgchk_has_url` is defined but never called in this package.
R/check-urls.R[45:0]: unused_function -- `output_pkgchk_has_bugs` is defined but never called in this package.
R/check-uses-dontrun.R[14:0]: unused_function -- `pkgchk_uses_dontrun` is defined but never called in this package.
R/check-uses-roxygen2.R[11:0]: unused_function -- `pkgchk_uses_roxygen2` is defined but never called in this package.
R/check-uses-roxygen2.R[26:0]: unused_function -- `output_pkgchk_uses_roxygen2` is defined but never called in this package.
R/check-vignette.R[7:0]: unused_function -- `pkgchk_has_vignette` is defined but never called in this package.
R/check-vignette.R[76:0]: unused_function -- `output_pkgchk_has_vignette` is defined but never called in this package.
R/checks-srr.R[12:0]: unused_function -- `pkgchk_srr_okay` is defined but never called in this package.
R/checks-srr.R[77:0]: unused_function -- `output_pkgchk_srr_most_in_one_file` is defined but never called in this package.
R/utils.R[77:0]: unused_function -- `exported_fns` is defined but never called in this package.  
rstudio/shiny: +17 -0 violations
New violations (first 100):
R/bootstrap.R[160:0]: unused_function -- `getCurrentThemeVersion` is defined but never called in this package.
R/conditions.R[594:0]: unused_function -- `stripStackTrace` is defined but never called in this package.
R/deprecated.R[37:0]: unused_function -- `deprecatedEnvQuotedMessage` is defined but never called in this package.
R/image-interact.R[520:0]: unused_function -- `scaleInvCoords` is defined but never called in this package.
R/input-select.R[170:0]: unused_function -- `needOptgroup` is defined but never called in this package.
R/server.R[13:0]: unused_function -- `wsToKey` is defined but never called in this package.
R/server.R[20:0]: unused_function -- `clearClients` is defined but never called in this package.
R/server.R[25:0]: unused_function -- `registerClient` is defined but never called in this package.
R/shiny-package.R[39:0]: unused_function -- `release_bullets` is defined but never called in this package.
R/utils.R[91:0]: unused_function -- `p_runif` is defined but never called in this package.
R/utils.R[96:0]: unused_function -- `p_sample` is defined but never called in this package.
R/utils.R[117:0]: unused_function -- `isWholeNum` is defined but never called in this package.
R/utils.R[130:0]: unused_function -- `dropNullsOrEmpty` is defined but never called in this package.
R/utils.R[262:0]: unused_function -- `dirRemove` is defined but never called in this package.
R/utils.R[690:0]: unused_function -- `getExists` is defined but never called in this package.
R/utils.R[1316:0]: unused_function -- `setServerInfo` is defined but never called in this package.
R/utils.R[1413:0]: unused_function -- `writeUTF8` is defined but never called in this package.  
tidyverse/dplyr: +8 -0 violations
New violations (first 100):
R/compat-name-repair.R[47:0]: unused_function -- `set_unique_names` is defined but never called in this package.
R/compat-name-repair.R[57:0]: unused_function -- `set_universal_names` is defined but never called in this package.
R/conditions.R[206:0]: unused_function -- `skip_internal_condition` is defined but never called in this package.
R/conditions.R[423:0]: unused_function -- `cnd_message_lines` is defined but never called in this package.
R/context.R[167:0]: unused_function -- `local_column` is defined but never called in this package.
R/grouped-df.R[109:0]: unused_function -- `show_regroups` is defined but never called in this package.
R/mutate.R[520:0]: unused_function -- `check_muffled_warning` is defined but never called in this package.
R/pull.R[51:0]: unused_function -- `find_var` is defined but never called in this package.  
tidyverse/ggplot2: +3 -0 violations
New violations (first 100):
R/coord-radial.R[681:0]: unused_function -- `theta_grid` is defined but never called in this package.
R/utilities-help.R[3:0]: unused_function -- `rd_aesthetics` is defined but never called in this package.
R/zzz.R[45:0]: unused_function -- `release_questions` is defined but never called in this package.  
vincentarelbundock/marginaleffects: +9 -0 violations
New violations (first 100):
R/get_comparisons_data_factor.R[176:0]: unused_function -- `contrast_categories_df` is defined but never called in this package.
R/github_issue.R[1:0]: unused_function -- `github_issue` is defined but never called in this package.
R/sanitize_newdata.R[255:0]: unused_function -- `dedup_newdata` is defined but never called in this package.
R/sanitize_variables.R[466:0]: unused_function -- `get_weight_variables` is defined but never called in this package.
R/settings.R[3:0]: unused_function -- `settings_cache` is defined but never called in this package.
R/settings.R[11:0]: unused_function -- `settings_restore` is defined but never called in this package.
R/settings.R[17:0]: unused_function -- `settings_init` is defined but never called in this package.
R/settings.R[84:0]: unused_function -- `settings_delete` is defined but never called in this package.
R/utils.R[46:0]: unused_function -- `evalup` is defined but never called in this package.  
wch/r-source: +6 -0 violations
New violations (first 100):
tests/Pkgs/PR17859.1/R/f1.R[1:0]: unused_function -- `f1` is defined but never called in this package.
tests/Pkgs/PR17859.1/R/f2.R[1:0]: unused_function -- `f2ok` is defined but never called in this package.
tests/Pkgs/PR17859.1/R/f3.R[1:0]: unused_function -- `f3` is defined but never called in this package.
tests/Pkgs/PR17859.2/R/f1.R[1:0]: unused_function -- `f1` is defined but never called in this package.
tests/Pkgs/exNSS4/R/nss4.R[20:0]: unused_function -- `assertWarning` is defined but never called in this package.
tests/Pkgs/pkgC/R/f.R[5:0]: unused_function -- `Cfun` is defined but never called in this package.  

@github-actions
Copy link

github-actions bot commented Feb 21, 2026

Benchmark on real-projects

Repository Avg. duration (main, seconds) Avg. duration (PR, seconds) PR - main PR - main (%) Number of iterations
easystats/datawizard 0.1913762 0.1995668 0.008190654 4.2798713 50
lrberge/stringmagic 0.1789287 0.1879742 0.009045412 5.0553152 50
pola-rs/r-polars 0.2381174 0.2555718 0.017454390 7.3301619 50
Rdatatable/data.table 0.2222278 0.2355467 0.013318962 5.9933832 50
ropensci/targets 0.3925628 0.4136781 0.021115341 5.3788443 50
rstudio/shiny 0.2013408 0.2118958 0.010555003 5.2423570 50
tidyverse/dplyr 0.2371043 0.2478975 0.010793197 4.5520873 50
tidyverse/ggplot2 0.3582186 0.3772956 0.019077009 5.3255221 50
vincentarelbundock/marginaleffects 0.2009021 0.2112947 0.010392628 5.1729814 50
wch/r-source 1.8533982 1.8570773 0.003679089 0.1985051 50

@etiennebacher etiennebacher mentioned this pull request Feb 21, 2026
@github-actions github-actions bot removed the forgot-changelog This PR adds changes that should be documented in CHANGELOG.md and docs/changelog.md. label Feb 28, 2026
@etiennebacher etiennebacher marked this pull request as ready for review February 28, 2026 14:35
@etiennebacher etiennebacher merged commit 9218f2c into main Feb 28, 2026
14 of 15 checks passed
@etiennebacher etiennebacher deleted the unused-function branch February 28, 2026 14:35
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.

Unused functions

1 participant