Skip to content

Enhancement of unreachable_code_linter to Detect Unreachable Code in Loops #2105

Description

@MEO265

The unreachable_code_linter should also mark code inside if, else, for, and while loops as unreachable, especially when a return or stop function is called.

The following code currently generates only one annotation:

x <- function() { 
  if(TRUE) { 
    stop('This is a test') 
    5+5 
  } 
  return(5L)
  4+4 
} 

And this one generates none:

x <- function() { 
  if(TRUE) { 
    stop('This is a test') 
    5+5 
  } 
  4+4 
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions