View source: R/trailing_whitespace_style.R
trailing_whitespace_style | R Documentation |
Check that a script file does not contain unnecessary whitespace at the end of lines.
trailing_whitespace_style(srcData)
srcData |
a list as returned by |
Good coding practices dictate that a script file should contain unnecessary whitespace (space or tabulation) at the end of lines.
Boolean. When FALSE
, a message indicates the nature of
the error and the faulty lines, and the returned value has the
following attributes:
lines |
faulty line numbers; |
message |
text of the error message. |
## Keep parse data in non interactive sessions.
if (!interactive())
op <- options(keep.source = TRUE)
## Correct script without trailing whitespace
fil <- tempfile(fileext = ".R")
cat("## A simple function",
"foo <- function(x, y)",
"{",
" x + y",
"}",
file = fil, sep = "\n")
trailing_whitespace_style(getSourceData(fil))
## Incorrect script with trailing whitespace
fil <- tempfile(fileext = ".R")
cat("## A simple function",
"foo <- function(x, y)",
"{ ",
" x + y",
"}\t",
file = fil, sep = "\n")
trailing_whitespace_style(getSourceData(fil))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.