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/HwmonTempMain.cpp b/src/HwmonTempMain.cpp
index 8a583b9..79eab20 100644
--- a/src/HwmonTempMain.cpp
+++ b/src/HwmonTempMain.cpp
@@ -14,9 +14,8 @@
// limitations under the License.
*/
-#include "HwmonTempSensor.hpp"
-#include "Utils.hpp"
-
+#include <HwmonTempSensor.hpp>
+#include <Utils.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/container/flat_map.hpp>
@@ -37,7 +36,7 @@
#include <variant>
#include <vector>
-static constexpr bool DEBUG = false;
+static constexpr bool debug = false;
static constexpr float pollRateDefault = 0.5;
namespace fs = std::filesystem;
@@ -97,7 +96,7 @@
fs::path device = directory / "device";
std::string deviceName = fs::canonical(device).stem();
- auto findHyphen = deviceName.find("-");
+ auto findHyphen = deviceName.find('-');
if (findHyphen == std::string::npos)
{
std::cerr << "found bad device " << deviceName << "\n";
@@ -111,7 +110,7 @@
try
{
bus = std::stoi(busStr);
- addr = std::stoi(addrStr, 0, 16);
+ addr = std::stoi(addrStr, nullptr, 16);
}
catch (std::invalid_argument&)
{
@@ -312,7 +311,7 @@
/* we were canceled*/
return;
}
- else if (ec)
+ if (ec)
{
std::cerr << "timer error\n";
return;