presence: Clang format updates

Used `format-code.sh` build script to make changes to conform to clang
format.

Tested: Compiled

Change-Id: I2fc795938e85a752ee56b54212d389c2ff296828
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/presence/json_config.cpp b/presence/json_config.cpp
index d09139c..1974c76 100644
--- a/presence/json_config.cpp
+++ b/presence/json_config.cpp
@@ -13,19 +13,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <string>
-#include <filesystem>
-#include <fstream>
+#include "json_config.hpp"
+
+#include "anyof.hpp"
+#include "fallback.hpp"
+#include "gpio.hpp"
+#include "sdbusplus.hpp"
+#include "tach.hpp"
+
 #include <nlohmann/json.hpp>
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/bus.hpp>
 
-#include "json_config.hpp"
-#include "tach.hpp"
-#include "gpio.hpp"
-#include "anyof.hpp"
-#include "fallback.hpp"
-#include "sdbusplus.hpp"
+#include <filesystem>
+#include <fstream>
+#include <string>
 
 namespace phosphor
 {
@@ -39,19 +41,12 @@
 using namespace phosphor::logging;
 
 policies JsonConfig::_policies;
-const std::map<std::string, methodHandler> JsonConfig::_methods =
-{
-    {"tach", method::getTach},
-    {"gpio", method::getGpio}
-};
-const std::map<std::string, rpolicyHandler> JsonConfig::_rpolicies =
-{
-    {"anyof", rpolicy::getAnyof},
-    {"fallback", rpolicy::getFallback}
-};
+const std::map<std::string, methodHandler> JsonConfig::_methods = {
+    {"tach", method::getTach}, {"gpio", method::getGpio}};
+const std::map<std::string, rpolicyHandler> JsonConfig::_rpolicies = {
+    {"anyof", rpolicy::getAnyof}, {"fallback", rpolicy::getFallback}};
 
-JsonConfig::JsonConfig(sdbusplus::bus::bus& bus) :
-    _bus(bus)
+JsonConfig::JsonConfig(sdbusplus::bus::bus& bus) : _bus(bus)
 {
     // Determine the configuration file to use
     _confFile = getConfFile();
@@ -75,7 +70,7 @@
                          entry("JSON_FILE=%s", _confFile.c_str()));
         // Load and process the json configuration
         load();
-        for (auto& p: _policies)
+        for (auto& p : _policies)
         {
             p->monitor();
         }
@@ -116,8 +111,7 @@
         {
             // Retrieve json config relative path location from dbus
             auto relPathLoc = util::SDBusPlus::getProperty<std::string>(
-                _bus, itServ->first, itObj->first,
-                confDbusIntf, confDbusProp);
+                _bus, itServ->first, itObj->first, confDbusIntf, confDbusProp);
             confFile = fs::path{confBasePath} / relPathLoc / confFileName;
             if (!fs::exists(confFile))
             {
@@ -186,10 +180,9 @@
         if (!member.contains("name") || !member.contains("path") ||
             !member.contains("methods") || !member.contains("rpolicy"))
         {
-            log<level::ERR>(
-                "Missing required fan presence properties",
-                entry("REQUIRED_PROPERTIES=%s",
-                      "{name, path, methods, rpolicy}"));
+            log<level::ERR>("Missing required fan presence properties",
+                            entry("REQUIRED_PROPERTIES=%s",
+                                  "{name, path, methods, rpolicy}"));
             throw std::runtime_error(
                 "Missing required fan presence properties");
         }
@@ -203,7 +196,7 @@
                 log<level::ERR>(
                     "Missing required fan presence method type",
                     entry("FAN_NAME=%s",
-                        member["name"].get<std::string>().c_str()));
+                          member["name"].get<std::string>().c_str()));
                 throw std::runtime_error(
                     "Missing required fan presence method type");
             }
@@ -223,10 +216,11 @@
             }
             else
             {
-                log<level::ERR>("Invalid fan presence method type",
-                                entry("FAN_NAME=%s",
-                                    member["name"].get<std::string>().c_str()),
-                                entry("METHOD_TYPE=%s", type.c_str()));
+                log<level::ERR>(
+                    "Invalid fan presence method type",
+                    entry("FAN_NAME=%s",
+                          member["name"].get<std::string>().c_str()),
+                    entry("METHOD_TYPE=%s", type.c_str()));
                 throw std::runtime_error("Invalid fan presence method type");
             }
         }
@@ -250,17 +244,16 @@
     _policies.swap(policies);
 }
 
-std::unique_ptr<RedundancyPolicy> JsonConfig::getPolicy(
-    const json& rpolicy,
-    const fanPolicy& fpolicy)
+std::unique_ptr<RedundancyPolicy>
+    JsonConfig::getPolicy(const json& rpolicy, const fanPolicy& fpolicy)
 {
     if (!rpolicy.contains("type"))
     {
-        log<level::ERR>("Missing required fan presence policy type",
-                        entry("FAN_NAME=%s",
-                            std::get<fanPolicyFanPos>(
-                                std::get<Fan>(fpolicy)).c_str()),
-                        entry("REQUIRED_PROPERTIES=%s", "{type}"));
+        log<level::ERR>(
+            "Missing required fan presence policy type",
+            entry("FAN_NAME=%s",
+                  std::get<fanPolicyFanPos>(std::get<Fan>(fpolicy)).c_str()),
+            entry("REQUIRED_PROPERTIES=%s", "{type}"));
         throw std::runtime_error("Missing required fan presence policy type");
     }
 
@@ -276,9 +269,10 @@
     }
     else
     {
-        log<level::ERR>("Invalid fan presence policy type",
+        log<level::ERR>(
+            "Invalid fan presence policy type",
             entry("FAN_NAME=%s",
-                std::get<fanPolicyFanPos>(std::get<Fan>(fpolicy)).c_str()),
+                  std::get<fanPolicyFanPos>(std::get<Fan>(fpolicy)).c_str()),
             entry("RPOLICY_TYPE=%s", type.c_str()));
         throw std::runtime_error("Invalid fan presence methods policy type");
     }
@@ -289,51 +283,48 @@
  */
 namespace method
 {
-    // Get a constructed presence sensor for fan presence detection by tach
-    std::unique_ptr<PresenceSensor> getTach(size_t fanIndex, const json& method)
+// Get a constructed presence sensor for fan presence detection by tach
+std::unique_ptr<PresenceSensor> getTach(size_t fanIndex, const json& method)
+{
+    if (!method.contains("sensors") || method["sensors"].size() == 0)
     {
-        if (!method.contains("sensors") ||
-            method["sensors"].size() == 0)
-        {
-            log<level::ERR>(
-                "Missing required tach method properties",
-                entry("FAN_ENTRY=%d", fanIndex),
-                entry("REQUIRED_PROPERTIES=%s", "{sensors}"));
-            throw std::runtime_error("Missing required tach method properties");
-        }
-
-        std::vector<std::string> sensors;
-        for (auto& sensor : method["sensors"])
-        {
-            sensors.emplace_back(sensor.get<std::string>());
-        }
-
-        return std::make_unique<PolicyAccess<Tach, JsonConfig>>(
-            fanIndex, std::move(sensors));
+        log<level::ERR>("Missing required tach method properties",
+                        entry("FAN_ENTRY=%d", fanIndex),
+                        entry("REQUIRED_PROPERTIES=%s", "{sensors}"));
+        throw std::runtime_error("Missing required tach method properties");
     }
 
-    // Get a constructed presence sensor for fan presence detection by gpio
-    std::unique_ptr<PresenceSensor> getGpio(size_t fanIndex, const json& method)
+    std::vector<std::string> sensors;
+    for (auto& sensor : method["sensors"])
     {
-        if (!method.contains("physpath") ||
-            !method.contains("devpath") ||
-            !method.contains("key"))
-        {
-            log<level::ERR>(
-                "Missing required gpio method properties",
-                entry("FAN_ENTRY=%d", fanIndex),
-                entry("REQUIRED_PROPERTIES=%s", "{physpath, devpath, key}"));
-            throw std::runtime_error("Missing required gpio method properties");
-        }
-
-        auto physpath = method["physpath"].get<std::string>();
-        auto devpath = method["devpath"].get<std::string>();
-        auto key = method["key"].get<unsigned int>();
-
-        return std::make_unique<PolicyAccess<Gpio, JsonConfig>>(
-            fanIndex, physpath, devpath, key);
+        sensors.emplace_back(sensor.get<std::string>());
     }
 
+    return std::make_unique<PolicyAccess<Tach, JsonConfig>>(fanIndex,
+                                                            std::move(sensors));
+}
+
+// Get a constructed presence sensor for fan presence detection by gpio
+std::unique_ptr<PresenceSensor> getGpio(size_t fanIndex, const json& method)
+{
+    if (!method.contains("physpath") || !method.contains("devpath") ||
+        !method.contains("key"))
+    {
+        log<level::ERR>(
+            "Missing required gpio method properties",
+            entry("FAN_ENTRY=%d", fanIndex),
+            entry("REQUIRED_PROPERTIES=%s", "{physpath, devpath, key}"));
+        throw std::runtime_error("Missing required gpio method properties");
+    }
+
+    auto physpath = method["physpath"].get<std::string>();
+    auto devpath = method["devpath"].get<std::string>();
+    auto key = method["key"].get<unsigned int>();
+
+    return std::make_unique<PolicyAccess<Gpio, JsonConfig>>(fanIndex, physpath,
+                                                            devpath, key);
+}
+
 } // namespace method
 
 /**
@@ -341,34 +332,32 @@
  */
 namespace rpolicy
 {
-    // Get an `Anyof` redundancy policy for the fan
-    std::unique_ptr<RedundancyPolicy> getAnyof(const fanPolicy& fan)
+// Get an `Anyof` redundancy policy for the fan
+std::unique_ptr<RedundancyPolicy> getAnyof(const fanPolicy& fan)
+{
+    std::vector<std::reference_wrapper<PresenceSensor>> pSensors;
+    for (auto& fanSensor : std::get<fanPolicySensorListPos>(fan))
     {
-        std::vector<std::reference_wrapper<PresenceSensor>> pSensors;
-        for (auto& fanSensor : std::get<fanPolicySensorListPos>(fan))
-        {
-            pSensors.emplace_back(*fanSensor);
-        }
-
-        return std::make_unique<AnyOf>(
-            std::get<fanPolicyFanPos>(fan), pSensors);
+        pSensors.emplace_back(*fanSensor);
     }
 
-    // Get a `Fallback` redundancy policy for the fan
-    std::unique_ptr<RedundancyPolicy> getFallback(const fanPolicy& fan)
-    {
-        std::vector<std::reference_wrapper<PresenceSensor>> pSensors;
-        for (auto& fanSensor : std::get<fanPolicySensorListPos>(fan))
-        {
-            // Place in the order given to fallback correctly
-            pSensors.emplace_back(*fanSensor);
-        }
+    return std::make_unique<AnyOf>(std::get<fanPolicyFanPos>(fan), pSensors);
+}
 
-        return std::make_unique<Fallback>(
-            std::get<fanPolicyFanPos>(fan), pSensors);
+// Get a `Fallback` redundancy policy for the fan
+std::unique_ptr<RedundancyPolicy> getFallback(const fanPolicy& fan)
+{
+    std::vector<std::reference_wrapper<PresenceSensor>> pSensors;
+    for (auto& fanSensor : std::get<fanPolicySensorListPos>(fan))
+    {
+        // Place in the order given to fallback correctly
+        pSensors.emplace_back(*fanSensor);
     }
 
-} // namespace policy
+    return std::make_unique<Fallback>(std::get<fanPolicyFanPos>(fan), pSensors);
+}
+
+} // namespace rpolicy
 
 } // namespace presence
 } // namespace fan