absolute_path_linter: Absolute path linter

View source: R/absolute_path_linter.R

absolute_path_linterR Documentation

Absolute path linter

Description

Check that no absolute paths are used (e.g. "/var", "C:\System", "~/docs").

Usage

absolute_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.

  • nonportable_path_linter()

Examples


# Following examples use raw character constant syntax introduced in R 4.0.

# will produce lints
lint(
  text = 'R"--[/blah/file.txt]--"',
  linters = absolute_path_linter()
)

# okay
lint(
  text = 'R"(./blah)"',
  linters = absolute_path_linter()
)


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