add clang-tidy
This commit implements a clang-tidy file, and makes some changes to get
it to pass. Most changes are naming or mechanical in nature.
Tested:
Clang-tidy now passes.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: Ia441e4801b6c8725421d160c531c5df141f255d4
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index 29fd7f4..0f35353 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -14,14 +14,9 @@
// limitations under the License.
*/
-#include "IpmbSensor.hpp"
-
-#include "Utils.hpp"
-#include "VariantVisitors.hpp"
-
-#include <math.h>
-
-#include <boost/algorithm/string.hpp>
+#include <IpmbSensor.hpp>
+#include <Utils.hpp>
+#include <VariantVisitors.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/container/flat_map.hpp>
@@ -30,6 +25,7 @@
#include <sdbusplus/bus/match.hpp>
#include <chrono>
+#include <cmath>
#include <functional>
#include <iostream>
#include <limits>
@@ -181,9 +177,13 @@
case IpmbSubType::curr:
uint8_t snsNum;
if (subType == IpmbSubType::temp)
+ {
snsNum = 0x8d;
+ }
else
+ {
snsNum = 0x8c;
+ }
netfn = ipmi::me_bridge::netFn;
command = ipmi::me_bridge::sendRawPmbus;
commandData = {0x57, 0x01, 0x00, 0x86, deviceAddress,
@@ -354,18 +354,16 @@
read();
return;
}
- else
+
+ // rawValue only used in debug logging
+ // up to 5th byte in data are used to derive value
+ size_t end = std::min(sizeof(uint64_t), data.size());
+ uint64_t rawData = 0;
+ for (size_t i = 0; i < end; i++)
{
- // rawValue only used in debug logging
- // up to 5th byte in data are used to derive value
- size_t end = std::min(sizeof(uint64_t), data.size());
- uint64_t rawData = 0;
- for (size_t i = 0; i < end; i++)
- {
- reinterpret_cast<uint8_t*>(&rawData)[i] = data[i];
- }
- rawValue = static_cast<double>(rawData);
+ reinterpret_cast<uint8_t*>(&rawData)[i] = data[i];
}
+ rawValue = static_cast<double>(rawData);
/* Adjust value as per scale and offset */
value = (value * scaleVal) + offsetVal;