clang-format: copy latest and re-format

clang-format-17 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: Iecd47831c4a1defc81f3e54332101dc48b0cb6ff
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d92a3f1..d43e884 100644
--- a/.clang-format
+++ b/.clang-format
@@ -14,26 +14,30 @@
 AllowShortBlocksOnASingleLine: Empty
 AllowShortCaseLabelsOnASingleLine: false
 AllowShortFunctionsOnASingleLine: Empty
-AllowShortIfStatementsOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: true
 AllowShortLoopsOnASingleLine: false
 AlwaysBreakAfterReturnType: None
 AlwaysBreakBeforeMultilineStrings: false
 AlwaysBreakTemplateDeclarations: Yes
 BinPackArguments: true
 BinPackParameters: true
+BitFieldColonSpacing: None
 BraceWrapping:
   AfterCaseLabel:  true
   AfterClass:      true
   AfterControlStatement: true
   AfterEnum:       true
+  AfterExternBlock: true
   AfterFunction:   true
   AfterNamespace:  true
   AfterObjCDeclaration: true
   AfterStruct:     true
   AfterUnion:      true
-  AfterExternBlock: true
   BeforeCatch:     true
   BeforeElse:      true
+  BeforeLambdaBody: false
+  BeforeWhile:     false
   IndentBraces:    false
   SplitEmptyFunction:   false
   SplitEmptyRecord:     false
@@ -48,17 +52,16 @@
 ColumnLimit:     80
 CommentPragmas:  '^ IWYU pragma:'
 CompactNamespaces: false
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
 ConstructorInitializerIndentWidth: 4
 ContinuationIndentWidth: 4
 Cpp11BracedListStyle: true
-DeriveLineEnding: false
 DerivePointerAlignment: false
-PointerAlignment: Left
 DisableFormat:   false
-ExperimentalAutoDetectBinPacking: false
 FixNamespaceComments: true
-ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
+ForEachMacros:
+  - foreach
+  - Q_FOREACH
+  - BOOST_FOREACH
 IncludeBlocks: Regroup
 IncludeCategories:
   - Regex:           '^[<"](gtest|gmock)'
@@ -78,6 +81,7 @@
   - Regex:           '.*'
     Priority:        6
 IndentCaseLabels: true
+IndentExternBlock: NoIndent
 IndentRequiresClause: true
 IndentWidth:     4
 IndentWrappedFunctionNames: true
@@ -92,6 +96,7 @@
 ObjCBlockIndentWidth: 2
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true
+PackConstructorInitializers: BinPack
 PenaltyBreakAssignment: 25
 PenaltyBreakBeforeFirstCallParameter: 19
 PenaltyBreakComment: 300
@@ -100,12 +105,13 @@
 PenaltyExcessCharacter: 1000000
 PenaltyReturnTypeOnItsOwnLine: 60
 PenaltyIndentedWhitespace: 0
+PointerAlignment: Left
 QualifierAlignment: Left
 ReferenceAlignment: Left
 ReflowComments:  true
 RequiresClausePosition: OwnLine
 RequiresExpressionIndentation: Keyword
-SortIncludes:    true
+SortIncludes: CaseSensitive
 SortUsingDeclarations: true
 SpaceAfterCStyleCast: false
 SpaceAfterTemplateKeyword: true
@@ -117,7 +123,7 @@
 SpaceBeforeRangeBasedForLoopColon: true
 SpaceInEmptyParentheses: false
 SpacesBeforeTrailingComments: 1
-SpacesInAngles:  false
+SpacesInAngles: Never
 SpacesInContainerLiterals: true
 SpacesInCStyleCastParentheses: false
 SpacesInParentheses: false
diff --git a/certs_manager.cpp b/certs_manager.cpp
index 6408f08..be1b98f 100644
--- a/certs_manager.cpp
+++ b/certs_manager.cpp
@@ -404,7 +404,7 @@
         std::find_if(installedCerts.begin(), installedCerts.end(),
                      [certificate](const std::unique_ptr<Certificate>& cert) {
         return (cert.get() == certificate);
-        });
+    });
     if (certIt != installedCerts.end())
     {
         installedCerts.erase(certIt);
@@ -481,8 +481,8 @@
     else
     {
         using namespace sdeventplus::source;
-        Child::Callback callback =
-            [this](Child& eventSource, const siginfo_t* si) {
+        Child::Callback callback = [this](Child& eventSource,
+                                          const siginfo_t* si) {
             eventSource.set_enabled(Enabled::On);
             if (si->si_status != 0)
             {
@@ -641,10 +641,9 @@
     const static std::array<const char*, 6> usageList = {
         "ServerAuthentication", "ClientAuthentication", "OCSPSigning",
         "Timestamping",         "CodeSigning",          "EmailProtection"};
-    auto it = std::find_if(usageList.begin(), usageList.end(),
-                           [&usage](const char* s) {
-        return (strcmp(s, usage.c_str()) == 0);
-    });
+    auto it = std::find_if(
+        usageList.begin(), usageList.end(),
+        [&usage](const char* s) { return (strcmp(s, usage.c_str()) == 0); });
     return it != usageList.end();
 }
 EVPPkeyPtr Manager::generateRSAKeyPair(const int64_t keyBitLength)
@@ -1117,7 +1116,7 @@
             installedCerts.begin(), installedCerts.end(),
             [&filePath, certToDrop](const std::unique_ptr<Certificate>& cert) {
         return cert.get() != certToDrop && cert->isSame(filePath);
-            }))
+    }))
     {
         return false;
     }
diff --git a/watch.cpp b/watch.cpp
index 933e5ab..e785265 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -75,26 +75,26 @@
 
     ioPtr = std::make_unique<sdeventplus::source::IO>(
         event, fd, EPOLLIN, [this](sdeventplus::source::IO&, int fd, uint32_t) {
-            constexpr int size = sizeof(struct inotify_event) + NAME_MAX + 1;
-            std::array<char, size> buffer{};
-            int length = read(fd, buffer.data(), buffer.size());
-            if (length >= static_cast<int>(sizeof(struct inotify_event)))
+        constexpr int size = sizeof(struct inotify_event) + NAME_MAX + 1;
+        std::array<char, size> buffer{};
+        int length = read(fd, buffer.data(), buffer.size());
+        if (length >= static_cast<int>(sizeof(struct inotify_event)))
+        {
+            struct inotify_event* notifyEvent =
+                reinterpret_cast<struct inotify_event*>(&buffer[0]);
+            if (notifyEvent->len)
             {
-                struct inotify_event* notifyEvent =
-                    reinterpret_cast<struct inotify_event*>(&buffer[0]);
-                if (notifyEvent->len)
+                if (watchFile == notifyEvent->name)
                 {
-                    if (watchFile == notifyEvent->name)
-                    {
-                        callback();
-                    }
+                    callback();
                 }
             }
-            else
-            {
-                lg2::error("Failed to read inotify event");
-            }
-        });
+        }
+        else
+        {
+            lg2::error("Failed to read inotify event");
+        }
+    });
 }
 
 void Watch::stopWatch()