[SERVER-19147] prefer one arg per line to all args together on the subsequent line Created: 25/Jun/15  Updated: 15/Oct/19  Resolved: 15/Oct/19

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 3.1.4
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Matt Dannenberg Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Won't Fix Votes: 0
Labels: clang-format
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

I would like this opposite of this diff to be the case, as I find it greatly improves readability:

Running across 24 cpus
ERROR: Found diff for /home/dannenberg/work/server6071/mongo/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
To fix formatting errors, run /usr/bin/clang-format --style=file -i /home/dannenberg/work/server6071/mongo/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
---
+++
@@ -84,11 +84,8 @@
         timeout = hbRequest.second;
     }
 
-    const RemoteCommandRequest request(target,
-                                       "admin",
-                                       heartbeatObj,
-                                       BSON(rpc::kReplicationMetadataFieldName << 1),
-                                       timeout);
+    const RemoteCommandRequest request(
+        target, "admin", heartbeatObj, BSON(rpc::kReplicationMetadataFieldName << 1), timeout);
     const ReplicationExecutor::RemoteCommandCallbackFn callback =
         stdx::bind(&ReplicationCoordinatorImpl::_handleHeartbeatResponse,
                    this,
ERROR: Code Style does not match coding style



 Comments   
Comment by Mark Benvenuto [ 03/May/16 ]

Actually, this cannot be done with clang-format 3.8.0 as the option AllowAllParametersOfDeclarationOnNextLine is for declarations, not function calls. Since this cannot be done with clang-format 3.8.0, moving it to planned but not scheduled.

Comment by Mark Benvenuto [ 03/May/16 ]

Clang-format tries to put a function call on a single line if possible because we set AllowAllParametersOfDeclarationOnNextLine to true. I will put this up to vote.

Comment by Eric Milkie [ 01/Jul/15 ]

It becomes much less readable when you have nested parentheticals with commas, since you have to stare at the line carefully to determine which commas are delimiters for the top level list.

Comment by Martin Bligh [ 26/Jun/15 ]

Seems to me like that diff is actually good ... is just as readable and wastes far less screen whitespace.
One of the main objectives should be to fit a decent amount of code on the screen so you can comprehend it more easily.

Generated at Thu Feb 08 03:49:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.