New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 713141 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

clang-format removes a newline in Java in method call, breaks alignment

Project Member Reported by awdf@chromium.org, Apr 19 2017

Issue description

clang-format produced code that (choose all that apply): 
- Riles my finely honed stylistic dander

Here's the code before formatting:
        assertThat(mMockNotificationManager.getNotificationChannelIds(),
                containsInAnyOrder(ChannelDefinitions.CHANNEL_ID_BROWSER,
                        ChannelDefinitions.CHANNEL_ID_DOWNLOADS,
                        ChannelDefinitions.CHANNEL_ID_INCOGNITO,
                        ChannelDefinitions.CHANNEL_ID_SITES,
                        ChannelDefinitions.CHANNEL_ID_MEDIA));

Here's the code after formatting:
        assertThat(mMockNotificationManager.getNotificationChannelIds(),
                containsInAnyOrder(ChannelDefinitions.CHANNEL_ID_BROWSER,
                        ChannelDefinitions.CHANNEL_ID_DOWNLOADS,
                        ChannelDefinitions.CHANNEL_ID_INCOGNITO,
                        ChannelDefinitions.CHANNEL_ID_SITES, ChannelDefinitions.CHANNEL_ID_MEDIA));

Here's how it ought to look:

        assertThat(mMockNotificationManager.getNotificationChannelIds(),
                containsInAnyOrder(ChannelDefinitions.CHANNEL_ID_BROWSER,
                        ChannelDefinitions.CHANNEL_ID_DOWNLOADS,
                        ChannelDefinitions.CHANNEL_ID_INCOGNITO,
                        ChannelDefinitions.CHANNEL_ID_SITES,
                        ChannelDefinitions.CHANNEL_ID_MEDIA));

Code review link for full files/context:
https://codereview.chromium.org/2832433002/diff/1/chrome/android/junit/src/org/chromium/chrome/browser/notifications/ChannelsUpdaterTest.java 
 

Comment 1 by awdf@chromium.org, Apr 19 2017

Description: Show this description

Comment 2 by thakis@chromium.org, Apr 19 2017

This is called "bin packing", see BinPackParameters / BinPackArguments in https://clang.llvm.org/docs/ClangFormatStyleOptions.html

We set that to false for c++ for chromium style (http://llvm-cs.pcc.me.uk/tools/clang/lib/Format/Format.cpp#660) but not for Java -- iirc the android style guide said to not do that somewhere.
Components: Tools
Labels: clang-format
Labels: Pri-2
Issue has a component, but no priority. Updating to have default priority (Pri-2)

Sign in to add a comment