Check that no absolute paths are used (e.g. "/var", "C:\System", "~/docs").
Arguments
- lax
Less stringent linting, leading to fewer false positives. If
TRUE
, only lint path strings, whichcontain 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
See also
linters for a complete list of linters available in lintr.
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()
)
#> ::warning file=<text>,line=1,col=2::file=<text>,line=1,col=2,[absolute_path_linter] Do not use absolute paths.
# okay
lint(
text = 'R"(./blah)"',
linters = absolute_path_linter()
)