From 89736d4db35088dc962029b3d960bdbc2859d7c0 Mon Sep 17 00:00:00 2001 From: YunShu Date: Wed, 6 Sep 2023 16:03:55 +0800 Subject: [PATCH] style: add a rule to avoid formatting LOG_* macros (#259) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem were solved in this pull request? Issue Number: close https://github.com/oceanbase/miniob/issues/258 日志中的参数直接使用clang-format格式化,参数要么在一行,要么一个一行,或者尽量在一行,会比较丑。主要是因为日志的参数第一个format string,通常比较长,并且其含义特殊,参数需要分多行时,不应该作为“一类”放在同一行上。 --- .clang-format | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.clang-format b/.clang-format index 4b0d491..6b231cb 100644 --- a/.clang-format +++ b/.clang-format @@ -20,6 +20,8 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakTemplateDeclarations: true # false表示函数实参要么都在同一行,要么都各自一行 BinPackArguments: false +# 避免格式化 LOG_* 宏 +WhitespaceSensitiveMacros: ['LOG_DEFAULT', 'LOG_PANIC', 'LOG_ERROR', 'LOG_WARN', 'LOG_INFO', 'LOG_DEBUG', 'LOG_TRACE'] AlwaysBreakBeforeMultilineStrings: false BreakBeforeBinaryOperators: None BreakBeforeTernaryOperators: true -- GitLab