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

Ensure linter logic allows for R>=4 raw strings #1034

Closed
MichaelChirico opened this issue Mar 30, 2022 · 3 comments · Fixed by #1076
Closed

Ensure linter logic allows for R>=4 raw strings #1034

MichaelChirico opened this issue Mar 30, 2022 · 3 comments · Fixed by #1076
Milestone

Comments

@MichaelChirico
Copy link
Collaborator

Some linters (e.g. current paste_sep_linter and paste_to_string_linter) rely on assumptions about STR_CONST nodes that are designed with R<4 in mind, where R"(a string)" is not available.

We should take a pass over linters to ensure robustness to this new style of literal strings.

@AshesITR
Copy link
Collaborator

AshesITR commented Apr 4, 2022

Note: as.character(parse(text = 'r"(a)"', keep.source = FALSE)) == "a" seems like a base R way to extract the string without eval().

@MichaelChirico
Copy link
Collaborator Author

Here's all the linters that might need to be addressed:

grep -Flr "STR_CONST" R | awk -F/ '{print $2}'

object_usage_linter.R
extraction_operator_linter.R
expect_type_linter.R
literal_coercion_linter.R
strings_as_factors_linter.R
condition_message_linter.R
path_linters.R
object_name_linters.R
single_quotes_linter.R
paste_linter.R
expect_s3_class_linter.R
get_source_expressions.R
expect_named_linter.R
make_linter_from_regex.R
unneeded_concatenation_linter.R
missing_package_linter.R
sprintf_linter.R
yoda_test_linter.R

@MichaelChirico
Copy link
Collaborator Author

One more TODO here: I think unquote() can be entirely replaced by the new as.character(parse()) approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants