Skip to content
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

Break InvocationExpression chain before breaking ArguementList #451

Open
belav opened this issue Oct 11, 2021 · 6 comments
Open

Break InvocationExpression chain before breaking ArguementList #451

belav opened this issue Oct 11, 2021 · 6 comments

Comments

@belav
Copy link
Owner

belav commented Oct 11, 2021

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_________________________________________
        );
@belav
Copy link
Owner Author

belav commented Oct 11, 2021

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
            )
        );  

@belav
Copy link
Owner Author

belav commented Oct 19, 2021

        httpContext.Response.Headers[
            HeaderNames.XFrameOptions
        ] = "SAMEORIGIN1111111111111111111111";
// should be
        httpContext.Response.Headers[HeaderNames.XFrameOptions]
            = "SAMEORIGIN1111111111111111111111";

@belav
Copy link
Owner Author

belav commented Mar 7, 2022

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______________________________();

@belav
Copy link
Owner Author

belav commented Mar 12, 2022

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);

@belav
Copy link
Owner Author

belav commented Mar 26, 2022

This is semi-related

            HttpActionDescriptor actionDescriptorMock = new Mock<HttpActionDescriptor>()
            {
                CallBase = true
            }.Object;

@belav
Copy link
Owner Author

belav commented Oct 3, 2023

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant