Skip to content

return_linter() for implicit returns has a false positive on nested early returns #2354

Closed

Description

@MichaelChirico
          Corrected this test, and added the incorrect test as a new regression test.

That said, the new fix is more expedient than perfect -- it'll throw an incorrect lint here:

foo <- function() {
  if (TRUE) {
    if (TRUE) {
      return(1)
    }
    2
  } else {
    3
  }

(the return() is a valid early return within that branch).

But as this issue is not relevant to the implicit else returns feature, I'm pushing to follow-up.

Originally posted by @MichaelChirico in #2321 (comment)

Activity

  1. ghost added
    false-positivecode that shouldn't lint, but does
    on Nov 28, 2023
  2. ghost closed this as completedin #2362on Dec 4, 2023
  3. 2 remaining items

    Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-positivecode that shouldn't lint, but does

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions