gaodayue commented on issue #2792: Reformat BE code 1/7 URL: https://github.com/apache/incubator-doris/pull/2792#issuecomment-576000358 I tried [impala's](https://github.com/apache/impala/blob/master/.clang-format) `IncludeCategories` on `be/src/agent/utils.cpp`, the result is ``` #include "agent/utils.h" #include <errno.h> #include <netdb.h> #include <unistd.h> #include <cstdio> #include <fstream> #include <iostream> #include <sstream> #include <arpa/inet.h> #include <boost/filesystem.hpp> #include <netinet/in.h> #include <rapidjson/document.h> #include <rapidjson/rapidjson.h> #include <rapidjson/stringbuffer.h> #include <rapidjson/writer.h> #include <sys/socket.h> #include <sys/wait.h> #include <thrift/Thrift.h> #include <thrift/transport/TSocket.h> #include <thrift/transport/TTransportException.h> #include <thrift/transport/TTransportUtils.h> #include "common/status.h" #include "gen_cpp/AgentService_types.h" #include "gen_cpp/FrontendService.h" #include "gen_cpp/HeartbeatService_types.h" #include "gen_cpp/Status_types.h" #include "olap/utils.h" #include "runtime/exec_env.h" ``` This is close to what we want but not idea because pattern matching could fail in some cases. For example `<cstdio>` and `<sys/wait.h>` should be C header instead of C++ or third-party libraries. As a result, I think we can just trust our developer to group includes and only use `IncludeBlocks: Preserve` to sort inside existing group. The result is ``` #include "agent/utils.h" #include <arpa/inet.h> #include <errno.h> #include <netdb.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/wait.h> #include <unistd.h> #include <cstdio> #include <fstream> #include <iostream> #include <sstream> #include <rapidjson/document.h> #include <rapidjson/rapidjson.h> #include <rapidjson/stringbuffer.h> #include <rapidjson/writer.h> #include <thrift/Thrift.h> #include <thrift/transport/TSocket.h> #include <thrift/transport/TTransportException.h> #include <thrift/transport/TTransportUtils.h> #include <boost/filesystem.hpp> #include "common/status.h" #include "gen_cpp/AgentService_types.h" #include "gen_cpp/FrontendService.h" #include "gen_cpp/HeartbeatService_types.h" #include "gen_cpp/Status_types.h" #include "olap/utils.h" #include "runtime/exec_env.h" ``` Which is acceptable for 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org