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: I17e98a098b8983f5f20f563f85656cfb0beb0d4b
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index ef6f54e..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
@@ -108,7 +122,7 @@
 SpacesInCStyleCastParentheses: false
 SpacesInParentheses: false
 SpacesInSquareBrackets: false
-Standard:        Cpp11
+Standard:        Latest
 TabWidth:        4
 UseTab:          Never
 ...
diff --git a/include/host_error_event_monitor.hpp b/include/host_error_event_monitor.hpp
index 86c8776..5f6242d 100644
--- a/include/host_error_event_monitor.hpp
+++ b/include/host_error_event_monitor.hpp
@@ -66,8 +66,8 @@
     }
     std::string eventName = objectPath.substr(objectPath.find_last_of('/') + 1,
                                               objectPath.length());
-    std::string message =
-        (assert) ? eventName + " Asserted" : eventName + " De-Asserted";
+    std::string message = (assert) ? eventName + " Asserted"
+                                   : eventName + " De-Asserted";
     uint8_t selType = (msgInterface.ends_with("ThermalTrip")) ? 0x01 : 0x00;
 
     std::vector<uint8_t> selData{selType, 0xff, 0xff};
@@ -87,7 +87,7 @@
             "HostErrorMonitor.Processor." +
                 iter->first + "'",
             [conn, iter](sdbusplus::message_t& msg) {
-                hostErrorEventMonitor(msg);
+            hostErrorEventMonitor(msg);
             });
     }
 }
diff --git a/include/pulse_event_monitor.hpp b/include/pulse_event_monitor.hpp
index 54fdd56..3d53720 100644
--- a/include/pulse_event_monitor.hpp
+++ b/include/pulse_event_monitor.hpp
@@ -74,4 +74,4 @@
         std::move(pulseEventMatcherCallback));
 
     return pulseEventMatcher;
-}
\ No newline at end of file
+}
diff --git a/include/sel_logger.hpp b/include/sel_logger.hpp
index 35f8b95..6e20acc 100644
--- a/include/sel_logger.hpp
+++ b/include/sel_logger.hpp
@@ -17,14 +17,14 @@
 #pragma once
 #include <filesystem>
 
-static constexpr char const* ipmiSelObject = "xyz.openbmc_project.Logging.IPMI";
-static constexpr char const* ipmiSelPath = "/xyz/openbmc_project/Logging/IPMI";
-static constexpr char const* ipmiSelAddInterface =
+static constexpr const char* ipmiSelObject = "xyz.openbmc_project.Logging.IPMI";
+static constexpr const char* ipmiSelPath = "/xyz/openbmc_project/Logging/IPMI";
+static constexpr const char* ipmiSelAddInterface =
     "xyz.openbmc_project.Logging.IPMI";
 
 // ID string generated using journalctl to include in the MESSAGE_ID field for
 // SEL entries.  Helps with filtering SEL entries in the journal.
-static constexpr char const* selMessageId = "b370836ccf2f4850ac5bee185b77893a";
+static constexpr const char* selMessageId = "b370836ccf2f4850ac5bee185b77893a";
 static constexpr int selPriority = 5; // notice
 static constexpr uint8_t selSystemType = 0x02;
 static constexpr uint16_t selBMCGenID = 0x0020;
diff --git a/include/sensorutils.hpp b/include/sensorutils.hpp
index d7fee6d..af979b0 100644
--- a/include/sensorutils.hpp
+++ b/include/sensorutils.hpp
@@ -336,8 +336,8 @@
     int8_t bExp = 0;
     bool bSigned = false;
 
-    bool result =
-        getSensorAttributes(max, min, mValue, rExp, bValue, bExp, bSigned);
+    bool result = getSensorAttributes(max, min, mValue, rExp, bValue, bExp,
+                                      bSigned);
     if (!result)
     {
         throw std::runtime_error("Illegal sensor attributes");
diff --git a/include/threshold_alarm_event_monitor.hpp b/include/threshold_alarm_event_monitor.hpp
index 0de281d..bdfd3a9 100644
--- a/include/threshold_alarm_event_monitor.hpp
+++ b/include/threshold_alarm_event_monitor.hpp
@@ -209,8 +209,8 @@
                   << "\n";
         return;
     }
-    double thresholdVal =
-        std::visit(ipmi::VariantToDoubleVisitor(), thresholdValue);
+    double thresholdVal = std::visit(ipmi::VariantToDoubleVisitor(),
+                                     thresholdValue);
 
     double scale = 0;
     auto findScale = sensorValue.find("Scale");
@@ -254,7 +254,7 @@
             static_cast<sdbusplus::bus_t&>(*conn),
             "type='signal',member=" + iter->first,
             [conn, iter](sdbusplus::message_t& msg) {
-                generateEvent(iter->first, conn, msg);
+            generateEvent(iter->first, conn, msg);
             });
     }
 }
diff --git a/include/threshold_event_monitor.hpp b/include/threshold_event_monitor.hpp
index 6943d28..61e4690 100644
--- a/include/threshold_event_monitor.hpp
+++ b/include/threshold_event_monitor.hpp
@@ -179,15 +179,15 @@
                       << msg.get_path() << "\n";
             return;
         }
-        double thresholdVal =
-            std::visit(ipmi::VariantToDoubleVisitor(), thresholdValue);
+        double thresholdVal = std::visit(ipmi::VariantToDoubleVisitor(),
+                                         thresholdValue);
 
         double scale = 0;
         auto findScale = sensorValue.find("Scale");
         if (findScale != sensorValue.end())
         {
-            scale =
-                std::visit(ipmi::VariantToDoubleVisitor(), findScale->second);
+            scale = std::visit(ipmi::VariantToDoubleVisitor(),
+                               findScale->second);
             thresholdVal *= std::pow(10, scale);
         }
         try
@@ -202,8 +202,8 @@
 
         std::string threshold;
         std::string direction;
-        std::string redfishMessageID =
-            "OpenBMC." + openBMCMessageRegistryVersion;
+        std::string redfishMessageID = "OpenBMC." +
+                                       openBMCMessageRegistryVersion;
         enum EventType
         {
             eventNone,
diff --git a/src/sel_logger.cpp b/src/sel_logger.cpp
index b298817..5fd8f0f 100644
--- a/src/sel_logger.cpp
+++ b/src/sel_logger.cpp
@@ -276,12 +276,12 @@
             return selAddSystemRecord(message, path, selData, assert, genId);
         });
     // Add a new OEM SEL entry
-    ifaceAddSel->register_method(
-        "IpmiSelAddOem",
-        [](const std::string& message, const std::vector<uint8_t>& selData,
-           const uint8_t& recordType) {
-            return selAddOemRecord(message, selData, recordType);
-        });
+    ifaceAddSel->register_method("IpmiSelAddOem",
+                                 [](const std::string& message,
+                                    const std::vector<uint8_t>& selData,
+                                    const uint8_t& recordType) {
+        return selAddOemRecord(message, selData, recordType);
+    });
 
 #ifdef SEL_LOGGER_CLEARS_SEL
 #ifndef SEL_LOGGER_SEND_TO_LOGGING_SERVICE