summaryrefslogtreecommitdiffstats
path: root/testing/resources
diff options
context:
space:
mode:
Diffstat (limited to 'testing/resources')
-rw-r--r--testing/resources/golang_hooks_repo/go.mod1
-rw-r--r--testing/resources/r_hooks_repo/.pre-commit-hooks.yaml48
-rw-r--r--testing/resources/r_hooks_repo/DESCRIPTION19
-rwxr-xr-xtesting/resources/r_hooks_repo/additional-deps.R2
-rwxr-xr-xtesting/resources/r_hooks_repo/hello-world.R5
-rw-r--r--testing/resources/r_hooks_repo/renv.lock27
6 files changed, 102 insertions, 0 deletions
diff --git a/testing/resources/golang_hooks_repo/go.mod b/testing/resources/golang_hooks_repo/go.mod
new file mode 100644
index 0000000..523bfc9
--- /dev/null
+++ b/testing/resources/golang_hooks_repo/go.mod
@@ -0,0 +1 @@
+module golang-hello-world
diff --git a/testing/resources/r_hooks_repo/.pre-commit-hooks.yaml b/testing/resources/r_hooks_repo/.pre-commit-hooks.yaml
new file mode 100644
index 0000000..b3545d9
--- /dev/null
+++ b/testing/resources/r_hooks_repo/.pre-commit-hooks.yaml
@@ -0,0 +1,48 @@
+# parsing file
+- id: parse-file-no-opts-no-args
+ name: Say hi
+ entry: Rscript parse-file-no-opts-no-args.R
+ language: r
+ types: [r]
+- id: parse-file-no-opts-args
+ name: Say hi
+ entry: Rscript parse-file-no-opts-args.R
+ args: [--no-cache]
+ language: r
+ types: [r]
+## parsing expr
+- id: parse-expr-no-opts-no-args-1
+ name: Say hi
+ entry: Rscript -e '1+1'
+ language: r
+ types: [r]
+- id: parse-expr-args-in-entry-2
+ name: Say hi
+ entry: Rscript -e '1+1' -e '3' --no-cache3
+ language: r
+ types: [r]
+# real world
+- id: hello-world
+ name: Say hi
+ entry: Rscript hello-world.R
+ args: [blibla]
+ language: r
+ types: [r]
+- id: hello-world-inline
+ name: Say hi
+ entry: |
+ Rscript -e
+ 'stopifnot(
+ packageVersion("rprojroot") == "1.0",
+ packageVersion("gli.clu") == "0.0.0.9000"
+ )
+ cat(commandArgs(trailingOnly = TRUE), "from R!\n", sep = ", ")
+ '
+ args: ['Hi-there']
+ language: r
+ types: [r]
+- id: additional-deps
+ name: Check additional deps
+ entry: Rscript additional-deps.R
+ language: r
+ types: [r]
diff --git a/testing/resources/r_hooks_repo/DESCRIPTION b/testing/resources/r_hooks_repo/DESCRIPTION
new file mode 100644
index 0000000..0e597a8
--- /dev/null
+++ b/testing/resources/r_hooks_repo/DESCRIPTION
@@ -0,0 +1,19 @@
+Package: gli.clu
+Title: What the Package Does (One Line, Title Case)
+Type: Package
+Version: 0.0.0.9000
+Authors@R:
+ person(given = "First",
+ family = "Last",
+ role = c("aut", "cre"),
+ email = "first.last@example.com",
+ comment = c(ORCID = "YOUR-ORCID-ID"))
+Description: What the package does (one paragraph).
+License: `use_mit_license()`, `use_gpl3_license()` or friends to
+ pick a license
+Encoding: UTF-8
+LazyData: true
+Roxygen: list(markdown = TRUE)
+RoxygenNote: 7.1.1
+Imports:
+ rprojroot
diff --git a/testing/resources/r_hooks_repo/additional-deps.R b/testing/resources/r_hooks_repo/additional-deps.R
new file mode 100755
index 0000000..bc14595
--- /dev/null
+++ b/testing/resources/r_hooks_repo/additional-deps.R
@@ -0,0 +1,2 @@
+suppressPackageStartupMessages(library("cachem"))
+cat("OK\n")
diff --git a/testing/resources/r_hooks_repo/hello-world.R b/testing/resources/r_hooks_repo/hello-world.R
new file mode 100755
index 0000000..bf8d92f
--- /dev/null
+++ b/testing/resources/r_hooks_repo/hello-world.R
@@ -0,0 +1,5 @@
+stopifnot(
+ packageVersion('rprojroot') == '1.0',
+ packageVersion('gli.clu') == '0.0.0.9000'
+)
+cat("Hello, World, from R!\n")
diff --git a/testing/resources/r_hooks_repo/renv.lock b/testing/resources/r_hooks_repo/renv.lock
new file mode 100644
index 0000000..d7d5fdc
--- /dev/null
+++ b/testing/resources/r_hooks_repo/renv.lock
@@ -0,0 +1,27 @@
+{
+ "R": {
+ "Version": "4.0.3",
+ "Repositories": [
+ {
+ "Name": "CRAN",
+ "URL": "https://cloud.r-project.org"
+ }
+ ]
+ },
+ "Packages": {
+ "renv": {
+ "Package": "renv",
+ "Version": "0.12.5",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "5c0cdb37f063c58cdab3c7e9fbb8bd2c"
+ },
+ "rprojroot": {
+ "Package": "rprojroot",
+ "Version": "1.0",
+ "Source": "Repository",
+ "Repository": "CRAN",
+ "Hash": "86704667fe0860e4fec35afdfec137f3"
+ }
+ }
+}