r-lib / urlchecker

Run CRAN URL checks from older versions of R
https://urlchecker.r-lib.org/
GNU General Public License v3.0
47 stars 4 forks source link

`url_check()` result cannot print when empty URL detected #47

Open jmbarbone opened 2 months ago

jmbarbone commented 2 months ago

urlchecker:::print.urlchecker_db() is failing when an empty []() (or [text]()) is detected

packageVersion("urlchecker")
#> [1] '1.0.1.9000'
usethis::create_package("foo")
#> ✔ Creating 'foo/'.
#> ✔ Setting active project to
#>   "/tmp/RtmpC7uxHR/reprex-80251ffc9af2-irate-booby/foo".
#> ✔ Creating 'R/'.
#> ✔ Writing 'DESCRIPTION'.
#> Package: foo
#> Title: What the Package Does (One Line, Title Case)
#> Version: 0.0.0.9000
#> Authors@R (parsed):
#>     * First Last <first.last@example.com> [aut, cre] (YOUR-ORCID-ID)
#> Description: What the package does (one paragraph).
#> License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
#>     license
#> Encoding: UTF-8
#> Roxygen: list(markdown = TRUE)
#> RoxygenNote: 7.3.2
#> ✔ Writing 'NAMESPACE'.
#> ✔ Setting active project to "<no active project>".
writeLines("[]()", "foo/NEWS.md")
res <- urlchecker::url_check("foo")
str(res)
#> Classes 'urlchecker_db', 'check_url_db' and 'data.frame':    1 obs. of  9 variables:
#>  $ URL    : chr ""
#>  $ From   :List of 1
#>   ..$ : chr "NEWS.md"
#>  $ Status : chr ""
#>  $ Message: chr "Empty URL"
#>  $ New    : chr ""
#>  $ CRAN   : chr ""
#>  $ Spaces : chr ""
#>  $ R      : chr ""
#>  $ root   : chr "/tmp/RtmpC7uxHR/reprex-80251ffc9af2-irate-booby/foo"
res
#> Error in strrep("~", ends[[i]] - starts[[i]] - 1): invalid 'times' value

Created on 2024-09-27 with reprex v2.1.1