Skip to content

Commit

Permalink
fix missing return from handle_expr_level_lints(), actually enable ba…
Browse files Browse the repository at this point in the history
…tching
  • Loading branch information
AshesITR committed Dec 15, 2023
1 parent e6c018d commit d92d504
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/cyclocomp_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @seealso [linters] for a complete list of linters available in lintr.
#' @export
cyclocomp_linter <- function(complexity_limit = 15L) {
Linter(linter_level = "expression", supports_exprlist = TRUE, function(source_expression) {
Linter(linter_level = "expression", function(source_expression) {
complexity <- try_silently(
cyclocomp::cyclocomp(parse(text = source_expression$content))
)
Expand Down
4 changes: 3 additions & 1 deletion R/lint.R
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ collapse_exprs <- function(expr_list) {
for (expr in expr_list) {
i <- i + 1L
xml2::xml_add_child(xml_pc, expr$xml_parsed_content)
function_call_cache <- c(function_call_cache, expr$xml_find_function_calls(NULL, keep_names = TRUE))
function_call_cache <- combine_nodesets(function_call_cache, expr$xml_find_function_calls(NULL, keep_names = TRUE))
lines <- c(lines, expr$lines)
parsed_content <- if (is.null(parsed_content)) expr$parsed_content else rbind(parsed_content, expr$parsed_content)
content <- paste(content, expr$content, sep = "\n")
Expand Down Expand Up @@ -872,4 +872,6 @@ handle_expr_level_lints <- function(lints, expression_linter_names, supports_exp
exprs_to_lint <- exprs_expression[!expr_linter_cached[, linter_name]]
lints[[length(lints) + 1L]] <- get_lints_batched(exprs_to_lint, linter_name, linter_fun, lint_cache, filename)
}

lints
}

Check warning on line 877 in R/lint.R

View workflow job for this annotation

GitHub Actions / lint

file=R/lint.R,line=877,col=2,[trailing_blank_lines_linter] Add a terminal newline.
1 change: 1 addition & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Linter <- function(fun, name = linter_auto_name(), linter_level = c(NA_character
class(fun) <- c("linter", "function")
attr(fun, "name") <- name
attr(fun, "linter_level") <- linter_level
attr(fun, "linter_exprlist") <- isTRUE(supports_exprlist)
fun
}

Expand Down

0 comments on commit d92d504

Please sign in to comment.