This is an automated email from the ASF dual-hosted git repository.

jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new b081941243 [CI] Add pre-commit hooks for R (#1717)
b081941243 is described below

commit b081941243e3459ab347dc350ab0b58c19ca696e
Author: gregleleu <[email protected]>
AuthorDate: Tue Dec 10 19:43:42 2024 -0500

    [CI] Add pre-commit hooks for R (#1717)
    
    * Add pre-commit hooks for R
    
    and fixes from this first run
    
    * Update .pre-commit-config.yaml
    
    pkgdown hook does not work with github actions (rely on general R 
installation as per documentation
---
 .pre-commit-config.yaml                       | 22 ++++++++++++++++++++++
 R/R/data_interface.R                          |  4 ++--
 R/tests/testthat/test-data-interface-raster.R |  6 +++---
 R/vignettes/articles/apache-sedona.Rmd        |  2 +-
 R/vignettes/articles/raster.Rmd               |  2 +-
 5 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index f5df2b2a96..b311dafb4e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -170,3 +170,25 @@ repos:
         args: [--strict, -c=.github/linters/.yaml-lint.yml]
         types: [yaml]
         files: \.ya?ml$
+  - repo: https://github.com/lorenzwalthert/precommit
+    rev: v0.4.3
+    hooks:
+      - id: style-files
+        name: R – Run styler
+        description: Run styler for R code
+        args: [--scope=spaces, --strict=FALSE]
+        files: \.(R|Rmd)$
+      - id: lintr
+        name: R – Run lintr
+        description: Run lintr for R code
+        args: [--warn_only]
+        files: \.(R|Rmd|Rd)$
+      - id: no-browser-statement
+        name: R – No browser statement
+        files: \.(R)$
+      - id: no-print-statement
+        name: R – No print statement
+        files: \.(R)$
+      - id: parsable-R
+        name: R – Parsable
+        files: \.(R|Rmd)$
diff --git a/R/R/data_interface.R b/R/R/data_interface.R
index fabe885a98..e04782340b 100644
--- a/R/R/data_interface.R
+++ b/R/R/data_interface.R
@@ -435,7 +435,7 @@ spark_read_shapefile <- function(sc,
 
   lapply(names(options), function(name) {
     if (!name %in% c("")) {
-      warning(paste0("Ignoring unknown option '", name,"'"))
+      warning(paste0("Ignoring unknown option '", name, "'"))
     }
   })
 
@@ -470,7 +470,7 @@ spark_read_geojson <- function(sc,
   if ("skip_syntactically_invalid_geometries" %in% names(options)) final_skip 
<- options[["skip_syntactically_invalid_geometries"]] else final_skip <- TRUE
   lapply(names(options), function(name) {
     if (!name %in% c("allow_invalid_geometries", 
"skip_syntactically_invalid_geometries")) {
-      warning(paste0("Ignoring unknown option '", name,"'"))
+      warning(paste0("Ignoring unknown option '", name, "'"))
     }
   })
 
diff --git a/R/tests/testthat/test-data-interface-raster.R 
b/R/tests/testthat/test-data-interface-raster.R
index 67a1e6a0af..ec67ad1ee5 100644
--- a/R/tests/testthat/test-data-interface-raster.R
+++ b/R/tests/testthat/test-data-interface-raster.R
@@ -33,7 +33,7 @@ test_that("Passed RS_FromGeoTiff from binary", {
     mutate(raster = RS_FromGeoTiff(content))
 
   expect_equal(
-    raster_sdf %>% sdf_schema() ,
+    raster_sdf %>% sdf_schema(),
     list(
       path             = list(name = "path", type = "StringType"),
       modificationTime = list(name = "modificationTime", type = 
"TimestampType"),
@@ -65,7 +65,7 @@ test_that("Passed RS_FromArcInfoAsciiGrid from binary", {
     mutate(raster = RS_FromArcInfoAsciiGrid(content))
 
   expect_equal(
-    raster_sdf %>% sdf_schema() ,
+    raster_sdf %>% sdf_schema(),
     list(
       path             = list(name = "path", type = "StringType"),
       modificationTime = list(name = "modificationTime", type = 
"TimestampType"),
@@ -101,7 +101,7 @@ test_that("Passed RS_Envelope with raster", {
     )
 
   expect_equal(
-    raster_sdf %>% sdf_schema() ,
+    raster_sdf %>% sdf_schema(),
     list(
       path             = list(name = "path", type = "StringType"),
       modificationTime = list(name = "modificationTime", type = 
"TimestampType"),
diff --git a/R/vignettes/articles/apache-sedona.Rmd 
b/R/vignettes/articles/apache-sedona.Rmd
index f5fda1b94d..da73e4c38c 100644
--- a/R/vignettes/articles/apache-sedona.Rmd
+++ b/R/vignettes/articles/apache-sedona.Rmd
@@ -447,7 +447,7 @@ Or change at runtime:
 ```{r}
 spark_session(sc) %>%
   invoke("conf") %>%
-  invoke("set", "sedona.global.index","false")
+  invoke("set", "sedona.global.index", "false")
 
 invoke_new(sc, "org.apache.sedona.core.utils.SedonaConf", 
invoke(spark_session(sc), "conf"))
 ```
diff --git a/R/vignettes/articles/raster.Rmd b/R/vignettes/articles/raster.Rmd
index 7d2b8ea7fd..832fb0403e 100644
--- a/R/vignettes/articles/raster.Rmd
+++ b/R/vignettes/articles/raster.Rmd
@@ -107,7 +107,7 @@ dir(dest_file, recursive = TRUE)
 Available options see [Raster writer](../../../api/sql/Raster-writer/):
 
 * rasterField: the binary column to be saved (if there is only one takes that 
column by default, otherwise specify)
-* fileExtension: `.tiff` bvy default, also accepts `.png`, `.jpeg`, `.asc`
+* fileExtension: `.tiff` by default, also accepts `.png`, `.jpeg`, `.asc`
 * pathField: if used any column name that indicates the paths of each raster 
file, otherwise random UUIDs are generated.
 
 ```{r}

Reply via email to