-
Notifications
You must be signed in to change notification settings - Fork 186
lint_package() and find_package(".") does not work anymore if depth >= 2 #1759
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
Comments
Hi, can you give us an MWE so we can see what is going on? |
Sure here s a reprex but in any package if you call lintr::lint_package() two directories below the root folder of your package it will fail to find the package to lint...
but this works as now it can find the package root:
|
Thanks for providing the MWE.
So the problem is actually that the path needs to be normalized before starting the search. |
With #1765, no more warnings: usethis::create_package("~/testme", open = FALSE)
#> ✔ Setting active project to '/Users/indrajeetpatil/testme'
#> Package: testme
#> 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.2.1
#> ✔ Setting active project to '<no active project>'
dir.create("~/testme/dir1/dir2", recursive = TRUE)
#> Warning in dir.create("~/testme/dir1/dir2", recursive = TRUE): '/Users/
#> indrajeetpatil/testme/dir1/dir2' already exists
setwd("~/testme/dir1/dir2")
lintr::lint_package() Created on 2022-11-09 with reprex v2.0.2 |
* use normalizePath() in find_package() fixes #1759 * allow undesirable_operator ::: in test-settings.R * d'oh * remove unnecessary testthat.R * add back testthat.R without comments Co-authored-by: Indrajeet Patil <patilindrajeet.science@gmail.com>
thanks for the fix! |
In my package I have a code style test so it calls
lint_package()
from thetests/testthat
folder.The new logic in find_package fails at finding the root of the package ( I guess from this commit 3009505 )
so If I call lint_package from a deeper level than 2 it fails at finding the package actually...
The above code warns/fails with:
The text was updated successfully, but these errors were encountered: