From fbcb42e2a62ef6fe9c1cb974f179a8ab3ca42bc8 Mon Sep 17 00:00:00 2001 From: Lloyd-Pottiger <60744015+Lloyd-Pottiger@users.noreply.github.com> Date: Tue, 25 Jun 2024 15:56:51 +0800 Subject: [PATCH] Format: insert Newline at EOF using clang-format-17 (#8929) ref pingcap/tiflash#6233 Signed-off-by: Lloyd-Pottiger --- .clang-format | 48 ++++++++++--------- dbms/src/Client/Connection.h | 1 - .../gtest_skippable_block_input_stream.cpp | 2 +- .../Storages/KVStore/Decode/RegionScanner.cpp | 2 +- dbms/src/Storages/KVStore/Read/Proxy.cpp | 2 +- .../KVStore/Read/ReadIndexDataNode.cpp | 2 +- .../KVStore/tests/gtest_async_tasks.cpp | 2 +- format-diff.py | 2 +- 8 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.clang-format b/.clang-format index 9114c3d650a..449c6e739b7 100644 --- a/.clang-format +++ b/.clang-format @@ -1,6 +1,6 @@ --- -BasedOnStyle: Google -Language: Cpp +BasedOnStyle: Google +Language: Cpp AlignAfterOpenBracket: AlwaysBreak AlignEscapedNewlines: Left AlignTrailingComments: false @@ -16,20 +16,20 @@ BinPackArguments: false BinPackParameters: false BreakBeforeBraces: Custom BraceWrapping: - AfterCaseLabel: true - AfterClass: true - AfterControlStatement: true - AfterEnum : true - AfterFunction : true - AfterNamespace : true - AfterStruct : true - AfterUnion : true - BeforeCatch : true - BeforeElse : true - IndentBraces : false - SplitEmptyFunction: false + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: false BreakConstructorInitializers: BeforeComma -BreakInheritanceList : BeforeComma +BreakInheritanceList: BeforeComma ColumnLimit: 120 ConstructorInitializerAllOnOneLineOrOnePerLine: false Cpp11BracedListStyle: true @@ -47,28 +47,31 @@ SpaceAfterTemplateKeyword: true Standard: c++20 TabWidth: 4 UseTab: Never +InsertNewlineAtEOF: true +InsertTrailingCommas: Wrapped +RemoveSemicolon: true # Not changed: AccessModifierOffset: -4 AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false -AlignOperands: false +AlignOperands: false AllowShortCaseLabelsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakBeforeMultilineStrings: false BreakBeforeBinaryOperators: All BreakBeforeTernaryOperators: true -CommentPragmas: '^ IWYU pragma:' +CommentPragmas: "^ IWYU pragma:" ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 DerivePointerAlignment: false -DisableFormat: false -ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -IndentWidth: 4 +DisableFormat: false +ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH] +IndentWidth: 4 IndentWrappedFunctionNames: false -MacroBlockBegin: '' -MacroBlockEnd: '' +MacroBlockBegin: "" +MacroBlockEnd: "" NamespaceIndentation: None ObjCBlockIndentWidth: 4 ObjCSpaceAfterProperty: true @@ -92,4 +95,3 @@ SpacesInSquareBrackets: false Language: Proto # Added to avoid annoying error message DisableFormat: true -... diff --git a/dbms/src/Client/Connection.h b/dbms/src/Client/Connection.h index b09c456d39b..df4b090c52d 100644 --- a/dbms/src/Client/Connection.h +++ b/dbms/src/Client/Connection.h @@ -126,7 +126,6 @@ class Connection : private boost::noncopyable } virtual ~Connection() = default; - ; /// Set throttler of network traffic. One throttler could be used for multiple connections to limit total traffic. void setThrottler(const ThrottlerPtr & throttler_) { throttler = throttler_; } diff --git a/dbms/src/Storages/DeltaMerge/tests/gtest_skippable_block_input_stream.cpp b/dbms/src/Storages/DeltaMerge/tests/gtest_skippable_block_input_stream.cpp index 0949032bc8d..5ad99877c3c 100644 --- a/dbms/src/Storages/DeltaMerge/tests/gtest_skippable_block_input_stream.cpp +++ b/dbms/src/Storages/DeltaMerge/tests/gtest_skippable_block_input_stream.cpp @@ -467,4 +467,4 @@ try } CATCH -} // namespace DB::DM::tests \ No newline at end of file +} // namespace DB::DM::tests diff --git a/dbms/src/Storages/KVStore/Decode/RegionScanner.cpp b/dbms/src/Storages/KVStore/Decode/RegionScanner.cpp index 8eb9be8cd74..d7e8398cc19 100644 --- a/dbms/src/Storages/KVStore/Decode/RegionScanner.cpp +++ b/dbms/src/Storages/KVStore/Decode/RegionScanner.cpp @@ -82,4 +82,4 @@ RegionDataReadInfo Region::CommittedScanner::next() peeked.reset(); return res; } -} // namespace DB \ No newline at end of file +} // namespace DB diff --git a/dbms/src/Storages/KVStore/Read/Proxy.cpp b/dbms/src/Storages/KVStore/Read/Proxy.cpp index 6a416cb8953..667ed4d7739 100644 --- a/dbms/src/Storages/KVStore/Read/Proxy.cpp +++ b/dbms/src/Storages/KVStore/Read/Proxy.cpp @@ -130,4 +130,4 @@ bool TiFlashRaftProxyHelper::pollTimerTask(TimerTask & task, RawVoidPtr waker) c { return fn_poll_timer_task(task.ptr, waker); } -} // namespace DB \ No newline at end of file +} // namespace DB diff --git a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp index 7d5211b9745..2fd71d934eb 100644 --- a/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp +++ b/dbms/src/Storages/KVStore/Read/ReadIndexDataNode.cpp @@ -324,4 +324,4 @@ ReadIndexFuturePtr ReadIndexDataNode::insertTask(const kvrpcpb::ReadIndexRequest return task; } -} // namespace DB \ No newline at end of file +} // namespace DB diff --git a/dbms/src/Storages/KVStore/tests/gtest_async_tasks.cpp b/dbms/src/Storages/KVStore/tests/gtest_async_tasks.cpp index e988b1e40b9..01addf6e22d 100644 --- a/dbms/src/Storages/KVStore/tests/gtest_async_tasks.cpp +++ b/dbms/src/Storages/KVStore/tests/gtest_async_tasks.cpp @@ -340,4 +340,4 @@ try CATCH } // namespace tests -} // namespace DB \ No newline at end of file +} // namespace DB diff --git a/format-diff.py b/format-diff.py index 8f496894a65..0ffb6d74c2a 100755 --- a/format-diff.py +++ b/format-diff.py @@ -29,7 +29,7 @@ def run_cmd(cmd, show_cmd=False): return res def try_find_clang_format(exec_path): - candidates = ['clang-format-15', 'clang-format'] + candidates = ['clang-format'] if exec_path is not None: candidates.insert(0, exec_path) for c in candidates: