Skip to content
This repository has been 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

Open
tyner opened this issue Feb 12, 2013 · 0 comments
Assignees

Comments

@tyner
Copy link

tyner commented Feb 12, 2013

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
               )
@ghost ghost assigned halpo Apr 3, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants