amoeba commented on code in PR #46686: URL: https://github.com/apache/arrow/pull/46686#discussion_r2138113390
########## r/vignettes/developers/workflow.Rmd: ########## @@ -51,31 +51,19 @@ pkgdown::build_site(preview=TRUE) ## Styling and linting -### R code - -The R code in the package follows [the tidyverse style](https://style.tidyverse.org/). On PR submission (and on pushes) our CI will run linting and will flag possible errors on the pull request with annotations. +You can automatically adjust our styling and lint by [pre-commit](https://pre-commit.com/): -To run the linter locally, install the `{lintr}` package (note, we currently use a fork that includes fixes not yet accepted upstream, see how lintr is being installed in the file [`ci/docker/linux-apt-lint.dockerfile`](https://github.com/apache/arrow/blob/main/ci/docker/linux-apt-lint.dockerfile) for the current status) and then run - -```r -lintr::lint_package("arrow/r") +```bash +pre-commit run --show-diff-on-failure --color=always --all-files r ``` -You can automatically change the formatting of the code in the package using the [styler](https://styler.r-lib.org/) package. - -Run the styler locally either via Makefile commands: +See also the following subsections our styling and lint details for R and C++ codes. -```bash -make style # (for only the files changed) -make style-all # (for all files) -``` +### R code -or in R: +The R code in the package follows [the tidyverse style](https://style.tidyverse.org/). On PR submission (and on pushes) our CI will run linting and will flag possible errors on the pull request with annotations. -```r -# note the file that should not be styled -styler::style_pkg(exclude_files = c("data-raw/codegen.R")) -``` +You can automatically change the formatting of the code in the package using the [styler](https://styler.r-lib.org/) package. The styler package will fix many styling errors, thought not all lintr errors are automatically fixable with styler. The list of files we intentionally do not style is in `r/.styler_excludes.R`. Review Comment: ````suggestion The styler package will fix many styling errors, thought not all lintr errors are automatically fixable with styler. The list of files we intentionally do not style is in `r/.styler_excludes.R`. Linting and styling with [pre-commit](https://pre-commit.com/) as described above is the best way to ensure your changes are being checked properly but you can also run the tools individually if you prefer: ```r lintr::lint_package() # for linting styler::style_pkg() # for styling ``` Note: To run lintr, we require the `cyclocomp` package to be installed first. ```` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org