Skip to content

Commit ffb10a1

Browse files
Merge pull request #317 from bart1/main
- Common config files that should not be spell checked (#317).
2 parents e9d3637 + c25870a commit ffb10a1

File tree

5 files changed

+24
-32
lines changed

5 files changed

+24
-32
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ repos:
134134
- fs
135135
- id: spell-check-exclude-to-config
136136
name: spell-check-exclude-to-config
137-
entry: Rscript inst/hooks/local/spell-check-exclude-to-config.R
137+
entry: Rscript inst/hooks/local/spell-check-exclude-identical.R
138138
language: r
139139
stages: [commit, push]
140140
additional_dependencies:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env Rscript
2+
library(magrittr)
3+
read_config <- function(path) {
4+
yaml::read_yaml(path) %>%
5+
purrr::pluck("repos") %>%
6+
purrr::keep(~ .x$repo == "https://github.com/lorenzwalthert/precommit") %>%
7+
purrr::pluck(1, "hooks") %>%
8+
purrr::keep(~ .x$id == "spell-check") %>%
9+
purrr::pluck(1, "exclude")
10+
}
11+
hooks_pkg <- read_config(here::here("inst/pre-commit-config-pkg.yaml"))
12+
hooks_proj <- read_config(here::here("inst/pre-commit-config-proj.yaml"))
13+
if (!identical(hooks_proj, hooks_pkg)) {
14+
rlang::abort(paste0(
15+
"The `exclude` key from the spell-check hook should be the same for all templates in `inst/`."
16+
))
17+
}

inst/hooks/local/spell-check-exclude-to-config.R

Lines changed: 0 additions & 29 deletions
This file was deleted.

inst/pre-commit-config-pkg.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ repos:
2525
.*\.Rproj|
2626
.*\.sh|
2727
(.*/|)\.gitignore|
28+
(.*/|)\.gitlab-ci\.yml|
29+
(.*/|)\.lintr|
2830
(.*/|)\.pre-commit-.*|
2931
(.*/|)\.Rbuildignore|
3032
(.*/|)\.Renviron|
@@ -57,4 +59,4 @@ repos:
5759
entry: Cannot commit .Rhistory, .RData, .Rds or .rds.
5860
language: fail
5961
files: '\.Rhistory|\.RData|\.Rds|\.rds$'
60-
# `exclude: <regex>` to allow committing specific files.
62+
# `exclude: <regex>` to allow committing specific files

inst/pre-commit-config-proj.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ repos:
2121
.*\.Rproj|
2222
.*\.sh|
2323
(.*/|)\.gitignore|
24+
(.*/|)\.gitlab-ci\.yml|
25+
(.*/|)\.lintr|
2426
(.*/|)\.pre-commit-.*|
2527
(.*/|)\.Rbuildignore|
2628
(.*/|)\.Renviron|
@@ -52,4 +54,4 @@ repos:
5254
entry: Cannot commit .Rhistory, .RData, .Rds or .rds.
5355
language: fail
5456
files: '\.Rhistory|\.RData|\.Rds|\.rds$'
55-
# `exclude: <regex>` to allow committing specific files.
57+
# `exclude: <regex>` to allow committing specific files

0 commit comments

Comments
 (0)