forked from r-lib/styler
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.pre-commit-config.yaml
114 lines (113 loc) · 3.68 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
# All available hooks: https://pre-commit.com/hooks.html
# R specific hooks: https://github.com/lorenzwalthert/precommit
default_stages: [commit]
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.2.2.9006
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style]
exclude: >
(?x)^(
tests/testthat/.*/.*\.R(md|nw)?|
vignettes/customizing_styler\.Rmd|
tests/testthat/public-api/xyzfile-rnw/random4\.Rnw|
vignettes/detect-alignment\.Rmd|
tests/testmanual/addins/.*invalid.*|
tests/testmanual/addins/r-valid\.R|
)$
- id: roxygenize
additional_dependencies:
- r-lib/pkgapi
- id: use-tidy-description
- id: spell-check
exclude: >
(?x)^(
\.github/.*\.yaml|
data/.*|
tests/testthat/.*|
touchstone/config\.json|
(.*/|)\.Rprofile|
(.*/|)\.Renviron|
(.*/|)\.gitignore|
(.*/|)NAMESPACE|
(.*/|)WORDLIST|
(.*/|)\.travis.yml|
(.*/|)appveyor.yml|
(.*/|)\.Rbuildignore|
(.*/|)\.pre-commit-.*|
.*\.[rR]|
.*\.Rproj|
.*\.py|
.*\.feather|
.*\.rds|
.*\.Rds|
.*\.sh|
.*\.RData|
.*-in_tree
)$
- id: readme-rmd-rendered
- id: parsable-R
exclude: >
(?x)^(
tests/testthat/public-api/xyzaddin/addin_region-.*|
tests/.*invalid.*|
tests/testthat/rmd/no-tidy-out\.Rmd|
tests/testthat/escaping/basic-escape-out\.R|
tests/testthat/indention_operators/.*pipe.*|
tests/testthat/line_breaks_and_other/.*pipe.*|
tests/testthat/exception_handling/parser-error.R|
)$
- id: no-browser-statement
exclude: >
(?x)^(
tests/testthat/public-api/xyzaddin/addin_region-.*|
tests/testmanual/addins/r-invalid\.R|
tests/testthat/escaping/basic-escape-out\.R|
tests/testthat/indention_operators/.*pipe.*|
tests/testthat/line_breaks_and_other/.*pipe.*|
tests/testthat/exception_handling/parser-error.R|
)$
- id: deps-in-desc
exclude: >
(?x)^(
touchstone/.*|
tests/testmanual/addins/.*invalid.*|
tests/testthat/escaping/basic-escape-out\.R|
tests/testthat/rnw/011-conditional-eval-out\.Rnw|
tests/testthat/.*\.R(md)?
)$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
args: ['--maxkb=200']
- id: file-contents-sorter
files: "\\.Rbuildignore$"
- id: end-of-file-fixer
exclude: >
(?x)^(
\.Rd|
tests/testthat/exception_handling/empty_file\.R|
tests/testthat/parse_comments/eol_eof_spaces-.*|
tests/testthat/reference-objects/.*|
)$
- repo: https://github.com/lorenzwalthert/gitignore-tidy
rev: b3eaceb0bf2df137cc80f85b3943b6684f204c48
hooks:
- id: tidy-gitignore
- repo: local
hooks:
- id: forbid-to-commit
name: Don't commit common R artifacts
entry: Cannot commit .Rhistory, .RData, .Rds or .rds.
language: fail
files: '\.Rhistory|\.RData|\.Rds|\.rds$'
# `exclude: <regex>` to allow committing specific files.
- id: require-news-on-push
name: Require bullet in NEWS.md
description: NEWS.md must be updated with every PR.
entry: inst/hooks/require-news-update.R
stages: [push]
language: script
always_run: true