HenrikBengtsson / startup

:wrench: R package: startup - Friendly R Startup Configuration
https://henrikbengtsson.github.io/startup/
163 stars 5 forks source link

Integrity with {prompt} package #84

Closed pat-s closed 4 years ago

pat-s commented 4 years ago

When setting

prompt::set_prompt(prompt::prompt_git)

I can't find a way to silence the warning from {startup} related to the "error" option. {prompt} modifies the "error" option on purpose:

getOption("error")

(function () 
{
    update_prompt(expr = NA, value = NA, ok = FALSE, visible = NA)
    orig <- prompt_env$error
    if (!is.null(orig) && is.function(orig)) 
        orig()
    if (!is.null(orig) && is.call(orig)) 
        eval(orig)
})()
HenrikBengtsson commented 4 years ago

I can't find a way to silence the warning from {startup} related to the "error" option.

I'm working on the next release. Can you give more info, e.g. exactly which warning, sessionInfo(), and whether you do this the terminal, RStudio, or where?

pat-s commented 4 years ago

Setting prompt::set_prompt(prompt::prompt_git) within .Rprofile.d/<any file> causes the warning below.

Workaround is to set prompt::set_prompt(prompt::prompt_git) after startup::startup() directly in .Rprofile.

Only applies to RStudio.

Restarting R session...

Warning message:
In check_rstudio_option_error_conflict(debug = debug) :
  startup::check(): CONFLICT: Option ‘error’ was set during the R startup, but this will be overridden by the RStudio settings (menu ‘Debug -> On Error’) when using the RStudio Console. To silence this warning, set option 'error' using ‘if (!startup::sysinfo()$rstudio) options(error = ...)’. For further details on this issue, see https://github.com/rstudio/rstudio/issues/3007
lintr-ci > 
lintr-ci > sessionInfo()
R version 3.6.3 Patched (2020-03-11 r78052)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.4

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] browse_0.0.0.9000     prettycode_1.1.0.9000 remotes_2.1.1        
[4] fledge_0.0.3.9000     reprex_0.3.0          teamtools_0.1.0      
[7] usethis_1.5.1.9000   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.5     rstudioapi_0.11  knitr_1.28       magrittr_1.5    
 [5] hms_0.5.3        rsthemes_0.0.7   prompt_1.0.0     rlang_0.4.5     
 [9] tools_3.6.3      packrat_0.5.0    xfun_0.12        git2r_0.26.1    
[13] htmltools_0.4.0  yaml_2.2.1       digest_0.6.25    tibble_2.1.3    
[17] crayon_1.3.4     purrr_0.3.3      vctrs_0.2.4      fs_1.3.2        
[21] clisymbols_1.2.0 glue_1.3.2       evaluate_0.14    rmarkdown_2.1   
[25] compiler_3.6.3   pillar_1.4.3     pkgconfig_2.0.3 
HenrikBengtsson commented 4 years ago

Only applies to RStudio.

Thxs, I can reproduce in the RStudio Console of RStudio 1.2.5033 on Linux. However, it looks like the warning occurs only once in RStudio. If I restart RStudio or the session, then the warning is no longer there. Can you confirm that you also see this? What version of RStudio are you on?

I think startup warns only once because it looks like the RStudio Console now respects changes to option error, i.e. it no longer overrides it by its own preferred settings. When I look at, menu Debug -> On Error, nothing is selected if I set option error. If I select 'Error Inspector' or 'Break in Code', then it'll change option error and the next time I restart, the startup warning appears again (once). Do you see this too?

This is related to https://github.com/HenrikBengtsson/startup/issues/87. If I can confirm that RStudio Console behaves much nicer regarding error these days, I'll remove the check/warning all along. To further mitigate the problem, I've updated startup to respect check = FALSE/R_STARTUP_CHECK=FALSE/startup.check=FALSE in this case too.

HenrikBengtsson commented 4 years ago

Per Issue #87, I've disabled the default validation of the error option.