Skip to content
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

use_spell_check() does not find typos #542

Closed
JBGruber opened this issue Dec 7, 2018 · 3 comments
Closed

use_spell_check() does not find typos #542

JBGruber opened this issue Dec 7, 2018 · 3 comments

Comments

@JBGruber
Copy link

JBGruber commented Dec 7, 2018

First of all: Thanks for this awsome package. It made developing packages so incredibly easy!

Now the issue I have: I used usethis::use_spell_check() to add an automatic spell check to a little fun package I wrote: www.github.com/JBGruber/rwhatsapp

Now I found a typo in the documentation which was not picked up before. The typo is reported by spelling::spell_check_package() though. Not sure if I understand something wrong but I though usethis::use_spell_check() would cause a warning when running devtools::check().

reprex

I use the said package as reprex. You could also try it by adding a typo to one of your own.

system("git clone https://github.com/JBGruber/rwhatsapp.git")
setwd("./rwhatsapp")
lines <- readLines("./R/rwhatsapp.R")
lines[grepl("#'   problems you can provide a", lines)] <- gsub(
  x = lines[grepl("#'   problems you can provide a", lines)],
  pattern = "custom",
  replacement = "cudtom"
)
writeLines(lines, "./R/rwhatsapp.R")
roxygen2::roxygenise(clean = TRUE)
devtools::check()
spelling::spell_check_package()
session_info()

some output

These are the last lines of output for me when running devtools::check() and the output of spelling::spell_check_package()

✔  Running ‘spelling.R’
✔  Running ‘testthat.R’
   
   
── R CMD check results ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── rwhatsapp 0.1.3.9000 ────
Duration: 28.7s

0 errors ✔ | 0 warnings ✔ | 0 notes ✔
> spelling::spell_check_package()
  WORD     FOUND IN
cudtom   rwa_read.Rd:18

And here comes my session_info() in case you need it.

> session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 os       Ubuntu 18.04.1 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en_GB:en                    
 collate  en_GB.UTF-8                 
 ctype    en_GB.UTF-8                 
 tz       Europe/London               
 date     2018-12-07                  

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 !  package     * version    date       lib source                            
    assertthat    0.2.0      2017-04-11 [1] CRAN (R 3.5.0)                    
    backports     1.1.2      2017-12-13 [1] CRAN (R 3.5.0)                    
    base64enc     0.1-3      2015-07-28 [1] CRAN (R 3.5.0)                    
    bindr         0.1.1      2018-03-13 [1] CRAN (R 3.5.0)                    
    bindrcpp      0.2.2      2018-03-29 [1] CRAN (R 3.5.0)                    
    broom         0.5.1      2018-12-05 [1] CRAN (R 3.5.1)                    
    callr         3.0.0      2018-08-24 [1] CRAN (R 3.5.1)                    
    cli           1.0.1      2018-09-25 [1] CRAN (R 3.5.1)                    
    commonmark    1.7        2018-12-01 [1] CRAN (R 3.5.1)                    
    covr          3.2.1      2018-10-18 [1] CRAN (R 3.5.1)                    
    crayon        1.3.4      2017-09-16 [1] CRAN (R 3.5.0)                    
    desc          1.2.0      2018-05-01 [1] CRAN (R 3.5.0)                    
    devtools    * 2.0.1      2018-10-26 [1] CRAN (R 3.5.1)                    
    digest        0.6.18     2018-10-10 [1] CRAN (R 3.5.1)                    
    dplyr         0.7.8      2018-11-10 [1] CRAN (R 3.5.1)                    
    fs            1.2.6      2018-08-23 [1] CRAN (R 3.5.1)                    
    generics      0.0.2      2018-11-29 [1] CRAN (R 3.5.1)                    
    glue          1.3.0      2018-11-09 [1] Github (tidyverse/glue@35c61e9)   
    hunspell      2.9        2017-12-16 [1] CRAN (R 3.5.0)                    
    janeaustenr   0.1.5      2017-06-10 [1] CRAN (R 3.5.1)                    
    lattice       0.20-38    2018-11-04 [4] CRAN (R 3.5.1)                    
    lazyeval      0.2.1      2017-10-29 [1] CRAN (R 3.5.0)                    
    magrittr      1.5        2014-11-22 [1] CRAN (R 3.5.0)                    
    Matrix        1.2-15     2018-11-01 [4] CRAN (R 3.5.1)                    
    memoise       1.1.0      2017-04-21 [1] CRAN (R 3.5.0)                    
    nlme          3.1-137    2018-04-07 [4] CRAN (R 3.5.0)                    
    pillar        1.3.0      2018-07-14 [1] CRAN (R 3.5.1)                    
    pkgbuild      1.0.2      2018-10-16 [1] CRAN (R 3.5.1)                    
    pkgconfig     2.0.2      2018-08-16 [1] CRAN (R 3.5.1)                    
    pkgload       1.0.2      2018-10-29 [1] CRAN (R 3.5.1)                    
    prettyunits   1.0.2      2015-07-13 [1] CRAN (R 3.5.0)                    
    processx      3.2.1      2018-12-05 [1] CRAN (R 3.5.1)                    
    ps            1.2.1      2018-11-06 [1] CRAN (R 3.5.1)                    
    purrr         0.2.5      2018-05-29 [1] CRAN (R 3.5.0)                    
    R6            2.3.0      2018-10-04 [1] CRAN (R 3.5.1)                    
    rcmdcheck     1.3.2      2018-11-10 [1] CRAN (R 3.5.1)                    
    Rcpp          1.0.0      2018-11-07 [1] CRAN (R 3.5.1)                    
    remotes       2.0.2      2018-10-30 [1] CRAN (R 3.5.1)                    
    rex           1.1.2      2017-10-19 [1] CRAN (R 3.5.0)                    
    rlang         0.3.0.1    2018-10-25 [1] CRAN (R 3.5.1)                    
    roxygen2    * 6.1.1      2018-11-07 [1] CRAN (R 3.5.1)                    
    rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.5.0)                    
    rstudioapi    0.8        2018-10-02 [1] CRAN (R 3.5.1)                    
 VP rwhatsapp   * 0.1.3.9000 2018-12-07 [?] local                             
    sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.5.1)                    
    SnowballC     0.5.1      2014-08-09 [1] CRAN (R 3.5.0)                    
    spelling      1.2        2018-12-07 [1] Github (ropensci/spelling@5c6d160)
    stringi       1.2.4      2018-07-20 [1] CRAN (R 3.5.1)                    
    stringr       1.3.1      2018-05-10 [1] CRAN (R 3.5.0)                    
    testthat      2.0.1      2018-10-13 [1] CRAN (R 3.5.1)                    
    tibble        1.4.2      2018-01-22 [1] CRAN (R 3.5.0)                    
    tidyr         0.8.2      2018-10-28 [1] CRAN (R 3.5.1)                    
    tidyselect    0.2.5      2018-10-11 [1] CRAN (R 3.5.1)                    
    tidytext      0.2.0      2018-10-17 [1] CRAN (R 3.5.1)                    
    tokenizers    0.2.1      2018-03-29 [1] CRAN (R 3.5.1)                    
    usethis     * 1.4.0      2018-08-14 [1] CRAN (R 3.5.1)                    
    withr         2.1.2      2018-03-15 [1] CRAN (R 3.5.0)                    
    xml2          1.2.0      2018-01-24 [1] CRAN (R 3.5.0)                    
    xopen         1.0.0      2018-09-17 [1] CRAN (R 3.5.1)                    
    yaml          2.2.0      2018-07-25 [1] CRAN (R 3.5.1)      

Thanks!

@JBGruber
Copy link
Author

I did some digging and found this in the documentation for spelling::spell_check_setup (which I realised is used under the hood here):

"The spell_check_setup function adds a unit test to your package which automatically runs a spellcheck on documentation and vignettes during R CMD check if the environment variableNOT_CRANis set to TRUE. "

For me, this variable was not set. After setting Sys.setenv(NOT_CRAN = TRUE), all works as intended.

I then used usethis::edit_r_environ("project") to add this to my package's project. Maybe this could be included either as a suggestion or it could be done automatically?

Or I could create a new issue in the spelling package since it seems to me like this should be included in spelling::spell_check_setup anyway or at least made more explicit in the documentation.

@jennybc
Copy link
Member

jennybc commented Dec 11, 2018

I think the devtools-verse does generally set NOT_CRAN = TRUE (yes @jimhester?). I see evidence of this spellcheck test when I use check() locally, but we have a printing problem that makes the output impossible to see, at least in RStudio (r-lib/rcmdcheck#88).

✔  checking for unstated dependencies in ‘tests’ ...
─  checking tests ...
✔< yaml       use_pkgdown.Rd:13 (1.8s)ing.Rout.save’ ...
✔  Running ‘testthat.R’ [10s/11s]

So several things are interacting here. In any case, I don't think there is anything to be done about it in usethis.

I note that the test results show up beautifully for me in travis logs, e.g. https://travis-ci.org/r-lib/usethis/jobs/466364994#L1202-L1219

Until the rcmdcheck issue is fixed, that's where I'm looking.

cc @jeroen @gaborcsardi

@JBGruber
Copy link
Author

JBGruber commented Dec 11, 2018

Thanks @jennybc for looking into this.

I just realised that everything works fine when I use Build -> Check Package in RStudio instead of typing devtools::check().

> checking tests ...
  See below...

-- Test failures ------------------------------------------------- spelling ----

> if(requireNamespace('spelling', quietly=TRUE))
+   spelling::spell_check_test(vignettes = TRUE, error = TRUE, skip_on_cran = TRUE)
Error: Potential spelling errors: cudtom
Execution halted

1 error x | 0 warnings v | 0 notes v
Error: R CMD check found ERRORs
Execution halted

Exited with status 1.

I'm still a bit confused why this happens (so it would be great if someone wants to elaborate) but at least I know how to get around it.

About the printing problem: I prefer the tests to fail when there is a misspelled word. So I can either resolve it or add to my WORDLIST. So I didn't even notice that.

Anyway, it seems usethis and spelling are fine!

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

No branches or pull requests

2 participants