quotes_linter: Character string quote linter

View source: R/quotes_linter.R

quotes_linterR Documentation

Character string quote linter

Description

Check that the desired quote delimiter is used for string constants.

Usage

quotes_linter(delimiter = c("\"", "'"))

Arguments

delimiter

Which quote delimiter to accept. Defaults to the tidyverse default of ⁠"⁠ (double-quoted strings).

Tags

configurable, consistency, default, readability, style

See Also

Examples

# will produce lints
lint(
  text = "c('a', 'b')",
  linters = quotes_linter()
)

# okay
lint(
  text = 'c("a", "b")',
  linters = quotes_linter()
)

code_lines <- "paste0(x, '\"this is fine\"')"
writeLines(code_lines)
lint(
  text = code_lines,
  linters = quotes_linter()
)

# okay
lint(
  text = "c('a', 'b')",
  linters = quotes_linter(delimiter = "'")
)


lintr documentation built on May 29, 2024, 11:31 a.m.