Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom linting logic from addins #2526

Merged
merged 2 commits into from
Mar 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading