csharpier
csharpier copied to clipboard
Break InvocationExpression chain before breaking ArguementList
This prettier PR may help - https://github.com/prettier/prettier/pull/8063/files
These are a number of examples.
string signedRequest = htmlHelper.ViewContext.HttpContext.Request.Params[
"signed_request____________"
];
// should be
string signedRequest = htmlHelper.ViewContext.HttpContext.Request
.Params["signed_request____________"];
result[i / ReferenceFrameSize] = RenderTreeFrame.ComponentReferenceCapture(
0,
null__________,
0
);
ref var parentFrame = ref diffContext.NewTree[
newFrame.ComponentReferenceCaptureParentFrameIndexField
];
var newComponentInstance = (CaptureSetParametersComponent)oldTree.GetFrames().Array[
0
].Component;
parent = (ContainerNode)parent.Children[
childIndexAtCurrentDepth__________ + siblingIndex__________
];
configuration.EncryptionAlgorithmKeySize = (int)encryptionElement.Attribute(
"keyLength__________________"
)!;
But if we know the ArgumentList will break, I think this is preferred
var y = someList.Where(
o =>
someLongValue_______________________
&& theseShouldNotIndent_________________
&& theseShouldNotIndent_________________
> butThisOneShould_________________________________________
);
Probably related
// breaking after the = makes this look better
var cbTempSubkeys =
checked(_symmetricAlgorithmSubkeyLengthInBytes + _hmacAlgorithmSubkeyLengthInBytes);
// but then this looks better with checked next to =
var cbEncryptedData = checked(
cbCiphertext
- (
KEY_MODIFIER_SIZE_IN_BYTES
+ _symmetricAlgorithmBlockSizeInBytes
+ _hmacAlgorithmDigestLengthInBytes
)
);
httpContext.Response.Headers[
HeaderNames.XFrameOptions
] = "SAMEORIGIN1111111111111111111111";
// should be
httpContext.Response.Headers[HeaderNames.XFrameOptions]
= "SAMEORIGIN1111111111111111111111";
These all need to end up consistent too
var someLongValue_________________ = memberAccessExpression[
elementAccessExpression
].theMember______________________________;
var someLongValue_________________ = memberAccessExpression[
elementAccessExpression
].theMember______________________________();
var someLongValue_________________ = memberAccessExpression(
elementAccessExpression
).theMember______________________________;
var someLongValue_________________ = memberAccessExpression(elementAccessExpression)
.theMember______________________________();
some more examples
var node = FindToken(span.Start, findInsideTrivia).Parent.FirstAncestorOrSelf(
(a, span) => a.FullSpan.Contains(span),
span
);
var node = FindToken(span.Start, findInsideTrivia)
.Parent()
.FirstAncestorOrSelf((a, span) => a.FullSpan.Contains(span), span);
This is semi-related
HttpActionDescriptor actionDescriptorMock = new Mock<HttpActionDescriptor>()
{
CallBase = true
}.Object;
Related, we should abide by the rectangle rule in these situations
ValueProviderResult valueProviderResult = bindingContext
.ValueProvider
.GetValue(bindingContext.ModelName);
// vs
ValueProviderResult valueProviderResult =
bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
ValueProviderResult valueProviderResult = bindingContext
.ValueProvider
.SomeLongProperty____________________
.GetValue(bindingContext.ModelName);
// vs
ValueProviderResult valueProviderResult =
bindingContext
.ValueProvider
.SomeLongProperty____________________
.GetValue(bindingContext.ModelName);