Skip to content

Commit 06d6da6

Browse files
enable R as language
1 parent 783fd5c commit 06d6da6

38 files changed

+1284
-145
lines changed

.Rbuildignore

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
^_pkgdown\.yml$
1+
^README\.Rmd$
22
^.*\.Rproj$
3-
^\.github$
4-
^\.pre-commit-config\.yaml$
5-
^\.pre-commit-hooks\.yaml$
63
^\.Rproj\.user$
7-
^API$
4+
^LICENSE\.md$
5+
^\.pre-commit-hooks\.yaml$
6+
^\.travis\.yml$
87
^CONTRIBUTING\.md$
9-
^cran-comments\.md$
8+
^appveyor\.yml$
9+
^tic\.R$
10+
^_pkgdown\.yml$
1011
^docs$
11-
^inst/hooks/local$
12-
^inst/WORDLIST$
13-
^LICENSE\.md$
1412
^pkgdown$
15-
^README\.Rmd$
16-
^scratch$
13+
^\.pre-commit-config\.yaml$
14+
^API$
15+
^inst/consistent-release-tag$
16+
^inst/WORDLIST$
17+
^inst/hooks-config-to-inst$
18+
^cran-comments\.md$
19+
^\.github$

.github/workflows/R-CMD-check.yaml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ on:
88
push:
99
branches:
1010
- master
11-
- main
1211
pull_request:
1312
branches:
1413
- master
15-
- main
1614

1715
name: R-CMD-check
1816

@@ -36,6 +34,11 @@ jobs:
3634
# Linux
3735
- {os: ubuntu-18.04, r: 'release', installation_method: 'pip', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
3836
- {os: ubuntu-18.04, r: 'release', installation_method: 'conda', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
37+
# - {os: ubuntu-16.04, r: 'devel', installation_method: 'conda', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
38+
# - {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
39+
# - {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
40+
# - {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
41+
# - {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
3942

4043
env:
4144
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
@@ -46,12 +49,12 @@ jobs:
4649
steps:
4750
- uses: actions/checkout@v2
4851

49-
- uses: r-lib/actions/setup-r@v1
52+
- uses: r-lib/actions/setup-r@master
5053
with:
5154
r-version: ${{ matrix.config.r }}
5255
http-user-agent: ${{ matrix.config.http-user-agent }}
5356

54-
- uses: r-lib/actions/setup-pandoc@v1
57+
- uses: r-lib/actions/setup-pandoc@master
5558

5659
- name: Query dependencies
5760
run: |
@@ -60,20 +63,20 @@ jobs:
6063
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
6164
shell: Rscript {0}
6265

63-
- name: Restore R package cache
64-
uses: actions/cache@v2
66+
- name: Cache R packages
67+
if: runner.os != 'Windows'
68+
uses: actions/cache@v1
6569
with:
6670
path: ${{ env.R_LIBS_USER }}
6771
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
6872
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
69-
7073
- name: Install system dependencies (Linux)
7174
if: runner.os == 'Linux'
7275
run: |
7376
while read -r cmd
7477
do
7578
eval sudo $cmd
76-
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "18.04"))')
79+
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18.04"), sep = "\n")')
7780
7881
- name: Install system dependencies (brew)
7982
if: matrix.config.installation_method == 'brew'
@@ -108,7 +111,6 @@ jobs:
108111
env:
109112
_R_CHECK_CRAN_INCOMING_: false
110113
run: |
111-
options(crayon.enabled = TRUE)
112114
if (Sys.getenv("PRECOMMIT_INSTALLATION_METHOD") != 'conda') {
113115
Sys.setenv("_R_CHECK_FORCE_SUGGESTS_" = "False")
114116
}
@@ -127,8 +129,3 @@ jobs:
127129
with:
128130
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
129131
path: check
130-
131-
- name: Don't use tar from old Rtools to store the cache
132-
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }}
133-
shell: bash
134-
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.RData
2-
.Rhistory
31
.Rproj.user
2+
.Rhistory
3+
.RData
44
.Ruserdata
55
docs/
66
inst/doc

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
default_stages: ["commit"]
44
repos:
55
- repo: https://github.com/lorenzwalthert/precommit
6-
rev: v0.1.3.9014
6+
rev: v0.1.3
77
hooks:
88
- id: style-files
99
args: [--style_pkg=styler, --style_fun=tidyverse_style]
@@ -39,15 +39,15 @@ repos:
3939
(.*/|)WORDLIST|
4040
\.github/workflows/.*|
4141
data/.*|
42-
inst/hooks/.*|
42+
inst/bin/.*|
4343
inst/pre-commit-.*|
4444
)$
4545
- id: readme-rmd-rendered
4646
- id: parsable-R
4747
- id: no-browser-statement
4848
- id: deps-in-desc
4949
- repo: https://github.com/pre-commit/pre-commit-hooks
50-
rev: v4.0.1
50+
rev: v3.2.0
5151
hooks:
5252
- id: check-added-large-files
5353
- id: end-of-file-fixer
@@ -56,17 +56,17 @@ repos:
5656
hooks:
5757
- id: consistent-release-tag
5858
name: consistent-release-tag
59-
entry: inst/hooks/local/consistent-release-tag.R
59+
entry: inst/consistent-release-tag
6060
language: script
6161
stages: [commit, push]
6262
- id: hooks-config-to-inst
6363
name: hooks-config-to-inst
64-
entry: inst/hooks/local/hooks-config-to-inst.R
64+
entry: inst/hooks-config-to-inst
6565
language: script
6666
stages: [commit, push]
6767
- id: spell-check-exclude-to-config
6868
name: spell-check-exclude-to-config
69-
entry: inst/hooks/local/spell-check-exclude-to-config.R
69+
entry: inst/spell-check-exclude-to-config
7070
language: script
7171
stages: [commit, push]
7272
- id: forbid-to-commit
@@ -78,6 +78,6 @@ repos:
7878
- id: spell-check-ordered-exclude
7979
name: Ordered regex pattern for spell-check exclusion
8080
description: Ensure alphabetical order in `exclude:` key of spell check.
81-
entry: inst/hooks/local/spell-check-ordered-exclude.R
81+
entry: inst/spell-check-ordered-exclude.R
8282
language: script
8383
files: '^(.*/|)\.?pre-commit-config.*\.yaml$'

.pre-commit-hooks.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
- id: roxygenize
22
name: roxygenize
33
description: run roxygen2::roxygenize()
4-
entry: inst/hooks/exported/roxygenize.R
4+
entry: inst/bin/roxygenize
55
language: script
66
files: '^(R|man)/'
77
require_serial: true
88
minimum_pre_commit_version: "2.13.0"
99
- id: use-tidy-description
1010
name: use-tidy-description
1111
description: run usethis::use_tidy_description()
12-
entry: inst/hooks/exported/use-tidy-description.R
12+
entry: inst/bin/use-tidy-description
1313
language: script
1414
files: '^DESCRIPTION$'
1515
minimum_pre_commit_version: "2.13.0"
1616
- id: style-files
1717
name: style-files
1818
description: style files with styler
19-
entry: inst/hooks/exported/style-files.R
19+
entry: inst/bin/style-files
2020
language: script
21-
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw)$'
21+
files: '(\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw)$'
2222
exclude: 'renv/activate\.R'
2323
minimum_pre_commit_version: "2.13.0"
2424
- id: no-browser-statement
2525
name: no-browser-statement
2626
description: check if a .R file contains a `browser()` statement
27-
entry: inst/hooks/exported/no-browser-statement.R
27+
entry: inst/bin/no-browser-statement
2828
language: script
2929
files: '\.[rR]$'
3030
minimum_pre_commit_version: "2.13.0"
3131
- id: parsable-R
3232
name: parsable-R
3333
description: check if a .R file is parsable
34-
entry: inst/hooks/exported/parsable-R.R
34+
entry: inst/bin/parsable-R
3535
language: script
3636
files: '\.[rR]$'
3737
minimum_pre_commit_version: "2.13.0"
3838
- id: readme-rmd-rendered
3939
name: readme-rmd-rendered
4040
description: make sure README.Rmd hasn't been edited more recently than README.md
41-
entry: inst/hooks/exported/readme-rmd-rendered
41+
entry: inst/bin/readme-rmd-rendered
4242
language: script
4343
files: 'README\.[Rr]?md$'
4444
minimum_pre_commit_version: "2.13.0"
4545
- id: codemeta-description-updated
4646
name: codemeta-description-updated
4747
description: make sure codemeta.json is in sync with DESCRIPTION. It should be run after use-tidy-description.
48-
entry: inst/hooks/exported/codemeta-description-updated
48+
entry: inst/bin/codemeta-description-updated
4949
language: script
5050
files: '^DESCRIPTION$'
5151
minimum_pre_commit_version: "2.13.0"
5252
- id: spell-check
5353
name: spell-check
5454
description: perform a spell check with spelling::spell_check_files()
55-
entry: inst/hooks/exported/spell-check.R
55+
entry: inst/bin/spell-check
5656
language: script
5757
exclude: >
5858
(?x)^(
@@ -86,16 +86,16 @@
8686
- id: deps-in-desc
8787
name: deps-in-desc
8888
description: Check if dependencies that can be parsed from code are in DESCRIPTION.
89-
entry: inst/hooks/exported/deps-in-desc.R
89+
entry: inst/bin/deps-in-desc
9090
language: script
9191
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw)$'
9292
exclude: 'renv/activate\.R'
9393
minimum_pre_commit_version: "2.13.0"
9494
- id: lintr
9595
name: lintr
9696
description: check if a .R file is lint free (using lintr)
97-
entry: inst/hooks/exported/lintr.R
97+
entry: inst/bin/lintr
9898
language: script
99-
files: '(\.[rR]profile|\.R|\.Rmd|\.Rnw|\.r|\.rmd|\.rnw)$'
99+
files: '\.[rR]$'
100100
exclude: 'renv/activate\.R'
101101
minimum_pre_commit_version: "2.13.0"

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This repo uses the [tic](https://github.com/ropenscilabs/tic) package for CI.
88

99
To create a new hook, have a look at the [official
1010
documentation](https://pre-commit.com/#new-hooks) on creating new hooks, then have a look
11-
at existing hooks in this repo. The actual executables are defined in [`inst/hooks/`](https://github.com/lorenzwalthert/precommit/tree/master/inst/hooks). In
11+
at existing hooks in this repo. The actual executables are defined in [`inst/bin/`](https://github.com/lorenzwalthert/precommit/tree/master/inst/bin). In
1212
the script, you can expect the passed command line arguments to be all options,
1313
finally the files that should be processed with the hook.
1414

DESCRIPTION

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: precommit
22
Title: Pre-Commit Hooks
3-
Version: 0.1.3.9015
3+
Version: 0.1.3.9005
44
Author: Lorenz Walthert
55
Maintainer: Lorenz Walthert <[email protected]>
66
Description: Useful git hooks for R building on top of the multi-language
@@ -40,6 +40,8 @@ Suggests:
4040
testthat (>= 2.1.0)
4141
VignetteBuilder:
4242
knitr
43+
Remotes:
44+
r-lib/styler
4345
Encoding: UTF-8
4446
Roxygen: list(markdown = TRUE, roclets = c( "rd", "namespace", "collate",
4547
if (rlang::is_installed("pkgapi")) "pkgapi::api_roclet" else {

NEWS.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# precommit v0.1.3.9014 (Development)
1+
# precommit v0.1.3.9005 (Development)
22

33
This is a pre-release for `v0.2.0` and imposes a minimal version requirement
44
on the [pre-commit framework](https://pre-commit.com/) (`v2.13.0`). Please see
5-
*Installation/Update* below for how to satisfy it. This will ensure future
6-
releases of {precommit} building on the newly supported
5+
*Installation* below for how to satisfy it. This will ensure future releases of
6+
{precommit} building on the newly supported
77
[`language: r`](https://pre-commit.com/#r) will work out of the box instead of
88
issuing messages that are confusing for most end-users. We aspire the transition
99
to `language: r` due to the following benefits: No more manual dependency management
@@ -12,12 +12,11 @@ enable the easy use of continuous integration services (enforcing hooks and
1212
auto-fixing problems with pre-commit.ci, GitHub Actions).
1313

1414

15-
**Installation/Update**
15+
**Installation**
1616

17-
Please follow the
18-
[update instructions](https://lorenzwalthert.github.io/precommit/dev/#update) or
19-
[installation instructions](https://lorenzwalthert.github.io/precommit/dev/#installation)
20-
depending on whether or not you previously used pre-commit.
17+
Please follow the instructions in the [README](https://lorenzwalthert.github.io/precommit/dev/)
18+
if you are a new user of pre-commit or if you want to update a current
19+
installation.
2120

2221
**API changes**
2322

@@ -29,22 +28,19 @@ depending on whether or not you previously used pre-commit.
2928
`.pre-commit-config.yaml`. See the
3029
[docs](https://lorenzwalthert.github.io/precommit/articles/available-hooks.html#style-files-1)
3130
for details.
31+
- `style-files` and `roxygenize` hooks now warn if there is no permanent
32+
`{R.cache}` cache set up. You can silence the warning with the hook argument
33+
`--no-warn-cache` (#225).
3234

3335
**Minor changes**
3436

3537
- Warnings are no longer promoted to errors in the styler hook, which is
3638
particularly relevant for the apparently random error
3739
`Unknown or uninitialised column: text` (#268).
38-
- `style-files` and `roxygenize` hooks now warn if there is no permanent
39-
`{R.cache}` cache set up. You can silence the warning with the hook argument
40-
`--no-warn-cache` (#225).
4140
- `deps-in-desc` now checks `.Rprofile`, `.Rmd` and `.Rnw` files in addition to
4241
`.R` files (#216).
43-
- the lintr and styler hook now also check `.Rmd`, `.Rnw` and `.Rprofile` files
44-
(#286).
4542
- In order to avoid multiple installations of the pre-commit framework, a
46-
warning is issued if multiple are found so the user can remove them (#266,
47-
#273, #277, #278).
43+
warning is issued if multiple are found so the user can remove them (#266, #273).
4844
- The cache for the roxygen2 hook is now also invalidated for changes in formals
4945
if there are no changes in roxygen comments (#214).
5046
- `{renv}` infra files are not checked anymore by default in the template config
@@ -58,8 +54,6 @@ depending on whether or not you previously used pre-commit.
5854
- The `deps-in-desc` hook now points to the hook argument
5955
`--allow_private_imports` when the hook fails due to private imports (#254).
6056
- roxygenize hook is now fully tested (#267).
61-
- Hook scripts were relocated and R hooks now have a file extension (#280).
62-
- Updated GitHub Action workflows (#288).
6357

6458
# precommit v0.1.3
6559

R/cache.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ has_persistent_R.cache <- function() {
2222
#' @export
2323
may_require_permanent_cache <- function(temp_cache_is_enough = FALSE) {
2424
if (has_persistent_R.cache()) {
25-
cat("Using persistent cache at", R.cache::getCacheRootPath(), "\n")
25+
cat("Using persistant cache at", R.cache::getCacheRootPath(), "\n")
2626
} else {
2727
if (temp_cache_is_enough) {
2828
cat("Using temporary cache at", R.cache::getCacheRootPath(), "\n")

0 commit comments

Comments
 (0)