#!/usr/bin/env Rscript --vanilla

# To enable this hook, rename this file to "pre-commit"
# To disable this hook, rename this file to "pre-commit.sample"
# author: Stu Field

if (requireNamespace("spelling", quietly = TRUE) && file.exists("DESCRIPTION")) {
  words <- spelling::spell_check_package()
  L <- length(words$word)
  if (L > 0L) {
    warning("Spelling errors (", L, ") detected!", call. = FALSE)
  }
}

# check lints
#files <- list.files("R", full.names = TRUE)
#lints <- lapply(files, function(path) {
#  lints <- somaverse::lintFile(path)
#  if (length(lints) > 0) {
#    stop("File ", basename(path), " is not lint free\n",
#         "Run somaverse::lintFile('", basename(path),
#         "') to check the lintr output.", call. = FALSE)
#  }
#})
