Closed olivroy closed 11 months ago
Ok I see. I agree these should probably not be styled by default. A simple way to do that would be to make exclude_files
take regex patterns instead of file names. We could adapt the default value such that the behavior is the same as now. Are you interested in making a PR? I can provide guidance.
Hi, I am not sure I have a lot of time.
I don't mind opening a preliminary version. but first thoughts
Here is my initial work
https://github.com/olivroy/styler/commit/e24dc6812316ba0cb7506a4978ac0f27a163571f
I don't mind opening a PR, but I will not have time to review / readjust it in the coming days.
Hi,
I think that standalone files from core tidyverse packages should be ignored from styling. At the moment, the default values for
exclude_files
isc("R/RcppExports.R", "R/cpp11.R")
, but I think it could bec("R/RcppExports.R", "R/cpp11.R", "R/import-standalone-*")
or a new argument
exclude_import_standalone
that would default toTRUE
.If you are not familiar with the new standalone files, here are some references
https://usethis.r-lib.org/reference/use_standalone.html
https://github.com/r-lib/rlang/blob/main/R/standalone-types-check.R
A PR in dplyr where they use it tidyverse/dplyr#6722. They also use it in ggplot2
In a package, if I use
I think that because these files appear as read-only in RStudio. If they are to be styled, they should be styled in the original repos (in this case in rlang)