Open JsLth opened 2 weeks ago
Thank you for these ideas and your interest in my package. I have been contemplating extending the package to test for other requirements, but the idea of coding these one by one is rather daunting. The idea of making this the users responsibility to manage this is attractive.
I do have a few concerns though.
rm -rf
for example. Can the input be sanitised?I'm happy to take advice on these issues, but would be happier to hard code the checks.
Beyond java, do you have suggestions of what other checks would be useful?
I understand your concerns on security and cross-OS compatibility, although I would argue that students always take this risk when executing code given to them by an instructor. Unfortunately, I don't think it is possible to properly sanitize or control the consequences of arbitrary R code, especially given the fact that users can use base R methods like Sys.chmod()
or fork bombs to perform malicious activities on students' machines.
Ultimately, I think most use cases for this idea can surely be hard-coded. Some ideas:
Sys.which()
or something like knitr:::has_utility()
)renv
project is active (getOption("renv.project.path")
)Sys.getenv("API_KEY")
)gert::git_find()
)Sys.getlocale()
)Sys.timezone()
) so that course participants in different timezones know about possible error sources as soon as possible (no simple fix for this case)targets::tar_exist_script()
)pkgbuild::has_rtools()
)reticulate::py_available()
and reticulate::py_version()
)rJavaEnv::java_check_version_cmd()
)JuliaCall:::julia_locate()
)rmarkdown::pandoc_available()
)tinytex::tinytex_root()
or pkgbuild::has_latex()
) or LaTeX packages (tinytex::check_installed()
)stevedore::docker_available()
?)qgisprocess::qgis_version()
)Some of these I need for my teaching - I have big problems with locale on windows computers making it difficult to work with Norwegian letters - and I see the utility of most of the rest (not sure why the time zone check is useful). Doesn't pandoc come with quarto or rmarkdown automatically - does it need testing for separately?
I'd like to implement as much of this as possible without requiring extra dependencies. One of the design principals I had when writing the package was to use as few packages as possible as each package increases the probability of something breaking.
One possibility would be to suggest packages like stevedore rather than imported them so only student who need the test need to install it. If the package checks are run before the extra tests, this should work nicely.
Longer term, it might be necessary to look at how checker would work with positron or other IDE.
I'd also like the package to include some tests with testthat.
I'm in the middle of teaching at the moment (students used checker today) so it will take a while before I have time to look at checker again, but pull requests are welcome.
Thanks for making this package! It seems very interesting for a couple of use cases.
I am wondering if it is feasible to extend
chk_make()
to support arbitrary requirements. Something along the lines of:Note that the condition for the check is self-provided by the user. In this case, I want to establish a check that checks if the right version of java is installed. I can imagine passing parameters using the neighboring fields and then glueing them into the condition string using
glue::glue()
(also note the curly braces around theversion
variable). Additionally, users can provide a fail or success message in a similar fashion. Achk_extra
function could look something like so:Of course, the code chunk is very bare bones and I don't know if it works. It only serves to illustrate the idea. Do you think this could be a reasonable addition to the package? If so, I could prepare a pull request. I think this would greatly expand the scope of this package.