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 <- withr::local_tempfile(lines = "x <- 1\n")
readLines(f)
#> Warning: cannot open file '/tmp/RtmpAx0Ma8/file18135ddc94e5': No such file or directory
#> Error in file(con, "r"): cannot open the connection
lint(
  filename = f,
  linters = trailing_blank_lines_linter()
)
#> Warning: cannot open file '/tmp/RtmpAx0Ma8/file18135ddc94e5': No such file or directory
#> Error in file(con, "r"): cannot open the connection

# okay
f <- withr::local_tempfile(lines = "x <- 1")
readLines(f)
#> Warning: cannot open file '/tmp/RtmpAx0Ma8/file181321cbb6c': No such file or directory
#> Error in file(con, "r"): cannot open the connection
lint(
  filename = f,
  linters = trailing_blank_lines_linter()
)
#> Warning: cannot open file '/tmp/RtmpAx0Ma8/file181321cbb6c': No such file or directory
#> Error in file(con, "r"): cannot open the connection