Closed wlangera closed 1 month ago
Please compare the version numbers of checklist and lintr on both system. You find that information in the output of checklist.
When using a package in a custom function in a project you need to use the package::function
notation for non base R functions.
In your case sf::st_cast()
.
And add stopifnot(requireNamespace("sf", quietly = TRUE))
at the top of function.
This makes the function gracefully halt when sf
is not available.
I notice indeed that i have locally:
version R version 4.3.2 (2023-10-31 ucrt)
and
lintr 3.1.1.9000 2023-12-28 [1] https://inbo.r-universe.dev (R 4.3.2)
while on GitHub
version R version 4.3.1 (2023-06-16)
and
lintr 3.0.2.9000 2023-07-14 [1] https://inbo.r-universe.dev/ (R 4.3.1)
How can I update this on GitHub such that it uses the same versions as me locally?
I use multiple sf-functions. Can I not use require(sf)
instead of using sf::
all the time?
(after stopifnot(requireNamespace("sf", quietly = TRUE))
)
You can't update the versions on GitHub they are locked in the docker image
I use multiple sf-functions. Can I not use
require(sf)
instead of usingsf::
all the time? (afterstopifnot(requireNamespace("sf", quietly = TRUE))
)
Unless your function is part of a package which Imports
the required functions via the NAMESPACE
, you always need to use the package::function
notation. The NAMESPACE
is the only thing that can guarantee that the function names are unique.
When I run the
check_project()
(orcheck_lintr()
) locally I get no coding style problems. Yet, when I push this to my remote on GitHub, it reports warnings aboutno visible global function definition for 'st_cast'
.So there seems to be a mismatch between check
check_project()
locally and in the GitHub action. I use the latest release (checklist version 0.3.5).Any ideas why this mismatch could occur?