| INWTLinters | R Documentation |
Linters added by INWT. Usually not called directly but used
with lint.
double_space_linter()
internal_function_linter()
setwd_linter()
source_linter()
options_linter()
sapply_linter()
trailing_whitespaces_linter()
double_space_linter()
double_space_linter(): Are there double whitespaces?
internal_function_linter(): Internal functions should not be used since there is
in general a reason why they have not been exported by the package author.
They may not have been tested outside the context of the function they are
used in.
setwd_linter(): Changing the working directory in package functions
can have unexpected side effects. (only for package functions)
source_linter(): Sourcing files in package functions can have
unexpected side effects. (only for package functions)
options_linter(): Changing options in package functions can have
unexpected side effects and is not visible from the outside. (only for
package functions)
sapply_linter(): The automatic simplification performed by
sapply introduces uncertainty. If the input changes, the
output can change unexpectedly and the code crashes. Replace it with
sapply. If you use sapply with
simplify = FALSE, it is equivalent to lapply anyway.
trailing_whitespaces_linter(): Trailing whitespaces are superfluos. In contrast to
trailing_whitespace_linter, this function detects
whitespaces after %>% only if there are at least two
(since one whitespace is inserted automatically after
%>%).
double_space_linter(): Are there double whitespaces?
## Not run:
writeLines(con = "lintExample.txt",
# nolint start
text = c("# Example script to demonstrate INWT's own linters",
"",
"source(anotherScript.R)",
"",
"foo <- function(x = 1, y) {",
" 2 * x + 1 ",
"}",
"",
"# This line contains double spaces",
"",
"print(INWTUtils:::scriptLinters())"))
# nolint end
lintr::lint("lintExample.txt",
linters = list(argsWithoutDefault = function_argument_linter,
doubeWhitespace = double_space_linter,
sourceLinter = source_linter))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.