Check that the desired quote delimiter is used for string constants.
Usage
quotes_linter(delimiter = c("\"", "'"))
See also
linters for a complete list of linters available in lintr.
Examples
# will produce lints
lint(
text = "c('a', 'b')",
linters = quotes_linter()
)
#> <text>:1:3: style: [quotes_linter] Only use double-quotes.
#> c('a', 'b')
#> ^~~
#> <text>:1:8: style: [quotes_linter] Only use double-quotes.
#> c('a', 'b')
#> ^~~
# okay
lint(
text = 'c("a", "b")',
linters = quotes_linter()
)
#> ℹ No lints found.
code_lines <- "paste0(x, '\"this is fine\"')"
writeLines(code_lines)
#> paste0(x, '"this is fine"')
lint(
text = code_lines,
linters = quotes_linter()
)
#> ℹ No lints found.
# okay
lint(
text = "c('a', 'b')",
linters = quotes_linter(delimiter = "'")
)
#> ℹ No lints found.