gaodayue edited a comment on issue #2791: Refine .clang-format
URL: https://github.com/apache/incubator-doris/pull/2791#issuecomment-575579937
 
 
   > is it ok with SortIncludes diffs? It's true in Google style.
   
   Hi @vagetablechicken , thanks for the reply. I've tried using this file to 
reformat existing code, it turns out that the majority of diffs are not caused 
by `SortIncludes`, but `ColumnLimit` instead.
   
   Clang-format will try to put as many arguments as possible into the the same 
line if `ColumnLimit` is not reached or insert breaks otherwise. For example
   
   ```
   -    _create_tablet_workers = new TaskWorkerPool(
   -            TaskWorkerPool::TaskWorkerType::CREATE_TABLE,
   -            _exec_env,
   -            master_info);
   -    _drop_tablet_workers = new TaskWorkerPool(
   -            TaskWorkerPool::TaskWorkerType::DROP_TABLE,
   -            _exec_env,
   -            master_info);
   -    _push_workers = new TaskWorkerPool(
   -            TaskWorkerPool::TaskWorkerType::PUSH,
   -            _exec_env,
   -            master_info);
   -    _publish_version_workers = new TaskWorkerPool(
   -            TaskWorkerPool::TaskWorkerType::PUBLISH_VERSION,
   -            _exec_env,
   -            master_info);
   +    _create_tablet_workers = new 
TaskWorkerPool(TaskWorkerPool::TaskWorkerType::CREATE_TABLE,
   +                                                _exec_env, master_info);
   +    _drop_tablet_workers =
   +            new TaskWorkerPool(TaskWorkerPool::TaskWorkerType::DROP_TABLE, 
_exec_env, master_info);
   +    _push_workers =
   +            new TaskWorkerPool(TaskWorkerPool::TaskWorkerType::PUSH, 
_exec_env, master_info);
   +    _publish_version_workers = new 
TaskWorkerPool(TaskWorkerPool::TaskWorkerType::PUBLISH_VERSION,
   +                                                  _exec_env, master_info);
   ```
   
   Another major diff is caused by `AlignAfterOpenBracket`. For example with 
`AlignAfterOpenBracket` set to `Align`
   
   ```
   -void TaskWorkerPool::_alter_tablet(
   -        TaskWorkerPool* worker_pool_this,
   -        const TAgentTaskRequest& agent_task_req,
   -        int64_t signature,
   -        const TTaskType::type task_type,
   -        TFinishTaskRequest* finish_task_request) {
   +void TaskWorkerPool::_alter_tablet(TaskWorkerPool* worker_pool_this,
   +                                   const TAgentTaskRequest& agent_task_req, 
int64_t signature,
   +                                   const TTaskType::type task_type,
   +                                   TFinishTaskRequest* finish_task_request) 
{
   ```
   
   However I can't find a way to allow multiple align styles. Seems that one 
style must be chosen and `Align` is widely used and looks good to me.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to