Skip to content

rstudioapi dependency not installed by roxygenize hook #609

Closed
@grst

Description

@grst

Before filing a bug

  • I have installed the latest dev version of {precommit} with remotes::install_github('lorenzwalthert/precommit')
  • I have installed the latest hook revisions (update with precommit::autoupdate())
  • I have installed the latest release of the upstream Python framework pre-comit as described under the update instructions.

Describe the bug

I have a package that depends on rstudioapi and declares so in its DESCRIPTION

Imports:
    yaml,
    glue,
    here,
    stringr,
    methods,
    rlang,
    rstudioapi (>= 0.11)

The package uses the roxygenize hook:

repos:
  - repo: https://github.com/lorenzwalthert/precommit
    rev: v0.4.3.9003
    hooks:
      - id: roxygenize

When running

pre-commit run --all-files

it fails with

roxygenize...............................................................Failed
- hook id: roxygenize
- exit code: 1

- The project is out-of-sync -- use `renv::status()` for details.
- The project is out-of-sync -- use `renv::status()` for details.
ℹ Loading dso
Error in `precommit::roxygenize_with_cache()`:
! The package "rstudioapi" (>= 0.11) is required.
Backtrace:
    ▆
 1. └─precommit::roxygenize_with_cache(key = wd, dirs = path_relative_cache)
 2.   └─rlang::abort(conditionMessage(out)) at repocskrdn2t/R/roxygen2.R:103:5
Execution halted

Expected behavior
All declared dependencies are automatically installed

Additional context

  • My operating system is: Rocky 9.4
  • [ ] My project uses {renv}.
  • [ ] the output of packageVersion('renv')

I was wondering if this is the same as #589, but it #589 already fails on installing the hook, whereas in my case it only fails open executing the hook. I also tried the pre-commit version from the branch you mention in that issue and it didn't help.

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