precommit
precommit copied to clipboard
Style Quarto docs
As soon as the next styler release is cut and https://github.com/r-lib/styler/issues/913 goes live, add .qmd files to apply the style-files hook to.
You can already do this by overriding files and additional_dependencies: - r-lib/styler in your .pre-commit-config.yaml if you want.
What exactly does that files attribute have to be for this to work?
We are not bound by CRAN version of {styler} (because we user env to manage versions and styler is already pinned to a GitHub version), so we could already implement that now.
files just has to be a regex that matches quarto docs, see https://github.com/lorenzwalthert/precommit/blob/main/.pre-commit-hooks.yaml#L21
You're saying a .pre-commit-config.yaml that includes
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.3.2
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style]
additional_dependencies:
- r-lib/styler
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw|\.qmd)$'
exclude: 'renv/activate\.R'
should do the trick?
Yes, that should work. If the hook release v0.3.2 already includes a styler version that's large enough, you don't need the additional_dependencies.