aboutsummaryrefslogtreecommitdiff
path: root/dev/lint-r.R
diff options
context:
space:
mode:
Diffstat (limited to 'dev/lint-r.R')
-rw-r--r--dev/lint-r.R12
1 files changed, 7 insertions, 5 deletions
diff --git a/dev/lint-r.R b/dev/lint-r.R
index 48bd624609..999eef571b 100644
--- a/dev/lint-r.R
+++ b/dev/lint-r.R
@@ -17,8 +17,14 @@
argv <- commandArgs(TRUE)
SPARK_ROOT_DIR <- as.character(argv[1])
+LOCAL_LIB_LOC <- file.path(SPARK_ROOT_DIR, "R", "lib")
-# Installs lintr from Github.
+# Checks if SparkR is installed in a local directory.
+if (! library(SparkR, lib.loc = LOCAL_LIB_LOC, logical.return = TRUE)) {
+ stop("You should install SparkR in a local directory with `R/install-dev.sh`.")
+}
+
+# Installs lintr from Github in a local directory.
# NOTE: The CRAN's version is too old to adapt to our rules.
if ("lintr" %in% row.names(installed.packages()) == FALSE) {
devtools::install_github("jimhester/lintr")
@@ -27,9 +33,5 @@ if ("lintr" %in% row.names(installed.packages()) == FALSE) {
library(lintr)
library(methods)
library(testthat)
-if (! library(SparkR, lib.loc = file.path(SPARK_ROOT_DIR, "R", "lib"), logical.return = TRUE)) {
- stop("You should install SparkR in a local directory with `R/install-dev.sh`.")
-}
-
path.to.package <- file.path(SPARK_ROOT_DIR, "R", "pkg")
lint_package(path.to.package, cache = FALSE)