Skip to contents

Check that the correct character is used for indentation.

Usage

whitespace_linter()

Details

Currently, only supports linting in the presence of tabs.

Much ink has been spilled on this topic, and we encourage you to check out references for more information.

References

  • https://www.jwz.org/doc/tabs-vs-spaces.html

  • https://blog.codinghorror.com/death-to-the-space-infidels/

See also

linters for a complete list of linters available in lintr.

Examples

# will produce lints
lint(
  text = "\tx",
  linters = whitespace_linter()
)
#> <text>:1:1: style: [whitespace_linter] Use spaces to indent, not tabs.
#>  x
#> ^

# okay
lint(
  text = "  x",
  linters = whitespace_linter()
)
#>  No lints found.