You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Andrew Schwartzmeyer (JIRA)" <ji...@apache.org> on 2017/11/13 23:26:00 UTC

[jira] [Comment Edited] (MESOS-8174) clang-format incorrectly indents aggregate initializations

    [ https://issues.apache.org/jira/browse/MESOS-8174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16250480#comment-16250480 ] 

Andrew Schwartzmeyer edited comment on MESOS-8174 at 11/13/17 11:25 PM:
------------------------------------------------------------------------

I was surprised to see this formatting take place:

{noformat}
// 4: OK.
allocator->resourcesRecovered(
    frameworkId,
    agentId,
    resources,
    filters);

// 5: OK.
allocator->resourcesRecovered(
    frameworkId, agentId, resources, filters);
{noformat}

However, that example is from the style-guide. While patched {{clang-format}} preferred *5*, it's not (necessarily) a bug.


was (Author: andschwa):
I was surprised to see this formatting take place:

{noformat}
// 4: OK.
allocator->resourcesRecovered(
    frameworkId,
    agentId,
    resources,
    filters);

// 5: OK.
allocator->resourcesRecovered(
    frameworkId, agentId, resources, filters);
{noformat}

However, that example is from the style-guide. While patched {clang-format} preferred {5}, it's not (necessarily) a bug.

> clang-format incorrectly indents aggregate initializations
> ----------------------------------------------------------
>
>                 Key: MESOS-8174
>                 URL: https://issues.apache.org/jira/browse/MESOS-8174
>             Project: Mesos
>          Issue Type: Bug
>            Reporter: Benjamin Bannier
>              Labels: clang-format
>
> Aggregate initializations are incorrectly indented. I would expect the following indention,
> {code}
> Foo bar{
>     123,
>     456,
>     789};
> {code}
> Instead this is indented as
> {code}
> Foo bar{123,
>         456,
>         789};
> {code}
> Forcing a line break after the opening curly incorrectly indents the arguments with two instead of four spaces,
> {code}
> Foo bar{
>   123,
>   456,
>   789};
> {code}
> The [Google C++ style guide|https://google.github.io/styleguide/cppguide.html#Braced_Initializer_List_Format] suggests to
> {quote}
> Format a braced initializer list exactly like you would format a function call in its place.
> {quote}
> and our style guide demands
> {quote}
> Newline when calling or defining a function: indent with four spaces.
> {quote}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)