diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 4b69c4e0b46e..595ab9a933c5 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -56,7 +56,6 @@ jobs:
sudo apt update
sudo apt install -y -V \
pre-commit \
- r-base \
ruby-dev \
libuv1-dev
- name: Cache pre-commit
@@ -64,7 +63,6 @@ jobs:
with:
path: |
~/.cache/pre-commit
- ~/.local/share/renv/cache
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
run: |
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 8adc2275e5b5..3ac6897f99aa 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -188,21 +188,12 @@ repos:
?^python/pyarrow/util\.py$|
?^python/pyarrow/vendored/|
)
- - repo: local
+ - repo: https://github.com/etiennebacher/jarl-pre-commit
+ rev: "0.5.0"
hooks:
- - id: lintr
+ - id: jarl-check
alias: r
- name: R Lint
- language: r
- additional_dependencies:
- - cyclocomp
- - lintr
- - testthat
- entry: |
- Rscript -e "Sys.setenv(NOT_CRAN = 'TRUE'); lintr::expect_lint_free('r')"
- pass_filenames: false
- files: >-
- ^r/.*\.(R|Rmd)$
+ name: R Lint (jarl)
- repo: https://github.com/posit-dev/air-pre-commit
rev: 0.8.2
hooks:
diff --git a/docs/source/developers/guide/step_by_step/styling.rst b/docs/source/developers/guide/step_by_step/styling.rst
index 060fb7922c08..10b57bf48d56 100644
--- a/docs/source/developers/guide/step_by_step/styling.rst
+++ b/docs/source/developers/guide/step_by_step/styling.rst
@@ -38,12 +38,11 @@ linters and styling of the code.
For the R package you can use
`air `_ to format the code,
and
-
- ``{lintr}``
+ `jarl `_
to check if the code follows the
`tidyverse style `_.
- The instructions on how to use `air` and ``{lintr}``
+ The instructions on how to use `air` and `jarl`
can be found in the
`Styling and Linting section of the Common developer workflow tasks `_.
diff --git a/r/jarl.toml b/r/jarl.toml
new file mode 100644
index 000000000000..585c05fcd61e
--- /dev/null
+++ b/r/jarl.toml
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+[lint]
+# exclude below files as all are generated or used for generating other files
+exclude = ["R/arrowExports.R", "R/dplyr-funcs-doc.R", "data-raw/codegen.R"]
+
+# TODO: these rules currently fire on existing code; re-enable incrementally
+# after triaging/fixing the findings (see GH-46646).
+ignore = [
+ "any_is_na",
+ "comparison_negation",
+ "download_file",
+ "duplicated_arguments",
+ "equals_null",
+ "implicit_assignment",
+ "internal_function",
+ "numeric_leading_zero",
+ "outer_negation",
+ "redundant_equals",
+ "redundant_ifelse",
+ "repeat",
+ "seq",
+ "sprintf",
+ "unused_function",
+]
diff --git a/r/vignettes/developers/workflow.Rmd b/r/vignettes/developers/workflow.Rmd
index 467cedc7004c..c980f56107be 100644
--- a/r/vignettes/developers/workflow.Rmd
+++ b/r/vignettes/developers/workflow.Rmd
@@ -13,17 +13,18 @@ knitr::opts_chunk$set(error = TRUE, eval = FALSE)
The Arrow R package uses several additional development tools:
* [`air`](https://posit-dev.github.io/air/) for code styling
-* [`lintr`](https://github.com/r-lib/lintr) for code analysis
+* [`jarl`](https://etiennebacher.github.io/jarl/) for code analysis
* [`pkgdown`](https://pkgdown.r-lib.org) for building the website
* [`roxygen2`](https://roxygen2.r-lib.org) for documenting the package
- the R documentation uses the [`@examplesIf`](https://roxygen2.r-lib.org/articles/rd.html#functions) tag introduced in `roxygen2` version 7.1.2
-Instructions for installing `air` can be found at .
+Instructions for installing `air` can be found at ,
+and instructions for installing `jarl` can be found at .
You can install all the other additional dependencies by running:
```r
-install.packages(c("lintr", "pkgdown", "roxygen2"))
+install.packages(c("pkgdown", "roxygen2"))
```
@@ -68,7 +69,7 @@ The R code in the package follows [the tidyverse style](https://style.tidyverse.
You can automatically change the formatting of the code in the package using the [air](https://posit-dev.github.io/air/cli.html) formatter.
-The `air` formatter will fix many styling errors, thought not all lintr errors are automatically fixable with `air`. The list of files we intentionally do not style is in the `exclude` field in `r/air.toml`.
+The `air` formatter will fix many styling errors, though not all `jarl` errors are automatically fixable with `air`. The list of files we intentionally do not style is in the `exclude` field in `r/air.toml`.
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, from the `arrow/r` directory of the repository.
@@ -78,13 +79,13 @@ From the command line, run `air`:
air format
```
-In R, run `lintr`:
+From the command line, run `jarl`:
-```r
-lintr::lint_package()
+```
+jarl check .
```
-Note: To run lintr, we require the `cyclocomp` package to be installed first.
+Some `jarl` findings can be fixed automatically with `jarl check --fix .`.
### C++ code