Skip to content

Change in R devel causes different error message for _, making {styler} fail R CMD check #925

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

Closed
lorenzwalthert opened this issue Mar 5, 2022 · 7 comments · Fixed by #929

Comments

@lorenzwalthert
Copy link
Collaborator

lorenzwalthert commented Mar 5, 2022

I will soon be committing a change to R-devel that will change error
messages produced by the parser when the underscore character _ is
used inappropriately. styler currently tests for a specific message
and will fail once that change is committed. The test that will fail
is

testthat::expect_error(...) at test-escaping.R:14:2

It would be better to change this to not assume a particular message.

@lorenzwalthert
Copy link
Collaborator Author

Not yet committed into R devel: https://cran.r-project.org/web/checks/check_results_styler.html

@hadley
Copy link
Member

hadley commented Mar 8, 2022

This has just been committed, so let me know if there's anything I can do to help.

@lorenzwalthert
Copy link
Collaborator Author

Was it? I can't see any error in the CRAN results for R devel. I think I'll be able to fix that one myself, thanks, but if you want to help out in other issues, e.g. the ones you opened, that would be appreciated, e.g #926. My plan is to decrease my involvement with {styler} continuously and find other people to contribute code.

@hadley
Copy link
Member

hadley commented Mar 12, 2022

You don't see it because Luke deliberately patched R-devel to avoid styler failing; it still needs to be fixed.

@lorenzwalthert
Copy link
Collaborator Author

Ah ok. Then I'll make a CRAN submission early next week. I first wanted to wait and see it fail to have more context and ensure that the fix is effective, but then I'll just stop assuming a specific error message as Luke suggested.

@MichaelChirico
Copy link
Contributor

you can try something like tryCatch(parse(text = '1 _'), error=identity) and ensure the message coming from styler matches that coming from R

@lorenzwalthert
Copy link
Collaborator Author

lorenzwalthert commented Mar 14, 2022

The fix has been released as part of {styler} 1.7.0.

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

Successfully merging a pull request may close this issue.

3 participants