csharpier
csharpier copied to clipboard
Return with ternary that contains a BinaryExpression ends up aligning everything on the left.
public class ClassName
{
private string GetShopperReference(string customerNumber)
{
return
adyenSettings.UseShipToNumberForVault
&& SiteContext.Current.ShipTo.CustomerSequence.IsNotBlank()
? SiteContext.Current.ShipTo.CustomerSequence
: customerNumber;
}
}
Should probably be something like
public class ClassName
{
private string GetShopperReference(string customerNumber)
{
return
adyenSettings.UseShipToNumberForVault
&& SiteContext.Current.ShipTo.CustomerSequence.IsNotBlank()
? SiteContext.Current.ShipTo.CustomerSequence
: customerNumber;
}
}
There doesn't seem to be a good way of dealing with this. These are some related cases.
Auto adding the ( ) would make it more readable, but we don't auto add them anywhere else right now.
Indenting the && someOther..... doesn't work well with the 2nd case below, because then == and && are aligned.
return
someLongBoolean________________________________________
&& someOtherLongBoolean____________________________________
? ifTrue
: ifFalse;
return
someLongCondition_________________________________________
== someThingElse______________________
&& someOtherLongCondition____________________________________
? trueValue________________________________
: falseValue_______________________________;
return (
someLongCondition____________________________________
&& someOtherLongCondition____________________________________
)
? trueValue________________________________
: falseValue_______________________________;
Although.... maybe this is feasible?
return someLongBoolean________________________________________
&& someOtherLongBoolean____________________________________
? ifTrue
: ifFalse;
return someLongCondition_________________________________________
== someThingElse______________________
&& someOtherLongCondition____________________________________
? trueValue________________________________
: falseValue_______________________________;
return (
someLongCondition____________________________________
&& someOtherLongCondition____________________________________
)
? trueValue________________________________
: falseValue_______________________________;