-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate and remove old mocking functions #1986
Open
hadley
wants to merge
1
commit into
main
Choose a base branch
from
deprecate-mock
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hadley
changed the title
Deprecate old mocking functions
Deprecate and remove old mocking functions
Nov 15, 2024
hadley
force-pushed
the
deprecate-mock
branch
from
January 10, 2025 22:53
d8799cb
to
1750b4a
Compare
hadley
force-pushed
the
deprecate-mock
branch
from
January 10, 2025 22:55
1750b4a
to
c967250
Compare
Code used to inform users: library(gh)
library(purrr)
library(dplyr)
packages <-tribble(
~package, ~github_url,
"countdown", "https://github.com/gadenbuie/countdown",
"covr", "https://github.com/r-lib/covr",
"crossmap", "https://github.com/rossellhayes/crossmap",
"crplyr", "https://github.com/Crunch-io/crplyr",
"crunch", "https://github.com/Crunch-io/rcrunch",
"crunchy", "https://github.com/Crunch-io/crunchy",
"cyphr", "https://github.com/ropensci/cyphr",
"datarobot", NA,
"dendextend", "https://github.com/talgalili/dendextend",
"digitize", "https://github.com/tpoisot/digitize",
"distro", NA,
"dRiftDM", "https://github.com/bucky2177/dRiftDM",
"DSMolgenisArmadillo", "https://github.com/molgenis/molgenis-r-datashield",
"gbfs", "https://github.com/simonpcouch/gbfs",
"gen3sis", "https://github.com/project-Gen3sis/R-package",
"graphhopper", "https://github.com/crazycapivara/graphhopper-r",
"gwasrapidd", "https://github.com/ramiromagno/gwasrapidd",
"hereR", "https://github.com/munterfi/hereR",
"humanize", "https://github.com/newtux/humanize",
"ieegio", "https://github.com/dipterix/ieegio",
"ipaddress", "https://github.com/davidchall/ipaddress",
"isotracer", NA,
"JAGStree", "https://github.com/malfly/JAGStree",
"leaflet.minicharts", NA,
"learnr", "https://github.com/rstudio/learnr",
"MakefileR", "https://github.com/krlmlr/MakefileR",
"manipulateWidget", "https://github.com/rte-antares-rpackage/manipulateWidget",
"mbbe", "https://github.com/certara/mbbe",
"metaDigitise", "https://github.com/daniel1noble/metaDigitise",
"mknapsack", "https://github.com/madedotcom/mknapsack",
"mockery", "https://github.com/r-lib/mockery",
"moexer", "https://github.com/x1o/moexer",
"MolgenisArmadillo", "https://github.com/molgenis/molgenis-r-armadillo",
"MolgenisAuth", "https://github.com/molgenis/molgenis-r-auth",
"NasdaqDataLink", "https://github.com/nasdaq/data-link-r",
"nhlapi", "https://github.com/jozefhajnala/nhlapi",
"odin", "https://github.com/mrc-ide/odin",
"opendatatoronto", "https://github.com/sharlagelfand/opendatatoronto",
"overture", "https://github.com/kurtis-s/overture",
"owmr", "https://github.com/crazycapivara/owmr",
"oxcAAR", NA,
"passport", "https://github.com/alistaire47/passport",
"patrick", "https://github.com/google/patrick",
"plumber", "https://github.com/rstudio/plumber",
"pocketapi", "https://github.com/CorrelAid/pocketapi",
"projmgr", "https://github.com/emilyriederer/projmgr",
"Quandl", "https://github.com/quandl/quandl-r",
"regmedint", "https://github.com/kaz-yos/regmedint",
"rentrez", "https://github.com/ropensci/rentrez",
"reportr", "https://github.com/jonclayden/reportr",
"restez", "https://github.com/ropensci/restez",
"Rexperigen", "https://github.com/aquincum/Rexperigen",
"rnbp", "https://github.com/szymanskir/rnbp",
"rosetteApi", NA,
"Rpolyhedra", "https://github.com/ropensci/Rpolyhedra",
"RPresto", "https://github.com/prestodb/RPresto",
"RTD", "https://github.com/treasure-data/RTD",
"Ryacas0", "https://github.com/r-cas/ryacas0",
"shiny.benchmark", "https://github.com/Appsilon/shiny.benchmark",
"shinyShortcut", NA,
"skimr", "https://github.com/ropensci/skimr",
"spaero", "https://github.com/e3bo/spaero",
"starwarsdb", "https://github.com/gadenbuie/starwarsdb",
"taxonomizr", "https://github.com/sherrillmix/taxonomizr",
"texreg", "https://github.com/leifeld/texreg",
"ThankYouStars", "https://github.com/ksmzn/ThankYouStars",
"tinyProject", NA,
"tryCatchLog", "https://github.com/aryoda/tryCatchLog",
"tuneRanger", NA,
"uptasticsearch", "https://github.com/uptake/uptasticsearch",
"WhatIf", "https://github.com/IQSS/WhatIf",
"ZillowR", NA,
"zoltr", "https://github.com/reichlab/zoltr"
)
# Function to extract owner/repo from GitHub URL
extract_repo_info <- function(url) {
parts <- strsplit(gsub("https://github.com/", "", url), "/")[[1]]
list(owner = parts[1], repo = parts[2])
}
packages_df <- packages %>%
filter(!is.na(github_url)) %>%
mutate(
repo_info = map(github_url, extract_repo_info),
owner = map_chr(repo_info, "owner"),
repo = map_chr(repo_info, "repo")
) %>%
select(-repo_info) # Clean up the intermediate list-column
# Function to create an issue
create_issue <- function(owner, repo) {
tryCatch({
gh::gh(
"POST /repos/{owner}/{repo}/issues",
owner = owner,
repo = repo,
title = "with_mock() is going away",
body = "This is a heads up to let you know that `with_mock()` is deprecated and will be made defunct soon. The API functions that made it work are being removed in R 4.5.0, so we'd suggest that you switch to `with_mocked_bindings()` instead."
)
message(sprintf("Successfully created issue for %s/%s", owner, repo))
}, error = function(e) {
message(sprintf("Failed to create issue for %s/%s: %s", owner, repo, e$message))
})
# Sleep to avoid hitting rate limits
Sys.sleep(.1)
}
walk2(packages_df$owner, packages_df$repo, create_issue) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.