Skip to content

Commit

Permalink
reduce nesting where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico committed Nov 17, 2023
1 parent 3e7bb47 commit d2998ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions R/cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ retrieve_lint <- function(cache, expr, linter, lines) {
)
if (is.na(new_line_number)) {
return(NULL)
} else {
lints[[i]]$line_number <- new_line_number
}
lints[[i]]$line_number <- new_line_number
}
cache_lint(cache, expr, linter, lints)
lints
Expand Down
3 changes: 1 addition & 2 deletions R/settings_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ find_local_config <- function(path, config_file) {
pkg_name <- function(path = find_package()) {
if (is.null(path)) {
return(NULL)
} else {
read.dcf(file.path(path, "DESCRIPTION"), fields = "Package")[1L]
}
read.dcf(file.path(path, "DESCRIPTION"), fields = "Package")[1L]
}
3 changes: 2 additions & 1 deletion inst/example/complexity.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ complexity <- function(x) {
if (x > 10.0) {
if (x > 20.0) {
x <- x / 2.0
return(x)
} else {
return(x)
}
Expand All @@ -13,12 +14,12 @@ complexity <- function(x) {
if (x < -10.0) {
if (x < -20.0) {
x <- x * 2.0
return(x)
} else {
return(x)
}
} else {
return(x)
}
}
x
}

0 comments on commit d2998ed

Please sign in to comment.