Skip to content

Instantly share code, notes, and snippets.

@lcd047
Created April 5, 2014 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcd047/9988687 to your computer and use it in GitHub Desktop.
Save lcd047/9988687 to your computer and use it in GitHub Desktop.
diff --git a/R/lint.R b/R/lint.R
index 5f0524f..521965f 100644
--- a/R/lint.R
+++ b/R/lint.R
@@ -86,37 +86,37 @@ sep = "+++")
## OK, tested with codetools 0.2-8
findParamChangedByAssign <- function (txt, p, i)
return(finding(txt, p, i,
- rx = "^.*: parameter .(.*). changed by assignment.*\\\n",
+ rx = "^.*: parameter '(.*)' changed by assignment.*\\\n",
rx2 = "[^.a-zA-Z0-9_]*%s[[:space:]]*(=|<-|<<-)"))
## OK, tested with codetools 0.2-8
findUnusedLocalAssign <- function (txt, p, i)
return(finding(txt, p, i,
- rx = "^.*: local variable .(.*). assigned but may not be used.*\\\n",
+ rx = "^.*: local variable '(.*)' assigned but may not be used.*\\\n",
rx2 = "^[^.a-zA-Z0-9_(,]*%s[[:space:]]*(=|<-|<<-)"))
## TODO: check this!
findNoGlobalDef <- function (txt, p, i)
return(finding(txt, p, i,
- rx = "^.*: no visible global function definition for .(.*)..*\\\n",
+ rx = "^.*: no visible global function definition for '(.*)'.*\\\n",
rx2 = "[^.a-zA-Z0-9_]*%s[[:space:]]*\\("))
## TODO: check this!
findNoLocalDefAsFun <- function (txt, p, i)
return(finding(txt, p, i,
- rx = "^.*: local variable .(.*). used as function with no apparent local function definition.*\\\n",
+ rx = "^.*: local variable '(.*)' used as function with no apparent local function definition.*\\\n",
rx2 = "[^.a-zA-Z0-9_]*%s[[:space:]]*\\("))
## TODO: check this!
findNoBindingGlobalVar <- function (txt, p, i)
return(finding(txt, p, i,
- rx = "^.*: no visible binding for global variable .(.*)..*\\\n",
+ rx = "^.*: no visible binding for global variable '(.*)'.*\\\n",
rx2 = "[^.a-zA-Z0-9_]*%s[^.a-zA-Z0-9_]*"))
## OK, tested with codetools 0.2-8
findMultipleLocalDef <- function (txt, p, i)
return(finding(txt, p, i,
- rx = "^.*: multiple local function definitions for .(.*). with different formal arguments.*\\\n",
+ rx = "^.*: multiple local function definitions for '(.*)' with different formal arguments.*\\\n",
rx2 = "[^.a-zA-Z0-9_]*%s[[:space:]]*(=|<-|<<-)[[:space:]]*function"))
searchAndReport <- function (regex, fun) {
diff --git a/R/parseError.R b/R/parseError.R
index f50fd7d..0cb5144 100644
--- a/R/parseError.R
+++ b/R/parseError.R
@@ -27,7 +27,7 @@ parseError <- function (err)
## FIXME: there is a bug here: if we use tabulations, they are converted into
## four spaces somewhere... That means the column number is not correct any more
## For now, we prefer to return column 1 everytime until the bug is fixed!
- column <- 1
+ # column <- 1
message <- sub(rx, "\\4", msg, perl = TRUE)
return(structure(data.frame(file = file, line = line, column = column,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment