Skip to contents

Check that there are no trailing blank lines in source code.

Usage

trailing_blank_lines_linter()

See also

linters for a complete list of linters available in lintr.

Tags

default, style

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/RtmpaB9Kym/file174e58fce389: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)