-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Labels
false-positivecode that shouldn't lint, but doescode that shouldn't lint, but does
Description
This shows the problem:
lintr::lint(text = 'gsub("[^0-9\\\\-]", "", x)', linter = lintr::nonportable_path_linter())
# <text>:1:7: warning: [nonportable_path_linter] Use file.path() to construct portable file paths.
# gsub("[^0-9\\-]", "", x)
# ^~~~~~~~~A minimized version:
lintr::lint(text = "'[\\\\-]'", linter = lintr::nonportable_path_linter())
# <text>:1:2: warning: [nonportable_path_linter] Use file.path() to construct portable file paths.
# '[\\-]'
# ^~~~~Actually, my script has gsub("[^0-9\\-]", "", x), but this is parsed differently when using text:
lintr::lint(text = "gsub('[^0-9\\-]', '', x)", linter = lintr::nonportable_path_linter())
# <text>:1:13: error: [error] '\-' is an unrecognized escape in character string.
# gsub('[^0-9\-]', '', x)Metadata
Metadata
Assignees
Labels
false-positivecode that shouldn't lint, but doescode that shouldn't lint, but does