r-lib / lintr

Static Code Analysis for R
https://lintr.r-lib.org
Other
1.2k stars 187 forks source link

todo_comment_linter(except_regex=) fails with capture groups #2678

Open MichaelChirico opened 1 month ago

MichaelChirico commented 1 month ago
lint("# abc\n", todo_comment_linter('abc', except_regex = "(abc)"))
# Error in `h()`:
# ! Linter `linter()` failed in /tmp/Rtmp6XgIZm/file2adee8120fb1df:
# invalid argument type
# Run `rlang::last_trace()` to see where the error occurred.

The error is really confusing too. It's easy to forget to use ?: when writing a regex (and it's not clear that's a good requirement). Primarily this is due to rex::re_matches() changing output type.

MichaelChirico commented 1 month ago

Filed https://github.com/r-lib/rex/issues/94 as an upstream FR.