-
Notifications
You must be signed in to change notification settings - Fork 70
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
Avoid spaces around ^ #308
Conversation
Codecov Report
@@ Coverage Diff @@
## master #308 +/- ##
==========================================
+ Coverage 91.35% 91.36% +0.01%
==========================================
Files 30 30
Lines 1399 1402 +3
==========================================
+ Hits 1278 1281 +3
Misses 121 121
Continue to review full report at Codecov.
|
Aren't we changing the defaults in |
I meant to change the default, the tidyverse style guide now contains the rules for |
I thought we change the default value in the function declaration of |
@@ -1 +1 @@ | |||
1 + +1 - 3 / 23 * 3 ^ 4 | |||
1 + +1 - 3 / 23 * 3 ^4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea why this happens:
styler::style_text("1 - 3 * 4 ^ 5", strict = FALSE)
#> 1 - 3 * 4 ^ 5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually what I'd expect because strict = FALSE
means no strict implementation, right? Or do you prefer to set the spaces to exactly zero around ^
even if strict = FALSE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the reason this might seem inconsistent with the other test is that there is no space around ^
in any of the other *-out.R files, but I think that is because in all *-in.R files, we always have x^k
(so no space in between) and hence the tests don't actually test whether x ^ k
is turned into x^k
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think as mentioned in the comment above, do you think strict = FALSE
should remove spaces around ^
? If yes, we need to adapt.
9e3effa
to
0c7e298
Compare
I've updated the code, because we're removing spaces for styler::style_text("1 : 10", strict = FALSE)
#> 1:10
styler::style_text("1 ^ 10", strict = FALSE)
#> 1^10
|
Great. It payed off to reduce some duplication and encapsulate common functionality in |
following tidyverse/style#46.