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/Thresholds.cpp b/src/Thresholds.cpp
index f4d4ed0..df56b21 100644
--- a/src/Thresholds.cpp
+++ b/src/Thresholds.cpp
@@ -1,11 +1,8 @@
-#include "Thresholds.hpp"
-
-#include "VariantVisitors.hpp"
-#include "sensor.hpp"
-
+#include <Thresholds.hpp>
+#include <VariantVisitors.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/container/flat_map.hpp>
-#include <boost/lexical_cast.hpp>
+#include <sensor.hpp>
#include <array>
#include <cmath>
@@ -19,7 +16,7 @@
#include <variant>
#include <vector>
-static constexpr bool DEBUG = false;
+static constexpr bool debug = false;
namespace thresholds
{
unsigned int toBusValue(const Level& level)
@@ -75,10 +72,14 @@
{
auto labelFind = item.second.find("Label");
if (labelFind == item.second.end())
+ {
continue;
+ }
if (std::visit(VariantToStringVisitor(), labelFind->second) !=
*matchLabel)
+ {
continue;
+ }
}
auto directionFind = item.second.find("Direction");
auto severityFind = item.second.find("Severity");
@@ -323,7 +324,7 @@
}
}
- if constexpr (DEBUG)
+ if constexpr (debug)
{
// Throttle debug output, so that it does not continuously spam
++cDebugThrottle;
@@ -491,7 +492,7 @@
if (auto val = readFile(attrPath, scaleFactor))
{
*val += offset;
- if (DEBUG)
+ if (debug)
{
std::cout << "Threshold: " << attrPath << ": " << *val
<< "\n";