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: I44441096113929ce96eb1439e2932e6ff3c87f27
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index ca6040f..16860dc 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -21,25 +21,26 @@
 #include "dbus-sdr/storagecommands.hpp"
 #include "entity_map_json.hpp"
 
-#include <algorithm>
-#include <array>
 #include <boost/algorithm/string.hpp>
 #include <boost/container/flat_map.hpp>
+#include <ipmid/api.hpp>
+#include <ipmid/types.hpp>
+#include <ipmid/utils.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+#include <user_channel/channel_layer.hpp>
+
+#include <algorithm>
+#include <array>
 #include <chrono>
 #include <cmath>
 #include <cstring>
 #include <iostream>
-#include <ipmid/api.hpp>
-#include <ipmid/types.hpp>
-#include <ipmid/utils.hpp>
 #include <map>
 #include <memory>
 #include <optional>
-#include <phosphor-logging/log.hpp>
-#include <sdbusplus/bus.hpp>
 #include <stdexcept>
 #include <string>
-#include <user_channel/channel_layer.hpp>
 #include <utility>
 #include <variant>
 
@@ -131,11 +132,11 @@
     "type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
     "sensors/'",
     [](sdbusplus::message_t&) {
-        getSensorTree().clear();
-        getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
-        sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
-                         std::chrono::system_clock::now().time_since_epoch())
-                         .count();
+    getSensorTree().clear();
+    getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
+    sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
+                     std::chrono::system_clock::now().time_since_epoch())
+                     .count();
     });
 
 static sdbusplus::bus::match_t sensorRemoved(
@@ -143,11 +144,11 @@
     "type='signal',member='InterfacesRemoved',arg0path='/xyz/openbmc_project/"
     "sensors/'",
     [](sdbusplus::message_t&) {
-        getSensorTree().clear();
-        getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
-        sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
-                            std::chrono::system_clock::now().time_since_epoch())
-                            .count();
+    getSensorTree().clear();
+    getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
+    sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
+                        std::chrono::system_clock::now().time_since_epoch())
+                        .count();
     });
 
 // this keeps track of deassertions for sensor event status command. A
@@ -161,43 +162,41 @@
     "type='signal',member='PropertiesChanged',interface='org.freedesktop.DBus."
     "Properties',arg0namespace='xyz.openbmc_project.Sensor.Threshold'",
     [](sdbusplus::message_t& m) {
-        boost::container::flat_map<std::string, std::variant<bool, double>>
-            values;
-        m.read(std::string(), values);
+    boost::container::flat_map<std::string, std::variant<bool, double>> values;
+    m.read(std::string(), values);
 
-        auto findAssert =
-            std::find_if(values.begin(), values.end(), [](const auto& pair) {
-                return pair.first.find("Alarm") != std::string::npos;
-            });
-        if (findAssert != values.end())
+    auto findAssert = std::find_if(values.begin(), values.end(),
+                                   [](const auto& pair) {
+        return pair.first.find("Alarm") != std::string::npos;
+    });
+    if (findAssert != values.end())
+    {
+        auto ptr = std::get_if<bool>(&(findAssert->second));
+        if (ptr == nullptr)
         {
-            auto ptr = std::get_if<bool>(&(findAssert->second));
-            if (ptr == nullptr)
-            {
-                phosphor::logging::log<phosphor::logging::level::ERR>(
-                    "thresholdChanged: Assert non bool");
-                return;
-            }
-            if (*ptr)
+            phosphor::logging::log<phosphor::logging::level::ERR>(
+                "thresholdChanged: Assert non bool");
+            return;
+        }
+        if (*ptr)
+        {
+            phosphor::logging::log<phosphor::logging::level::INFO>(
+                "thresholdChanged: Assert",
+                phosphor::logging::entry("SENSOR=%s", m.get_path()));
+            thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
+        }
+        else
+        {
+            auto& value = thresholdDeassertMap[m.get_path()][findAssert->first];
+            if (value)
             {
                 phosphor::logging::log<phosphor::logging::level::INFO>(
-                    "thresholdChanged: Assert",
+                    "thresholdChanged: deassert",
                     phosphor::logging::entry("SENSOR=%s", m.get_path()));
-                thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
-            }
-            else
-            {
-                auto& value =
-                    thresholdDeassertMap[m.get_path()][findAssert->first];
-                if (value)
-                {
-                    phosphor::logging::log<phosphor::logging::level::INFO>(
-                        "thresholdChanged: deassert",
-                        phosphor::logging::entry("SENSOR=%s", m.get_path()));
-                    value = *ptr;
-                }
+                value = *ptr;
             }
         }
+    }
     });
 
 namespace sensor
@@ -257,7 +256,6 @@
     }
     if (warning != sensorMap.end())
     {
-
         auto lower = warning->second.find("WarningLow");
         auto upper = warning->second.find("WarningHigh");
         if (lower != warning->second.end())
@@ -586,7 +584,6 @@
     if (static_cast<ipmi::EChannelMediumType>(chInfo.mediumType) ==
         ipmi::EChannelMediumType::systemInterface)
     {
-
         p.unpack(sysgeneratorID, evmRev, sensorType, sensorNum, eventType,
                  eventData1, eventData2, eventData3);
         // Refer to IPMI Spec Table 32: SEL Event Records
@@ -597,7 +594,6 @@
     }
     else
     {
-
         p.unpack(evmRev, sensorType, sensorNum, eventType, eventData1,
                  eventData2, eventData3);
         // Refer to IPMI Spec Table 32: SEL Event Records
@@ -635,8 +631,8 @@
     std::string path;
     std::vector<std::string> interfaces;
 
-    ipmi::Cc status =
-        getSensorConnection(ctx, sensorNumber, connection, path, &interfaces);
+    ipmi::Cc status = getSensorConnection(ctx, sensorNumber, connection, path,
+                                          &interfaces);
     if (status)
     {
         return ipmi::response(status);
@@ -664,8 +660,8 @@
             return ipmi::responseResponseError();
         }
 
-        auto value =
-            sensor::calculateValue(reading, sensorMap, sensorObject->second);
+        auto value = sensor::calculateValue(reading, sensorMap,
+                                            sensorObject->second);
         if (!value)
         {
             return ipmi::responseResponseError();
@@ -717,8 +713,8 @@
         // VR sensors are treated as a special case and we will not check the
         // write permission for VR sensors, since they always deemed writable
         // and permission table are not applied to VR sensors.
-        auto vrMode =
-            sensor::calculateVRMode(assertOffset, sensorObject->second);
+        auto vrMode = sensor::calculateVRMode(assertOffset,
+                                              sensorObject->second);
         if (!vrMode)
         {
             return ipmi::responseResponseError();
@@ -841,8 +837,8 @@
         return ipmi::responseResponseError();
     }
 
-    uint8_t value =
-        scaleIPMIValueFromDouble(reading, mValue, rExp, bValue, bExp, bSigned);
+    uint8_t value = scaleIPMIValueFromDouble(reading, mValue, rExp, bValue,
+                                             bExp, bSigned);
     uint8_t operation =
         static_cast<uint8_t>(IPMISensorReadingByte2::sensorScanningEnable);
     operation |=
@@ -1155,9 +1151,8 @@
 
             if (warningHigh != warningMap.end())
             {
-
-                double value =
-                    std::visit(VariantToDoubleVisitor(), warningHigh->second);
+                double value = std::visit(VariantToDoubleVisitor(),
+                                          warningHigh->second);
                 if (std::isfinite(value))
                 {
                     resp.warningHigh = scaleIPMIValueFromDouble(
@@ -1166,8 +1161,8 @@
             }
             if (warningLow != warningMap.end())
             {
-                double value =
-                    std::visit(VariantToDoubleVisitor(), warningLow->second);
+                double value = std::visit(VariantToDoubleVisitor(),
+                                          warningLow->second);
                 if (std::isfinite(value))
                 {
                     resp.warningLow = scaleIPMIValueFromDouble(
@@ -1184,8 +1179,8 @@
 
             if (criticalHigh != criticalMap.end())
             {
-                double value =
-                    std::visit(VariantToDoubleVisitor(), criticalHigh->second);
+                double value = std::visit(VariantToDoubleVisitor(),
+                                          criticalHigh->second);
                 if (std::isfinite(value))
                 {
                     resp.criticalHigh = scaleIPMIValueFromDouble(
@@ -1194,8 +1189,8 @@
             }
             if (criticalLow != criticalMap.end())
             {
-                double value =
-                    std::visit(VariantToDoubleVisitor(), criticalLow->second);
+                double value = std::visit(VariantToDoubleVisitor(),
+                                          criticalLow->second);
                 if (std::isfinite(value))
                 {
                     resp.criticalLow = scaleIPMIValueFromDouble(
@@ -1735,8 +1730,8 @@
     uint8_t bExpBits = bExp & 0x07;
 
     // move rExp and bExp into place
-    record.body.r_b_exponents =
-        (rExpSign << 7) | (rExpBits << 4) | (bExpSign << 3) | bExpBits;
+    record.body.r_b_exponents = (rExpSign << 7) | (rExpBits << 4) |
+                                (bExpSign << 3) | bExpBits;
 
     // Set the analog reading byte interpretation accordingly
     record.body.sensor_units_1 = (bSigned ? 1 : 0) << 7;
@@ -1760,8 +1755,8 @@
         sensorMap.find("xyz.openbmc_project.Sensor.ValueMutability");
     if (mutability != sensorMap.end())
     {
-        sensorSettable =
-            mappedVariant<bool>(mutability->second, "Mutable", false);
+        sensorSettable = mappedVariant<bool>(mutability->second, "Mutable",
+                                             false);
     }
     get_sdr::body::init_settable_state(sensorSettable, &record.body);
 
@@ -2058,9 +2053,9 @@
         ctx->lun = lun3;
     }
 
-    auto status =
-        getSensorConnection(ctx, static_cast<uint8_t>(sensNumFromRecID),
-                            connection, path, &interfaces);
+    auto status = getSensorConnection(ctx,
+                                      static_cast<uint8_t>(sensNumFromRecID),
+                                      connection, path, &interfaces);
     if (status)
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -2256,8 +2251,8 @@
         // Return the number of sensors attached to the LUN
         if ((ctx->lun == lun0) && (numSensors > 0))
         {
-            sdrCount =
-                (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN : numSensors;
+            sdrCount = (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN
+                                                       : numSensors;
         }
         else if ((ctx->lun == lun1) && (numSensors > maxSensorsPerLUN))
         {
@@ -2269,8 +2264,8 @@
         {
             if (numSensors <= maxIPMISensors)
             {
-                sdrCount =
-                    (numSensors - (2 * maxSensorsPerLUN)) & maxSensorsPerLUN;
+                sdrCount = (numSensors - (2 * maxSensorsPerLUN)) &
+                           maxSensorsPerLUN;
             }
             else
             {
@@ -2335,8 +2330,8 @@
         return ipmi::response(ret);
     }
 
-    uint16_t recordCount =
-        getNumberOfSensors() + fruCount + ipmi::storage::type12Count;
+    uint16_t recordCount = getNumberOfSensors() + fruCount +
+                           ipmi::storage::type12Count;
 
     uint8_t operationSupport = static_cast<uint8_t>(
         SdrRepositoryInfoOps::overflow); // write not supported
@@ -2454,8 +2449,8 @@
         return ipmi::responseSuccess(nextRecordId, record);
     }
 
-    size_t sdrLength =
-        sizeof(get_sdr::SensorDataRecordHeader) + hdr->record_length;
+    size_t sdrLength = sizeof(get_sdr::SensorDataRecordHeader) +
+                       hdr->record_length;
     if (sdrLength < (offset + bytesToRead))
     {
         bytesToRead = sdrLength - offset;