comments_style {roger} | R Documentation |
Validation of Comments
Description
Check that comment delimiters and the text of comments, when there is any, are separated by at least one space.
Usage
comments_style(srcData)
Arguments
srcData |
a list as returned by |
Details
Good coding practices dictate to follow the comment delimiters by at least one space when a comment contains text.
The accepted delimiters are: one or more \#
symbols possibly
followed immediately by any combination of punctuation characters of the
[:punct:]
class (see regex
).
Value
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. |
Examples
## Keep parse data in non interactive sessions.
if (!interactive())
op <- options(keep.source = TRUE)
## Correct comments
fil <- tempfile(fileext = ".R")
cat("### foo",
"##-- bar",
"## ",
"#",
"#***",
file = fil, sep = "\n")
comments_style(getSourceData(fil))
## Incorrect comments
fil <- tempfile(fileext = ".R")
cat("###foo",
"##++bar",
file = fil, sep = "\n")
comments_style(getSourceData(fil))
[Package roger version 1.5-1 Index]