File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 129129 minimum_pre_commit_version : 0.15.0
130130 description : ' Run lintr against R code'
131131
132+ - id : r-readme
133+ name : ' Generated README.Rmd'
134+ entry : run-r-readme.sh
135+ language : ' script'
136+ files : README\.Rmd$
137+ pass_filenames : false
138+ minimum_pre_commit_version : 0.15.0
139+ description : ' Check README.md in-sync with README.Rmd'
140+
132141- id : buf-lint
133142 name : ' Lint protobuf files'
134143 entry : buf-lint.sh
Original file line number Diff line number Diff line change 1919* ` rust-doc ` : runs ` cargo doc ` against the workspace - great for linting [ intra-doc links]
2020* ` r-stylr ` : runs [ ` stylr ` ] to format R code
2121* ` r-lintr ` : static analysis of R code with [ ` lintr ` ]
22+ * ` r-readme ` : ensure README.Rmd changes are rendered to README.md
2223* ` buf-lint ` : runs [ ` buf ` ] lints against protobuf files
2324* ` buf-breaking ` : protobuf breaking change detection using [ ` buf ` ]
2425
8788
8889 - id : r-lintr
8990 stages : [commit, push]
91+
92+ - id : r-readme
9093 stages : [commit, push]
9194
9295 - id : buf-lint
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ README=($( git diff --cached --name-only | grep -Ei ' ^README\.[R]?md$' ) )
6+
7+ if [[ ${# README[@]} == 0 ]]; then
8+ exit 0
9+ fi
10+
11+ if [[ README.Rmd -nt README.md ]]; then
12+ echo -e " README.md is out of date; please re-knit README.Rmd"
13+ exit 1
14+ elif [[ ${# README[@]} -lt 2 ]]; then
15+ echo -e " README.Rmd and README.md should be both staged"
16+ exit 1
17+ fi
You can’t perform that action at this time.
0 commit comments