Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed_regex_linter() fails when encountering "\\;" #1545

Closed
MichaelChirico opened this issue Sep 20, 2022 · 1 comment · Fixed by #1547
Closed

fixed_regex_linter() fails when encountering "\\;" #1545

MichaelChirico opened this issue Sep 20, 2022 · 1 comment · Fixed by #1547
Labels
bug an unexpected problem or unintended behavior

Comments

@MichaelChirico
Copy link
Collaborator

lintr::lint('strsplit(x, split = "\\\\;")\n', lintr::fixed_regex_linter())
# Error: '\;' is an unrecognized escape in character string starting ""\;"

But the code itself is fine:

strsplit('a;b', '\\;')
# [[1]]
# [1] "a" "b"
@MichaelChirico MichaelChirico added the bug an unexpected problem or unintended behavior label Sep 20, 2022
@MichaelChirico MichaelChirico added this to the 3.0.2 milestone Sep 20, 2022
@IndrajeetPatil
Copy link
Collaborator

Traceback:

Error:
! '\;' is an unrecognized escape in character string starting ""\;"
---
Backtrace:

  1. └─lintr::lint("strsplit(\"a;b\", split = \"\\\\;\")\n", lintr::fixed_regex_linter())
  2.   └─lintr:::get_lints(...)
  3.     ├─lintr:::flatten_lints(linter_fun(expr))
  4.     │ ├─base::structure(flatten_list(x, class = "lint"), class = "lints")
  5.     │ └─lintr:::flatten_list(x, class = "lint")
  6.     │   └─lintr (local) assign_item(x)
  7.     └─lintr (local) linter_fun(expr)
  8.       ├─base::encodeString(...)
  9.       └─lintr:::get_fixed_string(pattern_strings[is_static])
 10.         ├─base::paste0(...)
 11.         └─lintr:::get_token_replacement(token_content, token_type)
 12.           ├─base::eval(parse(text = paste0("\"", token_content, "\"")))
 13.           └─base::parse(text = paste0("\"", token_content, "\""))

MichaelChirico pushed a commit that referenced this issue Sep 21, 2022
* `fixed_regex_linter()` doesn't fail with `"\\;"`

Closes #1545

* Update NEWS.md
@MichaelChirico MichaelChirico modified the milestones: 3.0.3, 3.1.0 Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants