Write the clang-tidy file OpenBMC needs
Now that CI can handle clang-tidy, and a lot of the individual fixes
have landed for the various static analysis checks, lets see how close
we are.
This includes bringing a bunch of the code up to par with the checks
that require. Most of them fall into the category of extraneous else
statements, const correctness problems, or extra copies.
Tested:
CI only. Unit tests pass.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I9fbd346560a75fdd3901fa40c57932486275e912
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 34202b1..3f74ca5 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -351,7 +351,9 @@
std::get_if<uint64_t>(
&property.second);
if (nullptr != procFamily)
+ {
break;
+ }
continue;
}
@@ -361,7 +363,9 @@
std::get_if<std::string>(
&property.second);
if (nullptr != processorId)
+ {
break;
+ }
continue;
}
}
@@ -670,30 +674,25 @@
{
return "None";
}
- else if (dbusSource ==
- "xyz.openbmc_project.Control.Boot.Source.Sources.Disk")
+ if (dbusSource == "xyz.openbmc_project.Control.Boot.Source.Sources.Disk")
{
return "Hdd";
}
- else if (dbusSource ==
- "xyz.openbmc_project.Control.Boot.Source.Sources.ExternalMedia")
+ if (dbusSource ==
+ "xyz.openbmc_project.Control.Boot.Source.Sources.ExternalMedia")
{
return "Cd";
}
- else if (dbusSource ==
- "xyz.openbmc_project.Control.Boot.Source.Sources.Network")
+ if (dbusSource == "xyz.openbmc_project.Control.Boot.Source.Sources.Network")
{
return "Pxe";
}
- else if (dbusSource ==
- "xyz.openbmc_project.Control.Boot.Source.Sources.RemovableMedia")
+ if (dbusSource ==
+ "xyz.openbmc_project.Control.Boot.Source.Sources.RemovableMedia")
{
return "Usb";
}
- else
- {
- return "";
- }
+ return "";
}
/**
@@ -710,18 +709,15 @@
{
return "None";
}
- else if (dbusMode == "xyz.openbmc_project.Control.Boot.Mode.Modes.Safe")
+ if (dbusMode == "xyz.openbmc_project.Control.Boot.Mode.Modes.Safe")
{
return "Diags";
}
- else if (dbusMode == "xyz.openbmc_project.Control.Boot.Mode.Modes.Setup")
+ if (dbusMode == "xyz.openbmc_project.Control.Boot.Mode.Modes.Setup")
{
return "BiosSetup";
}
- else
- {
- return "";
- }
+ return "";
}
/**
@@ -747,7 +743,7 @@
{
return 0;
}
- else if (rfSource == "Pxe")
+ if (rfSource == "Pxe")
{
bootSource = "xyz.openbmc_project.Control.Boot.Source.Sources.Network";
}
@@ -1482,17 +1478,15 @@
{
return "None";
}
- else if (dbusAction ==
- "xyz.openbmc_project.State.Watchdog.Action.HardReset")
+ if (dbusAction == "xyz.openbmc_project.State.Watchdog.Action.HardReset")
{
return "ResetSystem";
}
- else if (dbusAction == "xyz.openbmc_project.State.Watchdog.Action.PowerOff")
+ if (dbusAction == "xyz.openbmc_project.State.Watchdog.Action.PowerOff")
{
return "PowerDown";
}
- else if (dbusAction ==
- "xyz.openbmc_project.State.Watchdog.Action.PowerCycle")
+ if (dbusAction == "xyz.openbmc_project.State.Watchdog.Action.PowerCycle")
{
return "PowerCycle";
}
@@ -1515,15 +1509,15 @@
{
return "xyz.openbmc_project.State.Watchdog.Action.None";
}
- else if (rfAction == "PowerCycle")
+ if (rfAction == "PowerCycle")
{
return "xyz.openbmc_project.State.Watchdog.Action.PowerCycle";
}
- else if (rfAction == "PowerDown")
+ if (rfAction == "PowerDown")
{
return "xyz.openbmc_project.State.Watchdog.Action.PowerOff";
}
- else if (rfAction == "ResetSystem")
+ if (rfAction == "ResetSystem")
{
return "xyz.openbmc_project.State.Watchdog.Action.HardReset";
}