Skip to content

False positive in return_linter(return_style="explicit") when the formals are complex #2616

@MichaelChirico

Description

@MichaelChirico
lint(linters=return_linter(return_style="explicit"), R"(
foo <- function(y,
                x = {
                  y <- sqrt(y)
                  y + 1
                }) {
  return(x + y)
})")
# <text>:5:19: warning: [return_linter] All functions must have an explicit return().
#                   y + 1
#                   ^

The XPath for finding the function body needs to be adjusted a bit I reckon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-positivecode that shouldn't lint, but does

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions