clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I5317fbcfbe69b8699e79b62cb855cb142a1d32c3
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 52ac0a1..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,14 @@
 AlignConsecutiveAssignments: false
 AlignConsecutiveDeclarations: false
 AlignEscapedNewlines: Right
-AlignOperands:   true
-AlignTrailingComments: true
+AlignOperands:  Align
+AlignTrailingComments:
+  Kind: Always
+  OverEmptyLines: 1
 AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
 AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
 AllowShortIfStatementsOnASingleLine: false
 AllowShortLoopsOnASingleLine: false
 AlwaysBreakAfterReturnType: None
@@ -36,12 +38,13 @@
   SplitEmptyFunction:   false
   SplitEmptyRecord:     false
   SplitEmptyNamespace:  false
+BreakAfterAttributes: Never
 BreakBeforeBinaryOperators: None
 BreakBeforeBraces: Custom
 BreakBeforeTernaryOperators: true
 BreakConstructorInitializers: AfterColon
 BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
 ColumnLimit:     80
 CommentPragmas:  '^ IWYU pragma:'
 CompactNamespaces: false
@@ -49,6 +52,7 @@
 ConstructorInitializerIndentWidth: 4
 ContinuationIndentWidth: 4
 Cpp11BracedListStyle: true
+DeriveLineEnding: false
 DerivePointerAlignment: false
 PointerAlignment: Left
 DisableFormat:   false
@@ -74,9 +78,13 @@
   - Regex:           '.*'
     Priority:        6
 IndentCaseLabels: true
+IndentRequiresClause: true
 IndentWidth:     4
 IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
 MaxEmptyLinesToKeep: 1
@@ -84,13 +92,19 @@
 ObjCBlockIndentWidth: 2
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
 PenaltyBreakBeforeFirstCallParameter: 19
 PenaltyBreakComment: 300
 PenaltyBreakFirstLessLess: 120
 PenaltyBreakString: 1000
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
 ReflowComments:  true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
 SortIncludes:    true
 SortUsingDeclarations: true
 SpaceAfterCStyleCast: false
diff --git a/test/buffer_service_test.cpp b/test/buffer_service_test.cpp
index 602dfcc..0464bf2 100644
--- a/test/buffer_service_test.cpp
+++ b/test/buffer_service_test.cpp
@@ -38,8 +38,7 @@
 struct ConfigInTest
 {
     Config config;
-    ConfigInTest() : config()
-    {}
+    ConfigInTest() : config() {}
 };
 
 class BufferServiceTest : public Test, public ConfigInTest, public BufferService
@@ -56,7 +55,7 @@
 
   protected:
     // Set hostConsole firstly read specified data and then read nothing.
-    void setHostConsoleOnce(char const* data, size_t len)
+    void setHostConsoleOnce(const char* data, size_t len)
     {
         EXPECT_CALL(hostConsoleMock, read(_, Le(consoleReadMaxSize)))
             .WillOnce(DoAll(SetArrayArgument<0>(data, data + len), Return(len)))
@@ -104,7 +103,6 @@
 
 TEST_F(BufferServiceTest, ReadConsoleOk)
 {
-
     setHostConsoleOnce(firstDatagram, strlen(firstDatagram));
     EXPECT_CALL(logBufferMock,
                 append(StrEq(firstDatagram), Eq(strlen(firstDatagram))))
diff --git a/test/file_storage_mock.hpp b/test/file_storage_mock.hpp
index 449ab29..938b319 100644
--- a/test/file_storage_mock.hpp
+++ b/test/file_storage_mock.hpp
@@ -10,7 +10,6 @@
 class FileStorageMock : public FileStorage
 {
   public:
-    FileStorageMock() : FileStorage("/tmp", "fake", -1)
-    {}
+    FileStorageMock() : FileStorage("/tmp", "fake", -1) {}
     MOCK_METHOD(std::string, save, (const LogBuffer& buf), (const override));
 };
diff --git a/test/file_storage_test.cpp b/test/file_storage_test.cpp
index ba74bd4..9682d50 100644
--- a/test/file_storage_test.cpp
+++ b/test/file_storage_test.cpp
@@ -26,8 +26,8 @@
         fs::remove_all(logPath);
     }
 
-    const fs::path logPath =
-        fs::temp_directory_path() / "file_storage_test_out";
+    const fs::path logPath = fs::temp_directory_path() /
+                             "file_storage_test_out";
 };
 
 TEST_F(FileStorageTest, InvalidPath)
diff --git a/test/host_console_mock.hpp b/test/host_console_mock.hpp
index 3b71c3c..fb00050 100644
--- a/test/host_console_mock.hpp
+++ b/test/host_console_mock.hpp
@@ -10,8 +10,7 @@
 class HostConsoleMock : public HostConsole
 {
   public:
-    HostConsoleMock() : HostConsole("")
-    {}
+    HostConsoleMock() : HostConsole("") {}
     MOCK_METHOD(void, connect, (), (override));
     MOCK_METHOD(size_t, read, (char* buf, size_t sz), (const, override));
     // Returns a fixed integer for testing.
diff --git a/test/log_buffer_mock.hpp b/test/log_buffer_mock.hpp
index f53fa87..b1ddd0e 100644
--- a/test/log_buffer_mock.hpp
+++ b/test/log_buffer_mock.hpp
@@ -10,8 +10,7 @@
 class LogBufferMock : public LogBuffer
 {
   public:
-    LogBufferMock() : LogBuffer(-1, -1)
-    {}
+    LogBufferMock() : LogBuffer(-1, -1) {}
     MOCK_METHOD(void, append, (const char* data, size_t sz), (override));
     MOCK_METHOD(void, setFullHandler, (std::function<void()> cb), (override));
     MOCK_METHOD(bool, empty, (), (const, override));
diff --git a/test/stream_service_test.cpp b/test/stream_service_test.cpp
index ab62c78..17ec64f 100644
--- a/test/stream_service_test.cpp
+++ b/test/stream_service_test.cpp
@@ -68,15 +68,15 @@
         sa.sun_family = AF_UNIX;
         memcpy(sa.sun_path, socketPath, sizeof(socketPath) - 1);
         sa.sun_path[sizeof(socketPath) - 1] = '\0';
-        const socklen_t len =
-            sizeof(sa) - sizeof(sa.sun_path) + sizeof(socketPath) - 1;
+        const socklen_t len = sizeof(sa) - sizeof(sa.sun_path) +
+                              sizeof(socketPath) - 1;
         ASSERT_NE(
             bind(serverSocket, reinterpret_cast<const sockaddr*>(&sa), len),
             -1);
     }
 
     // Set hostConsole firstly read specified data and then read nothing.
-    void setHostConsoleOnce(char const* data, size_t len)
+    void setHostConsoleOnce(const char* data, size_t len)
     {
         EXPECT_CALL(hostConsoleMock, read(_, Le(consoleReadMaxSize)))
             .WillOnce(DoAll(SetArrayArgument<0>(data, data + len), Return(len)))