Skip to content
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

Update codemeta.json if codemeta-description-updated fails #491

Closed
ns-rse opened this issue Jul 18, 2023 · 2 comments
Closed

Update codemeta.json if codemeta-description-updated fails #491

ns-rse opened this issue Jul 18, 2023 · 2 comments

Comments

@ns-rse
Copy link

ns-rse commented Jul 18, 2023

Is your feature request related to a problem? Please describe.

I find I regularly forget to update codemeta.json when tweaking the DESCRIPTION. The error message advises to run codemetar::write_codemeta() to update the file.

Describe the solution you'd like

Other hooks such as lintr and styler modify files and it would be neat if this update could be performed automatically if it fails.

Probably over-simplifying it but perhaps Line 31 of inst/hooks/exported/codemeta-description-updated.R could be replaced with

codemetar::write_codemeta()

But I think the codemetar package would have to be added to the DESCRIPTION too, possibly under the suggests section (not too hot on my R packaging, but learning slowly!).

Describe alternatives you've considered

Improving my memory to always run codemetar::write_codemeta() after touching the DESCRIPTION.

Additional context

Example of failure...

codemeta-description-updated.............................................Failed
- hook id: codemeta-description-updated
- exit code: 1

ℹ Using R 4.3.1 (lockfile was generated with R 4.2.1)
ℹ Using R 4.3.1 (lockfile was generated with R 4.2.1)
Error:
! codemeta.json is out of date; please re-run codemetar::write_codemeta().
Backtrace:
    ▆
 1. └─rlang::abort("codemeta.json is out of date; please re-run codemetar::write_codemeta().")
Execution halted
@lorenzwalthert
Copy link
Owner

The reason why we don't run automatically is 1) {codemetar} has a huge amount of dependencies that you needed to install in your pre-commit renv, and people who don't want to use this hook, but other hooks from the repo have to do that too. 2) it's slow. Similar to #494, I think a new hook that uses the system language would solve the problem.

@lorenzwalthert
Copy link
Owner

An alternative is that you go talk to the maintainers of {codemeta} so they can implement the hook on their side. That would resulte in a new virtual env created only for this hook and not interact with my repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants