You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/01/17 11:03:28 UTC

[GitHub] [incubator-doris] gaodayue edited a comment on issue #2791: Refine .clang-format

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org