Skip to content

Commit

Permalink
Remove custom linting logic from addins (#2526)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Mar 23, 2024
1 parent dd63d9c commit d946143
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions R/addins.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,21 @@ addin_lint <- function() {
return("Current source has no path. Please save before continue")
}

config_file <- (get("find_config", asNamespace("lintr")))(filename$path)
if (length(config_file) == 0L) {
config_linters <- NULL
} else {
config <- read.dcf(config_file, all = TRUE)
config_linters <- config[["linters"]]
}
linters <- if (length(config_linters) == 0L) {
message("No configuration found. Using default linters.")
default_linters
} else {
eval(parse(text = config_linters))
}

lintr::lint(filename$path, linters = linters)
lint(filename$path)
}

addin_lint_package <- function() {
if (!requireNamespace("rstudioapi", quietly = TRUE)) {
stop("'rstudioapi' is required for add-ins.", call. = FALSE)
}
project <- rstudioapi::getActiveProject()
project_path <- if (is.null(project)) getwd() else project

if (is.null(project)) message("No project found, passing current directory")
if (is.null(project)) {
message("No project found, passing current directory")
project_path <- getwd()
} else {
project_path <- project
}

lintr::lint_package(project_path)
lint_package(project_path)
}
# nocov end

0 comments on commit d946143

Please sign in to comment.