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: I3edadffec0ea11e0a52d9b060167e9a9a38f1972
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/device.hpp b/device.hpp
index 16056a7..d3d23d4 100644
--- a/device.hpp
+++ b/device.hpp
@@ -30,8 +30,7 @@
      * @param name - the device name
      * @param inst - the device instance
      */
-    Device(const std::string& name, size_t inst) : name(name), instance(inst)
-    {}
+    Device(const std::string& name, size_t inst) : name(name), instance(inst) {}
 
     /**
      * Returns the instance number
@@ -59,8 +58,7 @@
      * the chip is in error state.  Override if functionality
      * is required
      */
-    virtual void onFailure()
-    {}
+    virtual void onFailure() {}
 
     /**
      * Pure virtual function to clear faults on the device
diff --git a/file.hpp b/file.hpp
index e23c3ce..54b98fc 100644
--- a/file.hpp
+++ b/file.hpp
@@ -27,8 +27,7 @@
      *
      * @param[in] fd - File descriptor
      */
-    FileDescriptor(int fd) : fd(fd)
-    {}
+    FileDescriptor(int fd) : fd(fd) {}
 
     ~FileDescriptor()
     {
diff --git a/pmbus.cpp b/pmbus.cpp
index aca2d49..d7e8fc2 100644
--- a/pmbus.cpp
+++ b/pmbus.cpp
@@ -243,8 +243,8 @@
     {
         std::vector<uint8_t> data(length, 0);
 
-        auto bytes =
-            fread(data.data(), sizeof(decltype(data[0])), length, file.get());
+        auto bytes = fread(data.data(), sizeof(decltype(data[0])), length,
+                           file.get());
 
         if (bytes != length)
         {
diff --git a/power-sequencer/ucd90160.cpp b/power-sequencer/ucd90160.cpp
index 773b22c..a83e997 100644
--- a/power-sequencer/ucd90160.cpp
+++ b/power-sequencer/ucd90160.cpp
@@ -328,7 +328,6 @@
 
 bool UCD90160::doExtraAnalysis(const ucd90160::GPIConfig& config)
 {
-
     auto type = std::get<ucd90160::extraAnalysisField>(config);
     if (type == ucd90160::extraAnalysisType::none)
     {
diff --git a/power-sequencer/ucd90160.hpp b/power-sequencer/ucd90160.hpp
index 6ad85f2..3132701 100644
--- a/power-sequencer/ucd90160.hpp
+++ b/power-sequencer/ucd90160.hpp
@@ -60,8 +60,7 @@
     /**
      * Clears faults in the device
      */
-    void clearFaults() override
-    {}
+    void clearFaults() override {}
 
   private:
     /**
diff --git a/power-supply/main.cpp b/power-supply/main.cpp
index 0a6f965..c0efdcc 100644
--- a/power-supply/main.cpp
+++ b/power-supply/main.cpp
@@ -121,16 +121,16 @@
         }
 
         std::string name{"ps" + instnum + "_input_power"};
-        std::string basePath =
-            std::string{INPUT_HISTORY_SENSOR_ROOT} + '/' + name;
+        std::string basePath = std::string{INPUT_HISTORY_SENSOR_ROOT} + '/' +
+                               name;
 
         psuDevice->enableHistory(basePath, numRecords, syncGPIOPath, gpioNum);
 
         // Systemd object manager
         sdbusplus::server::manager_t objManager{bus, basePath.c_str()};
 
-        std::string busName =
-            std::string{INPUT_HISTORY_BUSNAME_ROOT} + '.' + name;
+        std::string busName = std::string{INPUT_HISTORY_BUSNAME_ROOT} + '.' +
+                              name;
         bus.request_name(busName.c_str());
     }
 
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index 373da01..bf9bfa8 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -610,8 +610,8 @@
             return;
         }
 
-        auto logEntryService =
-            util::getService(logEntries[0], LOGGING_IFACE, bus);
+        auto logEntryService = util::getService(logEntries[0], LOGGING_IFACE,
+                                                bus);
         if (logEntryService.empty())
         {
             return;
@@ -714,8 +714,8 @@
 
     try
     {
-        auto service =
-            util::getService(INVENTORY_OBJ_PATH, INVENTORY_MGR_IFACE, bus);
+        auto service = util::getService(INVENTORY_OBJ_PATH, INVENTORY_MGR_IFACE,
+                                        bus);
 
         if (service.empty())
         {
@@ -803,9 +803,9 @@
     }
 
     // Read just the most recent average/max record
-    auto data =
-        pmbusIntf.readBinary(INPUT_HISTORY, pmbus::Type::HwmonDeviceDebug,
-                             history::RecordManager::RAW_RECORD_SIZE);
+    auto data = pmbusIntf.readBinary(INPUT_HISTORY,
+                                     pmbus::Type::HwmonDeviceDebug,
+                                     history::RecordManager::RAW_RECORD_SIZE);
 
     // Update D-Bus only if something changed (a new record ID, or cleared out)
     auto changed = recordManager->add(data);
diff --git a/power-supply/record_manager.cpp b/power-supply/record_manager.cpp
index 336d0c5..c1d153b 100644
--- a/power-supply/record_manager.cpp
+++ b/power-supply/record_manager.cpp
@@ -62,8 +62,8 @@
                 // If it just rolled over from 0xFF to 0x00, then no
                 // need to clear.  If we see a 0 seemingly out of nowhere,
                 // then it was a sync so clear the old records.
-                auto rolledOver =
-                    (previousID == lastSequenceID) && (id == FIRST_SEQUENCE_ID);
+                auto rolledOver = (previousID == lastSequenceID) &&
+                                  (id == FIRST_SEQUENCE_ID);
 
                 if (!rolledOver)
                 {
diff --git a/power-supply/record_manager.hpp b/power-supply/record_manager.hpp
index 98382c7..36a786f 100644
--- a/power-supply/record_manager.hpp
+++ b/power-supply/record_manager.hpp
@@ -28,8 +28,7 @@
 class InvalidRecordException : public std::runtime_error
 {
   public:
-    InvalidRecordException() : std::runtime_error("Invalid history record")
-    {}
+    InvalidRecordException() : std::runtime_error("Invalid history record") {}
 };
 
 /**
@@ -70,8 +69,7 @@
      * @param[in] maxRec - the maximum number of history
      *                     records to keep at a time
      */
-    RecordManager(size_t maxRec) : RecordManager(maxRec, LAST_SEQUENCE_ID)
-    {}
+    RecordManager(size_t maxRec) : RecordManager(maxRec, LAST_SEQUENCE_ID) {}
 
     /**
      * @brief Constructor