{"id":14069019,"url":"https://github.com/ThinkR-open/checkhelper","last_synced_at":"2025-07-30T05:31:03.083Z","repository":{"id":43040049,"uuid":"200236511","full_name":"ThinkR-open/checkhelper","owner":"ThinkR-open","description":"A package to help deal with devtools::check outputs","archived":false,"fork":false,"pushed_at":"2024-01-22T12:54:57.000Z","size":649,"stargazers_count":34,"open_issues_count":25,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-28T21:53:04.669Z","etag":null,"topics":["r","r-package","rstats"],"latest_commit_sha":null,"homepage":"https://thinkr-open.github.io/checkhelper/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThinkR-open.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-02T13:08:55.000Z","updated_at":"2023-12-08T15:08:47.000Z","dependencies_parsed_at":"2024-01-22T14:37:52.065Z","dependency_job_id":null,"html_url":"https://github.com/ThinkR-open/checkhelper","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fcheckhelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fcheckhelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fcheckhelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkR-open%2Fcheckhelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThinkR-open","download_url":"https://codeload.github.com/ThinkR-open/checkhelper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228092111,"owners_count":17868136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["r","r-package","rstats"],"created_at":"2024-08-13T07:06:32.873Z","updated_at":"2024-12-04T10:30:49.517Z","avatar_url":"https://github.com/ThinkR-open.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n\u003c!-- badges: start --\u003e\n[![checkhelper status badge](https://thinkr-open.r-universe.dev/badges/checkhelper)](https://thinkr-open.r-universe.dev)\n[![R-CMD-check](https://github.com/ThinkR-open/checkhelper/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ThinkR-open/checkhelper/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/ThinkR-open/checkhelper/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ThinkR-open/checkhelper/tree/main)\n[![](https://cranlogs.r-pkg.org/badges/checkhelper)](https://cran.r-project.org/package=checkhelper)\n[![CRAN status](https://www.r-pkg.org/badges/version/checkhelper)](https://CRAN.R-project.org/package=checkhelper)\n\u003c!-- badges: end --\u003e\n  \n# checkhelper\nA package to help you deal with `devtools::check()` outputs and helps avoids problems with CRAN submissions\n\nComplete documentation in the {pkgdown} site: https://thinkr-open.github.io/checkhelper/\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n## Installation\n\nInstall from CRAN\n\n```r\ninstall.packages(\"checkhelper\")\n```\n\n\nYou can install the last version of checkhelper from r-universe with:\n\n```r\ninstall.packages('checkhelper', repos = 'https://thinkr-open.r-universe.dev')\n```\n\n\nOr from GitHub:\n``` r\nremotes::install_github(\"thinkr-open/checkhelper\")\n```\n\n## Examples\n\n- Check your current package under development and get all the globals missing: `no visible global variable` and `no visible global function`\n- Detect exported functions with missing or empty `@return` / `@noRd` tags\n\n### Directly in your package in development\n\n- Use `checkhelper::find_missing_tags()` on your package in development to find which functions are exported but missing `@export` roxygen2 tag. \n  - CRAN policy asks for every exported function to have a value (named `@export` when using {roxygen2}). \n  - This also checks that not exported functions don't have roxygen title, or have `@noRd` in case you faced `Please add \\value to .Rd files` CRAN message for documented but not exported functions.\n- You can directly use `checkhelper::print_globals()` on your package instead of `devtools::check()`. This is a wrapper around `rcmdcheck::rcmdcheck()`. This will run the checks and directly list the potential \"globalVariables\" to add in a `globals.R` file.\n\n```{r, eval=FALSE}\ncheckhelper::find_missing_tags()\n\ncheckhelper::print_globals(quiet = TRUE)\n```\n\n### Reproducible example with a fake package in tempdir\n\n- Create a fake package with \n  - a function having global variables\n  - a function with `@export` but no `@return`\n  - a function with title but without `@export` and thus missing `@noRd`\n  \n```{r, eval=TRUE, results='hide'}\nlibrary(checkhelper)\n\n# Create fake package ----\npkg_path \u003c- tempfile(pattern = \"pkg.\")\ndir.create(pkg_path)\n\n# Create fake package\nusethis::create_package(pkg_path, open = FALSE)\n\n# Create function no visible global variables and missing documented functions\ncat(\"\n#' Function\n#' @importFrom dplyr filter\n#' @export\nmy_fun \u003c- function() {\ndata %\u003e%\nfilter(col == 3) %\u003e%\nmutate(new_col = 1) %\u003e%\nggplot() +\n  aes(x, y, colour = new_col) +\n  geom_point()\n}\n\n#' Function not exported but with doc\nmy_not_exported_doc \u003c- function() {\n  message('Not exported but with title, should have @noRd')\n}\n\", file = file.path(pkg_path, \"R\", \"function.R\"))\n\nattachment::att_amend_desc(path = pkg_path)\n\n# Files of the package\nfs::dir_tree(pkg_path, recurse = TRUE)\n```\n\n- Find missing `@return` and find missing `@noRd` for not exported function with documentation\n\n```{r}\nfind_missing_tags(pkg_path)\n```\n\n\n- Get global variables\n```{r}\nglobals \u003c- get_no_visible(pkg_path, quiet = TRUE)\nglobals\n```\n\n- Print globals to copy-paste\n```{r, eval=TRUE}\nprint_globals(globals)\n```\n\n- Store the output of `print_globals()` in package using `usethis::use_r(\"globals\")`. \nNote that you can also transform all these variables with `.data[[variable]]`\n\n### Experimental: Check that the user space is clean after checks\n\nHave you faced a note on CRAN about non-standard things in the check directory ?\n\n```\nCheck: for non-standard things in the check directory\nResult: NOTE\n    Found the following files/directories:\n     ‘extrapackage’ \n```\n\nMaybe you do not understand where these files came from.  \nThen, you can run `check_clean_userspace()` in your package directory to detect every files that you created during the check.  \nThey could be issued from examples, tests or vignettes: `check_clean_userspace()` will tell you.\n\n```{r examples-check_clean_userspace, eval=FALSE}\ncheck_clean_userspace()\n```\n```{r, echo=FALSE, message=FALSE}\npkgload::load_all()\npath \u003c- suppressWarnings(create_example_pkg())\ndir.create(file.path(path, \"tests\", \"testthat\"), recursive = TRUE)\n# Add a test that let file in the testthat dir\ncat(\n  \"cat(\\\"#in tests\\\", file = \\\"in_test.R\\\")\",\n  file = file.path(path, \"tests\", \"testthat\", \"test-in_test.R\")\n)\n\n# Add an example that let file in tempdir\ncat(\n  \"#' Function\",\n  \"#' @return 1\",\n  \"#' @export\",\n  \"#' @examples\",\n  \"#' text \u003c- \\\"in_example\\\"\",\n  \"#' file \u003c- tempfile(\\\"in_example\\\")\",\n  \"#' cat(text, file = file)\",\n  \"in_example \u003c- function() {\",\n  \"1\",\n  \"}\",\n  sep = \"\\n\",\n  file = file.path(path, \"R\", \"in_example.R\")\n)\n\nsuppressWarnings(attachment::att_amend_desc(path = path))\n\ncheck_output \u003c- tempfile(\"check_output\")\n\nsuppressMessages(\n  all_files \u003c- check_clean_userspace(pkg = path, check_output = check_output),\n)\nall_files\n```\n\n\n### Experimental: Check as CRAN with CRAN global variables\n\nUse the exploration of CRAN scripts by the RConsortium to check a package as CRAN does it with their env. variables. See https://github.com/RConsortium/r-repositories-wg/issues/17 for more details.  \n\n```{r eval=FALSE}\n# Check the current directory\ncheck_as_cran()\n```\n\n## Code of Conduct\n  \n  Please note that the checkhelper project is released with a [Contributor Code of Conduct](https://thinkr-open.github.io/checkhelper/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThinkR-open%2Fcheckhelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FThinkR-open%2Fcheckhelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThinkR-open%2Fcheckhelper/lists"}