Skip to content

Commit f0e0a45

Browse files
Merge pull request #644 from lorenzwalthert/document-precommit
- Document how to use precommit (#644).
2 parents 9792a83 + 413d6f3 commit f0e0a45

File tree

5 files changed

+109
-13
lines changed

5 files changed

+109
-13
lines changed

.pre-commit-config.yaml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,51 @@
22
# R specific hooks: https://github.com/lorenzwalthert/precommit
33
repos:
44
- repo: https://github.com/lorenzwalthert/precommit
5-
rev: v0.0.0.9040
5+
rev: v0.1.0
66
hooks:
7-
- id: parsable-R
8-
- id: no-browser-statement
9-
# - id: lintr
10-
- id: readme-rmd-rendered
11-
- id: spell-check
127
- id: style-files
138
args: [--style_pkg=styler, --style_fun=tidyverse_style]
149
exclude: 'tests/testthat/.*/*\.R'
10+
- id: roxygenize
11+
- id: use-tidy-description
12+
- id: spell-check
13+
exclude: >
14+
(?x)^(
15+
data/.*|
16+
(.*/|)\.Rprofile|
17+
(.*/|)\.Renviron|
18+
(.*/|)\.gitignore|
19+
(.*/|)NAMESPACE|
20+
(.*/|)WORDLIST|
21+
(.*/|)\.travis.yml|
22+
(.*/|)appveyor.yml|
23+
(.*/|)\.Rbuildignore|
24+
(.*/|)\.pre-commit-.*|
25+
.*\.[rR]|
26+
.*\.Rproj|
27+
.*\.py|
28+
.*\.feather|
29+
.*\.rds|
30+
.*\.Rds|
31+
.*\.sh|
32+
.*\.RData
33+
)$
34+
- id: readme-rmd-rendered
35+
- id: parsable-R
36+
- id: no-browser-statement
37+
- id: deps-in-desc
1538
- repo: https://github.com/pre-commit/pre-commit-hooks
1639
rev: v2.5.0
1740
hooks:
1841
- id: check-added-large-files
1942
args: ['--maxkb=200']
2043
- id: end-of-file-fixer
2144
exclude: '\.Rd'
45+
- repo: local
46+
hooks:
47+
- id: forbid-to-commit
48+
name: Don't commit common R artifacts
49+
entry: Cannot commit .Rhistory, .RData, .Rds or .rds.
50+
language: fail
51+
files: '\.Rhistory|\.RData|\.Rds|\.rds$'
52+
# `exclude: <regex>` to allow committing specific files.

CONTRIBUTING.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ This project follows the contributing recommendations outlined by [saamwerk](htt
44
In particular, issues labelled with `Status: Postponed` are closed even if they
55
are not resolved.
66

7+
## Contributing code
8+
9+
* Only open a PR when your idea was approved of by a contributor in an issue.
10+
* Add a bullet to NEWS.md referencing the PR, also following the guide lines in
11+
[tidyverse style guide](http://style.tidyverse.org), as for your code
12+
contributions.
13+
* Make sure your commit pass the pre-commit hooks in this repo. See the
14+
`{precommit}` [README.md](https://github.com/lorenzwalthert/precommit)
15+
on how to install the pre-commit framework and the R package on your system and
16+
then run `precommit::use_precommit()` to make sure the hooks are activated
17+
in your local styler clone. If you skip a hook, describe why in the PR.
18+
19+
720
## How to dive in and understanding the source code
821

922
Read the vignettes. If you are done, come back here.
@@ -191,10 +204,3 @@ used to track failed tests.
191204
The files are placed in `tests/testthat` under the category they fit.
192205
Please have a look at the documentation for `test_collection()` and see other
193206
unit tests. Let me know if there is anything unclear about this.
194-
195-
## Contributing code
196-
197-
* Only open a PR when your idea was approved of by a contributor in an issue.
198-
* Add a bullet to NEWS.md referencing the PR, also following the guide lines in
199-
[tidyverse style guide](http://style.tidyverse.org), as for your code
200-
contributions.

README.Rmd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,15 @@ styler functionality is made available through other tools, most notably
174174
or the [pkgdown](https://r-lib.github.io/styler/) page contain information
175175
related to the initial development phase during Google Summer of Code 2017.
176176

177+
## Contributing
178+
179+
Please have a look at `CONTRIBUTING.md`, in particular, make sure to use the
180+
pre-commit hooks and if you skip a hook, describe why in the PR.
181+
See the `{precommit}` [README.md](https://github.com/lorenzwalthert/precommit)
182+
on how to install the pre-commit framework and the R package on your system and
183+
then run
184+
```{r, eval = FALSE}
185+
precommit::use_precommit()
186+
```
187+
188+
to make sure the hooks are activated in your local styler clone.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,18 @@ styler functionality is made available through other tools, most notably
170170
or the [pkgdown](https://r-lib.github.io/styler/) page contain
171171
information related to the initial development phase during Google
172172
Summer of Code 2017.
173+
174+
## Contributing
175+
176+
Please have a look at `CONTRIBUTING.md`, in particular, make sure to use
177+
the pre-commit hooks and if you skip a hook, describe why in the PR. See
178+
the `{precommit}`
179+
[README.md](https://github.com/lorenzwalthert/precommit) on how to
180+
install the pre-commit framework and the R package on your system and
181+
then run
182+
183+
``` r
184+
precommit::use_precommit()
185+
```
186+
187+
to make sure the hooks are activated in your local styler clone.

inst/WORDLIST

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,25 @@ AppVeyor
66
apriori
77
arg
88
AST
9+
backport
910
benchmarking
1011
cancelling
1112
chnages
1213
CMD
1314
codecov
15+
compat
1416
config
1517
CONST
18+
coventions
1619
cran
1720
dec
21+
devtools
1822
dir
1923
dont
2024
dontrun
2125
dontshowdontrun
2226
donttest
27+
dplyr
2328
DSLs
2429
emacs
2530
emph
@@ -34,36 +39,53 @@ filetype
3439
forcond
3540
funct
3641
getOption
42+
github
43+
gitsum
44+
GSOC
3745
http
3846
https
3947
infinitively
48+
initializer
4049
innode
50+
interaces
4151
invasiveness
4252
io
4353
ixmypi
54+
Kirill
4455
knitr
56+
labelled
4557
levelName
4658
LF
4759
lifecycle
4860
lorenzwalthert
4961
macOS
62+
md
63+
Müller
64+
mutli
5065
NUM
66+
ourself
5167
packrat
5268
parsable
69+
parsesum
5370
pgkdown
5471
pkgdown
5572
pos
5673
pre
5774
precommit
75+
prefill
5876
prettycode
77+
PRs
5978
RcppExports
6079
rds
6180
readme
6281
README
6382
rebased
83+
reindent
6484
reindented
6585
reindention
86+
relevel
6687
renv
88+
repo
6789
reprex
6890
rlang
6991
rmarkdown
@@ -72,36 +94,46 @@ rmd
7294
Rmd
7395
rnw
7496
Rnw
97+
roxgen
7598
roxygen
7699
Roxygen
77100
rplumber
78101
rprofile
79102
Rprofile
80103
rstudio
104+
RStudio
105+
RStudio's
106+
saamwerk
81107
seealso
82108
StackOverflow
83109
STR
84110
styler
85111
stylerignore
86112
stylerignored
87113
stylers
114+
summarises
88115
tempfile
89116
testthat
90117
tibble
91118
tibbles
92119
tidyeval
120+
tidyr
93121
tidyverse
94122
Tidyverse
95123
ui
96124
uncached
97125
unexplainable
98126
unindent
127+
unindention
99128
unlink
100129
unlinkunindention
101130
unnest
102131
unstyled
103132
utf
104133
Visit'em
134+
Walthert
105135
xfun
136+
Xie
106137
xyzpackage
107138
yihui
139+
zzz

0 commit comments

Comments
 (0)