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: I7801712fe34e10fec586d1e962afebd9ebcce46c
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 79a474d..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,6 +38,7 @@
   SplitEmptyFunction:   false
   SplitEmptyRecord:     false
   SplitEmptyNamespace:  false
+BreakAfterAttributes: Never
 BreakBeforeBinaryOperators: None
 BreakBeforeBraces: Custom
 BreakBeforeTernaryOperators: true
@@ -75,9 +78,13 @@
   - Regex:           '.*'
     Priority:        6
 IndentCaseLabels: true
+IndentRequiresClause: true
 IndentWidth:     4
 IndentWrappedFunctionNames: true
+InsertNewlineAtEOF: true
 KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
 MaxEmptyLinesToKeep: 1
@@ -85,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
@@ -111,6 +124,6 @@
 SpacesInSquareBrackets: false
 Standard:        Latest
 TabWidth:        4
-UseCRLF: false
 UseTab:          Never
 ...
+
diff --git a/mslverify/util.hpp b/mslverify/util.hpp
index 0dfe6e3..4c1ea00 100644
--- a/mslverify/util.hpp
+++ b/mslverify/util.hpp
@@ -118,9 +118,9 @@
 {
     using namespace std::literals::string_literals;
 
-    auto msg =
-        callMethod(bus, busName, path, "org.freedesktop.DBus.Properties"s,
-                   "Get"s, interface, property);
+    auto msg = callMethod(bus, busName, path,
+                          "org.freedesktop.DBus.Properties"s, "Get"s, interface,
+                          property);
     ::std::variant<Property> value;
     msg.read(value);
     return std::get<Property>(value);
diff --git a/mslverify/verify.cpp b/mslverify/verify.cpp
index 7347977..fd7b67d 100644
--- a/mslverify/verify.cpp
+++ b/mslverify/verify.cpp
@@ -27,8 +27,7 @@
 {
     std::string path;
 
-    explicit BusMeetsMSL(const std::string& p) : path(p)
-    {}
+    explicit BusMeetsMSL(const std::string& p) : path(p) {}
 
     auto operator()(const T& arg)
     {
diff --git a/src/callback.hpp b/src/callback.hpp
index 2ee8282..49d16a2 100644
--- a/src/callback.hpp
+++ b/src/callback.hpp
@@ -235,13 +235,13 @@
     {
         if (!timer)
         {
-            timer = std::make_unique<TimerType>(
-                sdeventplus::Event::get_default(),
-                // **INDENT-OFF**
-                [this](auto& /* source */) {
-                    // The timer uses the context saved on timer enable
-                    this->ConditionalCallback<CallbackAccess>::operator()(
-                        this->ctx);
+            timer =
+                std::make_unique<TimerType>(sdeventplus::Event::get_default(),
+                                            // **INDENT-OFF**
+                                            [this](auto& /* source */) {
+                // The timer uses the context saved on timer enable
+                this->ConditionalCallback<CallbackAccess>::operator()(
+                    this->ctx);
                 });
             // **INDENT-ON**
         }
diff --git a/src/count.hpp b/src/count.hpp
index f5c4bb3..efc00fe 100644
--- a/src/count.hpp
+++ b/src/count.hpp
@@ -55,27 +55,26 @@
     {
         // Count the number of properties in the index that
         // pass the condition specified in the config file.
-        auto count = std::count_if(
-            index.cbegin(), index.cend(),
-            [this](const auto& item)
-            // *INDENT-OFF*
+        auto count = std::count_if(index.cbegin(), index.cend(),
+                                   [this](const auto& item)
+                                   // *INDENT-OFF*
+                                   {
+            // Get the property value from storage[0],
+            // and save the op result in storage[1].
+            const auto& storage = std::get<storageIndex>(item.second);
+            // Don't count properties that don't exist.
+            if (!std::get<valueIndex>(storage.get()).has_value())
             {
-                // Get the property value from storage[0],
-                // and save the op result in storage[1].
-                const auto& storage = std::get<storageIndex>(item.second);
-                // Don't count properties that don't exist.
-                if (!std::get<valueIndex>(storage.get()).has_value())
-                {
-                    return false;
-                }
-                const auto& value =
-                    std::any_cast<T>(std::get<valueIndex>(storage.get()));
-                auto r = propertyOp(value);
+                return false;
+            }
+            const auto& value =
+                std::any_cast<T>(std::get<valueIndex>(storage.get()));
+            auto r = propertyOp(value);
 
-                std::get<resultIndex>(storage.get()) = r;
+            std::get<resultIndex>(storage.get()) = r;
 
-                return r;
-            });
+            return r;
+        });
         // *INDENT-ON*
 
         // Now apply the count condition to the count.
diff --git a/src/elog.hpp b/src/elog.hpp
index c02a20b..a7e4e1c 100644
--- a/src/elog.hpp
+++ b/src/elog.hpp
@@ -51,8 +51,7 @@
     ElogBase& operator=(const ElogBase&) = delete;
     ElogBase& operator=(ElogBase&&) = default;
     virtual ~ElogBase() = default;
-    ElogBase() : Callback()
-    {}
+    ElogBase() : Callback() {}
 
     /** @brief Callback interface implementation. */
     void operator()(Context ctx) override;
diff --git a/src/event.hpp b/src/event.hpp
index a4372c6..9292a99 100644
--- a/src/event.hpp
+++ b/src/event.hpp
@@ -29,8 +29,7 @@
     EventBase& operator=(const EventBase&) = delete;
     EventBase& operator=(EventBase&&) = default;
     virtual ~EventBase() = default;
-    EventBase(const PropertyIndex& index) : IndexedCallback(index)
-    {}
+    EventBase(const PropertyIndex& index) : IndexedCallback(index) {}
 
     /** @brief Callback interface implementation. */
     void operator()(Context ctx) override
diff --git a/src/event_manager.cpp b/src/event_manager.cpp
index 72813cc..c0c0c4a 100644
--- a/src/event_manager.cpp
+++ b/src/event_manager.cpp
@@ -62,8 +62,8 @@
                   std::chrono::system_clock::now().time_since_epoch())
                   .count();
 
-    auto objPath =
-        std::string(OBJ_EVENT) + '/' + eventName + '/' + std::to_string(id);
+    auto objPath = std::string(OBJ_EVENT) + '/' + eventName + '/' +
+                   std::to_string(id);
 
     // check for capping of the events,if cap reached then erase the oldest
     // event.
@@ -77,10 +77,10 @@
         fs::remove(eventPath, ec);
     }
 
-    auto event =
-        std::make_unique<Entry>(objPath,
-                                ms, // Milliseconds since 1970
-                                std::move(msg), std::move(additionalData));
+    auto event = std::make_unique<Entry>(objPath,
+                                         ms, // Milliseconds since 1970
+                                         std::move(msg),
+                                         std::move(additionalData));
     serialize(*event, eventName);
     eventQueue.push(std::move(event));
 }
@@ -109,8 +109,8 @@
         auto validEvent = false;
         auto timestamp = eventFile.path().filename().string();
         auto tsNum = std::stoll(timestamp);
-        auto objPath =
-            std::string(OBJ_EVENT) + '/' + eventName + '/' + timestamp;
+        auto objPath = std::string(OBJ_EVENT) + '/' + eventName + '/' +
+                       timestamp;
 
         auto event = std::make_unique<Entry>(objPath, tsNum);
         if (deserialize(eventFile.path(), *event))
diff --git a/src/pathwatch.cpp b/src/pathwatch.cpp
index 302e532..b823fe7 100644
--- a/src/pathwatch.cpp
+++ b/src/pathwatch.cpp
@@ -1 +1 @@
-#include "pathwatchimpl.hpp"
\ No newline at end of file
+#include "pathwatchimpl.hpp"
diff --git a/src/propertywatchimpl.hpp b/src/propertywatchimpl.hpp
index cf97f63..8861793 100644
--- a/src/propertywatchimpl.hpp
+++ b/src/propertywatchimpl.hpp
@@ -78,10 +78,10 @@
                 [this](auto& msg)
                 // *INDENT-OFF*
                 {
-                    std::string interface;
-                    msg.read(interface);
-                    auto path = msg.get_path();
-                    this->propertiesChanged(msg, path, interface);
+                std::string interface;
+                msg.read(interface);
+                auto path = msg.get_path();
+                this->propertiesChanged(msg, path, interface);
                 });
             // *INDENT-ON*
 
diff --git a/src/resolve_errors.hpp b/src/resolve_errors.hpp
index d8038ba..2133d1e 100644
--- a/src/resolve_errors.hpp
+++ b/src/resolve_errors.hpp
@@ -33,8 +33,7 @@
      * @param[in] callout - The callout whose errors need to be resolved.
      *                      Normally an inventory path.
      */
-    explicit ResolveCallout(const std::string& callout) : callout(callout)
-    {}
+    explicit ResolveCallout(const std::string& callout) : callout(callout) {}
 
     /**
      * @brief Callback interface to resolve errors
diff --git a/src/snmp_trap.hpp b/src/snmp_trap.hpp
index 5453eb4..6f07550 100644
--- a/src/snmp_trap.hpp
+++ b/src/snmp_trap.hpp
@@ -56,14 +56,12 @@
     SNMPTrap& operator=(const SNMPTrap&) = delete;
     SNMPTrap& operator=(SNMPTrap&&) = default;
     virtual ~SNMPTrap() = default;
-    SNMPTrap() : Callback()
-    {}
+    SNMPTrap() : Callback() {}
 
     /** @brief Callback interface implementation.
      *  @param[in] ctc - context.
      */
-    void operator()(Context /* ctx */) override
-    {}
+    void operator()(Context /* ctx */) override {}
 
     /** @brief Callback interface implementation.
      *  @param[in] ctc - context.
diff --git a/src/test/interfaceaddtest.cpp b/src/test/interfaceaddtest.cpp
index aabacf0..55086f0 100644
--- a/src/test/interfaceaddtest.cpp
+++ b/src/test/interfaceaddtest.cpp
@@ -27,4 +27,4 @@
 TEST(InterfaceAddTest, WatchSameSize)
 {
     ASSERT_EQ(expectedWatches.size(), pathwatches.size());
-}
\ No newline at end of file
+}