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()
)
#> /tmp/Rtmpo8BiSD/file17553bf477d4:2:1: style: [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()
)
#> ℹ No lints found.
unlink(f)