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/RtmpI5gBmd/file17b2d3bea3e: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)