Skip to content
This repository was archived by the owner on Jul 30, 2019. It is now read-only.
This repository was archived by the owner on Jul 30, 2019. It is now read-only.

when using indentation check, find_function_args gets confused by calls to other functions within the args #16

@tyner

Description

@tyner

code to reproduce the issue; the first raises a flag, the second passes. The only difference between the two texts is the order of the arguments.

mytest <- list(pattern = "^(   )*( )\\S",
               message = "indentation should be by 3 spaces.", 
               exclude.region = c("find_function_args", "find_call_args")
               )

mytext1 <- "
   foo <- function(x,
                   y = attr(x, 'bar'),
                   z){
      return(x)
   }
"

mytext2 <- "
   foo <- function(x,
                   z,
                   y = attr(x, 'bar')){
      return(x)
   }
"

writeLines(text = mytext1, "file1.R")
writeLines(text = mytext2, "file2.R")

# flagged
check1 <- lint(file    = "file1.R",
               style   = list(mytest),
               recurse = FALSE
               )

# passes
check2 <- lint(file    = "file2.R",
               style   = list(mytest),
               recurse = FALSE
               )

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions