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/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 3494ede..1fb8783 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -158,11 +158,11 @@
{
return "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.both";
}
- else if (isIPv4)
+ if (isIPv4)
{
return "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.v4";
}
- else if (isIPv6)
+ if (isIPv6)
{
return "xyz.openbmc_project.Network.EthernetInterface.DHCPConf.v6";
}
@@ -183,10 +183,7 @@
{
return "IPv4LinkLocal";
}
- else
- {
- return "LinkLocal";
- }
+ return "LinkLocal";
}
if (inputOrigin == "xyz.openbmc_project.Network.IP.AddressOrigin.DHCP")
{
@@ -194,10 +191,7 @@
{
return "DHCP";
}
- else
- {
- return "DHCPv6";
- }
+ return "DHCPv6";
}
if (inputOrigin == "xyz.openbmc_project.Network.IP.AddressOrigin.SLAAC")
{
@@ -678,10 +672,7 @@
// Continuity not preserved
return false;
}
- else
- {
- (*bits)++;
- }
+ (*bits)++;
}
else
{
@@ -1567,12 +1558,9 @@
messages::resourceCannotBeDeleted(asyncResp->res);
return;
}
- else
- {
- messages::propertyValueFormatError(
- asyncResp->res, thisJson.dump(), pathString);
- return;
- }
+ messages::propertyValueFormatError(
+ asyncResp->res, thisJson.dump(), pathString);
+ return;
}
if (thisJson.is_null())
@@ -1704,12 +1692,9 @@
messages::resourceCannotBeDeleted(asyncResp->res);
return;
}
- else
- {
- messages::propertyValueFormatError(
- asyncResp->res, thisJson.dump(), pathString);
- return;
- }
+ messages::propertyValueFormatError(
+ asyncResp->res, thisJson.dump(), pathString);
+ return;
}
if (thisJson.is_null())
@@ -2099,10 +2084,7 @@
{
return false;
}
- else
- {
- return true;
- }
+ return true;
}
/**