-
Notifications
You must be signed in to change notification settings - Fork 635
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
Add wrapMultilineConditionalAssignment
rule to wrap if / switch expressions to new line after assignment operator
#1574
Add wrapMultilineConditionalAssignment
rule to wrap if / switch expressions to new line after assignment operator
#1574
Conversation
bd1638d
to
57c75bd
Compare
57c75bd
to
682eca4
Compare
wrapMultilineConditionalAssignment
rule to wrap if / switch expressions on to line after assignment operatorwrapMultilineConditionalAssignment
rule to wrap if / switch expressions to new line after assignment operator
1aa5771
to
b04a159
Compare
…ase it's too long or multiline
b04a159
to
a208d66
Compare
94f6d52
to
b0f4fcb
Compare
b0f4fcb
to
0a56702
Compare
ca6e3ed
to
e6b98ed
Compare
@nicklockwood, all of the tests are passing now on this PR now that I found a solution for #1575 |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #1574 +/- ##
===========================================
+ Coverage 94.99% 95.07% +0.08%
===========================================
Files 20 20
Lines 21845 21969 +124
===========================================
+ Hits 20751 20887 +136
+ Misses 1094 1082 -12 ☔ View full report in Codecov by Sentry. |
Impressive! The code coverage bot highlighted a case I forgot to add a test for. Added a test for it in 727b791 |
I ran both the |
d8c8a48
to
f02f7b6
Compare
…ressions to new line after assignment operator (#1574)
…ressions to new line after assignment operator (#1574)
…ressions to new line after assignment operator (#1574)
…ressions to new line after assignment operator (#1574)
…ressions to new line after assignment operator (#1574)
…ressions to new line after assignment operator (#1574)
…ressions to new line after assignment operator (#1574)
When discussing adopting the
conditionalAssignment
rule within Airbnb, we decided that the resulting code is easier to read if the if / switch expression is wrapped to a new line:This is also the formatting that is used in most of the examples from the Swift Evolution proposal that introduced this feature (SE-0380), so seems likely to be a pretty common formatting preference.
This PR implements a
wrapMultilineConditionalAssignment
that wraps conditional assignment expressions in this way.This PR also updates the
indent
rule to support this formatting.