Check that file.path()
is used to construct safe and portable paths.
See also
linters for a complete list of linters available in lintr.
Examples
# will produce lints
lint(
text = "'abcdefg/hijklmnop/qrst/uv/wxyz'",
linters = nonportable_path_linter()
)
#> <text>:1:2: warning: [nonportable_path_linter] Use file.path() to construct portable file paths.
#> 'abcdefg/hijklmnop/qrst/uv/wxyz'
#> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# okay
lint(
text = "file.path('abcdefg', 'hijklmnop', 'qrst', 'uv', 'wxyz')",
linters = nonportable_path_linter()
)
#> ℹ No lints found.