nonportable_path_linter: Non-portable path linter

View source: R/nonportable_path_linter.R

nonportable_path_linterR Documentation

Non-portable path linter

Description

Check that file.path() is used to construct safe and portable paths.

Usage

nonportable_path_linter(lax = TRUE)

Arguments

lax

Less stringent linting, leading to fewer false positives. If TRUE, only lint path strings, which

  • contain at least two path elements, with one having at least two characters and

  • contain only alphanumeric chars (including UTF-8), spaces, and win32-allowed punctuation

Tags

best_practices, configurable, robustness

See Also

  • linters for a complete list of linters available in lintr.

  • absolute_path_linter()

Examples

# will produce lints
lint(
  text = "'abcdefg/hijklmnop/qrst/uv/wxyz'",
  linters = nonportable_path_linter()
)

# okay
lint(
  text = "file.path('abcdefg', 'hijklmnop', 'qrst', 'uv', 'wxyz')",
  linters = nonportable_path_linter()
)


jimhester/lintr documentation built on April 24, 2024, 8:21 a.m.