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

Valid styling with cached expression in stylerignore #600

merged 7 commits into from Feb 15, 2020


Copy link

Fixes #598 by adding cached expressions (that are non-terminal by nature) to styler ignore too and drop non-top-level tokens when making the parse table shallow.

…en calculating spaces and newlines on the shallow parse table, the assumption that we have all tokens in the parse table is not true (anymore, compared to before caching was introduced). We hence cannot remove non-terminals if they are cached expressions to calculate spaces and newliens between tokens, becaues their children are not present anymore.
… the previous fix added more non-terminal but cached tokens to stylerignore, where the parse data is validated and becomes invlid if the comment tokens from the cached expressions are listed as separate tokens.

Because expr will be first element with parent 0, the condition simplifies.
@lorenzwalthert lorenzwalthert changed the title Issue 598 Valid styling with cached expression in stylerignore Feb 15, 2020
Copy link

codecov-io commented Feb 15, 2020

Codecov Report

Merging #600 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #600      +/-   ##
+ Coverage   92.12%   92.12%   +<.01%     
  Files          47       47              
  Lines        2095     2096       +1     
+ Hits         1930     1931       +1     
  Misses        165      165
Impacted Files Coverage Δ
R/stylerignore.R 100% <100%> (ø) ⬆️
R/nest.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04cd4ee...b56ca10. Read the comment docs.

@lorenzwalthert lorenzwalthert merged commit b607e68 into r-lib:master Feb 15, 2020
@lorenzwalthert lorenzwalthert deleted the issue-598 branch February 15, 2020 21:55
@lorenzwalthert lorenzwalthert restored the issue-598 branch November 28, 2020 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

styler formats wrongly when part of the code to ignore is cached
2 participants