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

Requires lintr 3.0.0 #562

Merged
merged 1 commit into from
Jul 23, 2022
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
linters: with_defaults(
line_length_linter = NULL,
object_usage_linter = NULL,
object_length_linter = NULL,
camel_case_linter = NULL,
object_name_linter = NULL,
commented_code_linter = NULL,
linters: linters_with_defaults(
line_length_linter = NULL,
object_usage_linter = NULL,
object_length_linter = NULL,
object_name_linter = NULL,
commented_code_linter = NULL,
cyclocomp_linter = NULL)
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Imports:
collections (>= 0.3.0),
fs (>= 1.3.1),
jsonlite (>= 1.6),
lintr (>= 2.0.1),
lintr (>= 3.0.0),
parallel,
R6 (>= 2.4.1),
roxygen2 (>= 7.0.0),
Expand All @@ -48,5 +48,5 @@ ByteCompile: yes
Encoding: UTF-8
NeedsCompilation: yes
Roxygen: list(markdown = TRUE, r6 = FALSE)
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1
Config/testthat/edition: 3
25 changes: 1 addition & 24 deletions R/diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
#' @name diagnostics
NULL


#' Check if lintr is 2.0.1.9000 above. A number of features relies on it.
#' @noRd
lintr_is_new_enough <- function() {
return(
utils::packageVersion("lintr") >= "2.0.1.9000" &&
"text" %in% names(formals(lintr::lint))
)
}


DiagnosticSeverity <- list(
Error = 1,
Warning = 2,
Expand Down Expand Up @@ -95,19 +84,7 @@ diagnose_file <- function(uri, is_rmarkdown, content, cache = FALSE) {
content <- c(content, "")
}

if (lintr_is_new_enough()) {
lints <- lintr::lint(path, cache = cache, text = content)
} else {
# TODO: remove it once new version of lintr is released
linter_file <- find_config(path)
if (!is.null(linter_file)) {
op <- options(lintr.linter_file = linter_file)
on.exit(options(op))
}
text <- paste0(content, collapse = "\n")
lints <- lintr::lint(text, cache = cache)
}

lints <- lintr::lint(path, cache = cache, text = content)
diagnostics <- lapply(lints, diagnostic_from_lint, content = content)
names(diagnostics) <- NULL
diagnostics
Expand Down
2 changes: 1 addition & 1 deletion man/languageserver-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.