Check that there are no trailing blank lines in source code.
See also
linters for a complete list of linters available in lintr.
Examples
# will produce lints
f <- tempfile()
cat("x <- 1\n\n", file = f)
writeLines(readChar(f, file.size(f)))
#> x <- 1
#>
#>
lint(
filename = f,
linters = trailing_blank_lines_linter()
)
#> ::warning file=/tmp/RtmpJZ82Ls/file180121daaaad,line=2,col=1::file=/tmp/RtmpJZ82Ls/file180121daaaad,line=2,col=1,[trailing_blank_lines_linter] Remove trailing blank lines.
unlink(f)
# okay
cat("x <- 1\n", file = f)
writeLines(readChar(f, file.size(f)))
#> x <- 1
#>
lint(
filename = f,
linters = trailing_blank_lines_linter()
)
unlink(f)