Skip to content

Advice for pre-commit.ci debugging #334

Closed
@lorenzwalthert

Description

@lorenzwalthert

There are a few issues where users might get lost or are unexpected. A good example is https://results.pre-commit.ci/run/github/146200962/1638570757.qIlnbiX1QlaCkdfzypQpaA.

lintr hook:

#> Error in loadNamespace(name) : there is no package called ‘checkmate’

Not sure what the problem is here. But we should probably handle packageNotFoundError more generally and tell people that they need to add the dependencies to additional_dependencies:
It's already handled in the style-files hook and in the roxygenize hook but this should be more generic functionality.

# both give same error
tryCatch(xxerwer::df, error = function(e) class(e))
tryCatch(library(fjkjsf), error = function(e) class(e))

roxygenize hook

  • Warning about cache. Maybe it should be disabled when the env variable CI is set (or narrow it down to pre-commit.ci), since these caches are mostly useful for local workflows. ✅ with {R.cache} > 0.15, it becomes obsolete -> remove it.
  • the additional_dependencies: makes only sense if one does not hit the timeout. So the timeout should be mentioned. ✅
  • the dev version of precommit is no longer needed for generating the roxygen snippet. ✅
  • mention how one can skip the roxygenize hook on ci. ✅
  • move all that documentation out of the error message into the ci vignette.

deps-in-desc

{knitr} is often used in README.md but it's not really a dependency (unless vignettes exist, then it's a suggests) since README.Rmd is in .Rbuildignore. I think this is a false positive and {knitr} should be excluded from README.Rmd when running these checks. README.Rmd should be excluded form the check. ✅

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions