forked from lorenzwalthert/precommit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
168 lines (166 loc) · 4.85 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# All available hooks: https://pre-commit.com/hooks.html
# R specific hooks: https://github.com/lorenzwalthert/precommit
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.3.2.9021
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style, --cache-root=styler-perm]
exclude: >
(?x)^(
tests/testthat/in/.*|
renv/.*
)$
- id: roxygenize
additional_dependencies:
- cli
- fs
- here
- magrittr
- purrr
- R.cache
- rlang
- rprojroot
- rstudioapi
- withr
- yaml
- r-lib/pkgapi
# codemeta must be above use-tidy-description when both are used
# - id: codemeta-description-updated
- id: use-tidy-description
- id: spell-check
exclude: >
(?x)^(
.*\.[rR]|
.*\.feather|
.*\.jpeg|
.*\.pdf|
.*\.png|
.*\.py|
.*\.RData|
.*\.rds|
.*\.Rds|
.*\.Rproj|
.*\.sh|
(.*/|)\.gitignore|
(.*/|)\.pre-commit-.*|
(.*/|)\.Rbuildignore|
(.*/|)\.Renviron|
(.*/|)\.Rprofile|
(.*/|)\.travis\.yml|
(.*/|)appveyor\.yml|
(.*/|)NAMESPACE|
(.*/|)renv/settings\.dcf|
(.*/|)renv\.lock|
(.*/|)WORDLIST|
\.github/workflows/.*|
data/.*|
inst/hooks/.*|
inst/pre-commit-.*|
inst/usethis-legacy-hook|
LICENSE|
renv/.*|
tests/testthat/in/.*|
)$
- id: readme-rmd-rendered
- id: parsable-R
exclude: >
(?x)^(
tests/testthat/in/.*|
)$
- id: no-browser-statement
exclude: >
(?x)^(
tests/testthat/in/.*|
)$
- id: no-debug-statement
exclude: >
(?x)^(
tests/testthat/in/.*|
)$
- id: deps-in-desc
exclude: >
(?x)^(
inst/hooks/exported/pkgdown.R|
tests/testthat/in/.*|
inst/renv-update\.R|
inst/update-dependency-graph-existing-packages\.R|
inst/update-existing-hook-dependencies\.R|
renv/activate.R|
vignettes/FAQ\.Rmd|
)$
- id: pkgdown
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: end-of-file-fixer
exclude: '\.Rd' # sometimes roxygen fails to generate EOF blank line.
- id: file-contents-sorter
files: '^\.Rbuildignore$'
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
rev: v1.6.1
hooks:
# Only required when https://pre-commit.ci is used for config validation
- id: check-pre-commit-ci-config
- repo: https://github.com/lorenzwalthert/gitignore-tidy
rev: 475bf5d96927a1887ce2863ff3075b1d7240bc51
hooks:
- id: tidy-gitignore
- repo: local
hooks:
- id: consistent-release-tag
name: consistent-release-tag
entry: Rscript inst/hooks/local/consistent-release-tag.R
language: r
additional_dependencies:
- docopt
- fs
- yaml
- purrr
- glue
- rlang
- git2r
- desc
stages: [commit, push]
- id: hooks-config-to-inst
name: hooks-config-to-inst
entry: Rscript inst/hooks/local/hooks-config-to-inst.R
language: r
stages: [commit, push]
additional_dependencies:
- fs
require_serial: True
- id: spell-check-exclude-identical
name: spell-check-exclude-identical
entry: Rscript inst/hooks/local/spell-check-exclude-identical.R
language: r
stages: [commit, push]
additional_dependencies:
- magrittr
- purrr
- yaml
- here
- rlang
require_serial: True
- id: forbid-to-commit
name: Don't commit common R artifacts
entry: Cannot commit .Rhistory, .Rdata, .csv and similar.
language: fail
files: '\.(Rhistory|csv|RData|Rds|rds)$'
# `exclude: <regex>` to allow committing specific files.
- id: spell-check-ordered-exclude
name: Ordered regex pattern for spell-check exclusion
description: Ensure alphabetical order in `exclude:` key of spell check.
entry: Rscript inst/hooks/local/spell-check-ordered-exclude.R
language: r
files: '^(.*/|)\.?pre-commit-config.*\.yaml$'
additional_dependencies:
- magrittr
- yaml
- purrr
- rlang
default_stages: ["commit"]
ci:
skip: [consistent-release-tag, spell-check-ordered-exclude, pkgdown]
autoupdate_schedule: monthly