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

Only replace long strings #384

Merged
merged 7 commits into from Apr 6, 2018
Merged

Conversation

@lorenzwalthert
Copy link
Collaborator

@lorenzwalthert lorenzwalthert commented Mar 26, 2018

Another attempt to solve #216, by implementing suggestion 2 suggested in #216 (comment). That is, only replace the strings that are necessary, not all strings if there is one string in the parse data that is longer than 1'000. This does (not yet) implement line / col substitution but returns an error if there is a problem, so we are failing fast instead of silently. I think it's rather unlikely that this is going to cause a problem in the future.

Also closes #383.

@lorenzwalthert
Copy link
Collaborator Author

@lorenzwalthert lorenzwalthert commented Apr 3, 2018

@krlmlr there seems to be a bug in the R base parser of R3.1 with this example. It simply does not parse all tokens. I managed to reproduce it after painfully re-install R 3.1 and all packages needed on my Mac (this took forever, I also tried on Ubuntu and docker images). Can we skip a test based on R version? In principle, we should check whether the R version is below 3.2 and if so, check whether any non-terminal has no children and if so, throw an error.

@codecov-io
Copy link

@codecov-io codecov-io commented Apr 3, 2018

Codecov Report

Merging #384 into master will decrease coverage by 0.66%.
The diff coverage is 73.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #384      +/-   ##
==========================================
- Coverage   91.68%   91.02%   -0.67%     
==========================================
  Files          30       30              
  Lines        1479     1526      +47     
==========================================
+ Hits         1356     1389      +33     
- Misses        123      137      +14
Impacted Files Coverage Δ
R/parse.R 78.66% <73.77%> (-21.34%) ⬇️
R/utils.R 92.59% <0%> (+7.4%) ⬆️

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 8efd035...32d447b. Read the comment docs.

@lorenzwalthert lorenzwalthert force-pushed the long-strings-again branch from 013e883 to 7cbc6fb Apr 6, 2018
@lorenzwalthert
Copy link
Collaborator Author

@lorenzwalthert lorenzwalthert commented Apr 6, 2018

In principle, we should check whether the R version is below 3.2 and if so, check whether any non-terminal has no children and if so, throw an error.

This is implemented with e85b29c.

@lorenzwalthert lorenzwalthert force-pushed the long-strings-again branch 2 times, most recently from 7b196c6 to 5dab0a3 Apr 6, 2018
fix misnomer of `verify_str_txt()`, better variable names within this function, outsource identification of insufficiently parsed strings in identify_insufficiently_parsed_stings(), add line and col check.
validate parse table for R < 3.2 as parsing problems were found on travis with R 3.1 https://travis-ci.org/r-lib/styler/builds/361687013
@lorenzwalthert lorenzwalthert force-pushed the long-strings-again branch from 5dab0a3 to 32d447b Apr 6, 2018
@lorenzwalthert lorenzwalthert merged commit 6e2b326 into r-lib:master Apr 6, 2018
2 of 4 checks passed
@lorenzwalthert lorenzwalthert deleted the long-strings-again branch Nov 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants