View source: R/trailing_blank_lines_style.R
trailing_blank_lines_style | R Documentation |
Check that a script file does not contain superfluous trailing blank lines.
trailing_blank_lines_style(srcData)
srcData |
a list as returned by |
Good coding practices dictate that a script file should not end with blank 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 blank lines
fil <- tempfile(fileext = ".R")
cat("## A simple function",
"foo <- function(x, y)",
"{",
" x + y",
"}",
file = fil, sep = "\n")
trailing_blank_lines_style(getSourceData(fil))
## Incorrect script with trailing blank lines
fil <- tempfile(fileext = ".R")
cat("## A simple function",
"foo <- function(x, y)",
"{",
" x + y",
"}",
"",
"",
file = fil, sep = "\n")
trailing_blank_lines_style(getSourceData(fil))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.