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/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)