-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format assignment expressions. (#1293)
- Loading branch information
1 parent
f043022
commit c5d20ba
Showing
2 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
40 columns | | ||
>>> Chained assignment. | ||
a=b=c; | ||
<<< | ||
a = b = c; | ||
>>> Compound assignment operators. | ||
a*=b/=c~/=d%=e; | ||
<<< | ||
a *= b /= c ~/= d %= e; | ||
>>> | ||
a+=b-=c; | ||
<<< | ||
a += b -= c; | ||
>>> | ||
a<<=b>>>=c>>=d; | ||
<<< | ||
a <<= b >>>= c >>= d; | ||
>>> | ||
a&=b^=c|=d; | ||
<<< | ||
a &= b ^= c |= d; | ||
>>> | ||
a??=b; | ||
<<< | ||
a ??= b; | ||
>>> Split after `=`. | ||
variableName = thisIsReallyQuiteAVeryLongVariableName; | ||
<<< | ||
variableName = | ||
thisIsReallyQuiteAVeryLongVariableName; | ||
>>> Prefer to split at "=" over infix operator. | ||
variableName = argument * argument + argument; | ||
<<< | ||
variableName = | ||
argument * argument + argument; | ||
>>> Prefer block-like splitting for collections. | ||
variableName = [element, element, element]; | ||
<<< | ||
variableName = [ | ||
element, | ||
element, | ||
element, | ||
]; | ||
>>> Prefer block-like splitting for function calls. | ||
variableName = function(argument, argument); | ||
<<< | ||
variableName = function( | ||
argument, | ||
argument, | ||
); | ||
>>> No block-like splitting for empty argument lists. | ||
variableNameExactLength____ = function(); | ||
<<< | ||
variableNameExactLength____ = | ||
function(); | ||
>>> No block-like splitting if function name doesn't fit. | ||
longVariableName = veryLongFunctionName_(argument); | ||
<<< | ||
longVariableName = | ||
veryLongFunctionName_(argument); | ||
>>> Indent block if function name doesn't fit and arguments split. | ||
longVariableName = veryLongFunctionName_(argument, another); | ||
<<< | ||
longVariableName = | ||
veryLongFunctionName_( | ||
argument, | ||
another, | ||
); |