csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

Should a single parameter method call never break

Open belav opened this issue 4 years ago • 2 comments

When a method call has a single parameter, it is sometimes long enough to cause it to break like so

CallMethod(
    parameter
);

If there is just the single parameter, we could never break. But that could lead to some long lines. Test it out on the forked repos to see what kind of edge cases there are.

belav avatar Sep 29 '21 19:09 belav

As a user, I would be fine with either.

From a dev perspective, I would say no because I don't see enough benefits to warrant a special case.

respel avatar Oct 09 '21 21:10 respel

There are some interesting side effects that make me want to explore it more.

Ones that are better

string disableSuppressRedirect = appSettings.Get(
    AppSettingsSuppressFormsAuthenticationRedirectKey
);
// is now
string disableSuppressRedirect =
    appSettings.Get(AppSettingsSuppressFormsAuthenticationRedirectKey);

callMethod(
    () =>
    {
        return;
    }
);
// is now
callMethod(() =>
{
    return;
});

Ones that are worse

CompletedAsyncResult<T> completedResult = AsyncResult.End<CompletedAsyncResult<T>>(
    result
);
// is now
CompletedAsyncResult<T> completedResult = AsyncResult.End<
    CompletedAsyncResult<T>
>(result);

_security.Transport.ConfigureTransportProtectionAndAuthentication(
    _httpsTransportBindingElement
);
// could now get super long
_security.Transport.ConfigureTransportProtectionAndAuthentication(_httpsTransportBindingElement);

belav avatar Nov 01 '21 18:11 belav