shiny
shiny copied to clipboard
Avoid bogus warning
in loadSupport(), if _disable_autoload.R exists.
@krlmlr Can you provide instructions on how to reproduce the issue?
Create a Shiny app with a package structure (with DESCRIPTION and NAMESPACE files) that contains a file R/_disable_autoload.R and uses e.g. pkgload::load_all() to load the files in R/ . The warning still occurs.
Do we need a test here?
Minimal code for reproducing bogus warning here:
withr::with_dir(tempdir(check = TRUE),{
dir.create("R", showWarnings = FALSE)
# loadSupport documentation suggests adding a blank R/_disable_autoload.R file
# will disable automatic loading of the R/ files
file.create("R/_disable_autoload.R")
# test that code was not loaded by adding a print statement
writeLines(
"print('R/ code was sourced')",
"R/code.R"
)
# loadSupport checks for a NAMESPACE file and/or a DESCRIPTION file to determine
# if the directory contains a package, add NAMESPACE to trigger the check
file.create("NAMESPACE")
# add minimal app.R code
writeLines(
text = "
shiny::shinyApp(
ui = shiny::fluidPage(),
server = function(input, output, session) {}
)
",
con = "app.R"
)
shiny::runApp()
# still triggers warning, despite not actually running the code in question
})