Skip to content

Commit

Permalink
Use implicit returns (#2324)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Nov 21, 2023
1 parent a99e7d4 commit ef82966
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion R/any_duplicated_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ any_duplicated_linter <- function() {
type = "warning"
)

return(c(any_duplicated_lints, length_unique_lints))
c(any_duplicated_lints, length_unique_lints)
})
}
4 changes: 2 additions & 2 deletions R/comments.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jenkins_build_info <- function() {
}

in_travis <- function() {
return(nzchar(Sys.getenv("TRAVIS_REPO_SLUG")))
nzchar(Sys.getenv("TRAVIS_REPO_SLUG"))
}

travis_build_info <- function() {
Expand All @@ -59,7 +59,7 @@ travis_build_info <- function() {
}

in_wercker <- function() {
return(nzchar(Sys.getenv("WERCKER_GIT_BRANCH")))
nzchar(Sys.getenv("WERCKER_GIT_BRANCH"))
}

ci_build_info <- function() {
Expand Down
4 changes: 2 additions & 2 deletions R/inner_combine_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ arg_match_condition <- function(arg) {
this_symbol <- sprintf("SYMBOL_SUB[text() = '%s']", arg)
following_symbol <- sprintf("following-sibling::expr/%s", this_symbol)
next_expr <- "following-sibling::expr[1]"
return(xp_or(
xp_or(
sprintf("not(%s) and not(%s)", this_symbol, following_symbol),
xp_and(
this_symbol,
Expand All @@ -122,7 +122,7 @@ arg_match_condition <- function(arg) {
this_symbol, following_symbol, next_expr
)
)
))
)
}

build_arg_condition <- function(calls, arguments) {
Expand Down
4 changes: 2 additions & 2 deletions R/package_hooks_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ package_hooks_linter <- function() {
unload_arg_name_lints <-
xml_nodes_to_lints(unload_arg_name_expr, source_expression, unload_arg_name_message, type = "warning")

return(c(
c(
onload_bad_msg_call_lints,
onattach_bad_msg_call_lints,
load_arg_name_lints,
library_require_lints,
bad_unload_call_lints,
unload_arg_name_lints
))
)
})
}
2 changes: 1 addition & 1 deletion R/redundant_ifelse_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ redundant_ifelse_linter <- function(allow10 = FALSE) {
lints <- c(lints, xml_nodes_to_lints(num_expr, source_expression, lint_message, type = "warning"))
}

return(lints)
lints
})
}
2 changes: 1 addition & 1 deletion R/regex_subset_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ regex_subset_linter <- function() {
type = "warning"
)

return(c(grep_lints, stringr_lints))
c(grep_lints, stringr_lints)
})
}
4 changes: 2 additions & 2 deletions R/scalar_in_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ scalar_in_linter <- function() {
/parent::expr
"

return(Linter(function(source_expression) {
Linter(function(source_expression) {
if (!is_lint_level(source_expression, "expression")) {
return(list())
}
Expand All @@ -55,5 +55,5 @@ scalar_in_linter <- function() {
lint_message = lint_msg,
type = "warning"
)
}))
})
}
2 changes: 1 addition & 1 deletion R/xp_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ xp_text_in_table <- function(table) {
single_quoted <- grepl("'", table, fixed = TRUE)
table[single_quoted] <- sQuote(table[single_quoted], '"')
table[!single_quoted] <- sQuote(table[!single_quoted], "'")
return(paste0("text() = ", table, collapse = " or "))
paste0("text() = ", table, collapse = " or ")
}

paren_wrap <- function(..., sep) {
Expand Down

0 comments on commit ef82966

Please sign in to comment.