Clang-tidy-14 fixes
Do as the robot commands. All changes made automatically by tidy.
Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I752f37c9e7a95aa3be8e6980ba6e4b2b48b3395a
diff --git a/include/ADCSensor.hpp b/include/ADCSensor.hpp
index 9d2369b..79c220a 100644
--- a/include/ADCSensor.hpp
+++ b/include/ADCSensor.hpp
@@ -70,8 +70,8 @@
std::shared_ptr<sdbusplus::asio::connection>& conn,
boost::asio::io_service& io, const std::string& sensorName,
std::vector<thresholds::Threshold>&& thresholds,
- const double scaleFactor, const float pollRate,
- PowerState readState, const std::string& sensorConfiguration,
+ double scaleFactor, float pollRate, PowerState readState,
+ const std::string& sensorConfiguration,
std::optional<BridgeGpio>&& bridgeGpio);
~ADCSensor() override;
void setupRead(void);
diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp
index c4a47bc..1a98035 100644
--- a/include/CPUSensor.hpp
+++ b/include/CPUSensor.hpp
@@ -46,7 +46,7 @@
size_t pollTime;
bool loggedInterfaceDown = false;
uint8_t minMaxReadCounter{0};
- int fd;
+ int fd{};
void handleResponse(const boost::system::error_code& err);
void checkThresholds(void) override;
void updateMinMaxValues(void);
@@ -100,7 +100,7 @@
{
line.request({"cpusensor", gpiod::line_request::DIRECTION_INPUT,
activeHigh ? 0 : gpiod::line_request::FLAG_ACTIVE_LOW});
- resp = line.get_value();
+ resp = (line.get_value() != 0);
}
catch (const std::system_error&)
{
diff --git a/include/ChassisIntrusionSensor.hpp b/include/ChassisIntrusionSensor.hpp
index 3f2b7c8..56affca 100644
--- a/include/ChassisIntrusionSensor.hpp
+++ b/include/ChassisIntrusionSensor.hpp
@@ -54,7 +54,7 @@
bool mInitialized = false;
void updateValue(const std::string& newValue);
- int i2cReadFromPch(int busId, int slaveAddr);
+ static int i2cReadFromPch(int busId, int slaveAddr);
void pollSensorStatusByPch();
void readGpio();
void pollSensorStatusByGpio();
diff --git a/include/ExitAirTempSensor.hpp b/include/ExitAirTempSensor.hpp
index 2008291..c78253c 100644
--- a/include/ExitAirTempSensor.hpp
+++ b/include/ExitAirTempSensor.hpp
@@ -24,17 +24,17 @@
CFMSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
const std::string& name, const std::string& sensorConfiguration,
sdbusplus::asio::object_server& objectServer,
- std::vector<thresholds::Threshold>&& thresholds,
+ std::vector<thresholds::Threshold>&& thresholdData,
std::shared_ptr<ExitAirTempSensor>& parent);
~CFMSensor() override;
- bool calculate(double&);
+ bool calculate(double& /*value*/);
void updateReading(void);
void setupMatches(void);
void createMaxCFMIface(void);
void addTachRanges(const std::string& serviceName, const std::string& path);
void checkThresholds(void) override;
- uint64_t getMaxRpm(uint64_t cfmMax);
+ uint64_t getMaxRpm(uint64_t cfmMax) const;
private:
std::vector<sdbusplus::bus::match::match> matches;
@@ -63,7 +63,7 @@
const std::string& name,
const std::string& sensorConfiguration,
sdbusplus::asio::object_server& objectServer,
- std::vector<thresholds::Threshold>&& thresholds);
+ std::vector<thresholds::Threshold>&& thresholdData);
~ExitAirTempSensor() override;
void checkThresholds(void) override;
@@ -79,6 +79,6 @@
sdbusplus::asio::object_server& objServer;
std::chrono::time_point<std::chrono::steady_clock> lastTime;
- double getTotalCFM(void);
+ static double getTotalCFM(void);
bool calculate(double& val);
};
diff --git a/include/ExternalSensor.hpp b/include/ExternalSensor.hpp
index 30147fd..20dd2f0 100644
--- a/include/ExternalSensor.hpp
+++ b/include/ExternalSensor.hpp
@@ -18,7 +18,7 @@
sdbusplus::asio::object_server& objectServer,
std::shared_ptr<sdbusplus::asio::connection>& conn,
const std::string& sensorName,
- const std::string& sensorMeasure,
+ const std::string& sensorUnits,
std::vector<thresholds::Threshold>&& thresholdsIn,
const std::string& sensorConfiguration, double maxReading,
double minReading, double timeoutSecs,
diff --git a/include/FileHandle.hpp b/include/FileHandle.hpp
index 46e5539..a2a75d8 100644
--- a/include/FileHandle.hpp
+++ b/include/FileHandle.hpp
@@ -13,8 +13,8 @@
FileHandle() = delete;
FileHandle(const FileHandle&) = delete;
FileHandle& operator=(const FileHandle&) = delete;
- FileHandle(FileHandle&&) noexcept;
- FileHandle& operator=(FileHandle&&) noexcept;
+ FileHandle(FileHandle&& /*in*/) noexcept;
+ FileHandle& operator=(FileHandle&& /*in*/) noexcept;
explicit FileHandle(const std::filesystem::path& name,
std::ios_base::openmode mode = std::ios_base::in |
@@ -23,5 +23,5 @@
explicit FileHandle(int fd);
~FileHandle();
- int handle();
+ int handle() const;
};
\ No newline at end of file
diff --git a/include/HwmonTempSensor.hpp b/include/HwmonTempSensor.hpp
index 8ae92cf..5cf77c3 100644
--- a/include/HwmonTempSensor.hpp
+++ b/include/HwmonTempSensor.hpp
@@ -29,9 +29,8 @@
boost::asio::io_service& io, const std::string& sensorName,
std::vector<thresholds::Threshold>&& thresholds,
const struct SensorParams& thisSensorParameters,
- const float pollRate,
- const std::string& sensorConfiguration,
- const PowerState powerState);
+ float pollRate, const std::string& sensorConfiguration,
+ PowerState powerState);
~HwmonTempSensor() override;
void setupRead(void);
diff --git a/include/IpmbSensor.hpp b/include/IpmbSensor.hpp
index b006652..93c06fb 100644
--- a/include/IpmbSensor.hpp
+++ b/include/IpmbSensor.hpp
@@ -59,7 +59,7 @@
}
// Per IPMI 'Get Sensor Reading' specification
- if (data[1] & (1 << readingUnavailableBit))
+ if ((data[1] & (1 << readingUnavailableBit)) != 0)
{
return false;
}
@@ -81,15 +81,15 @@
boost::asio::io_service& io, const std::string& name,
const std::string& sensorConfiguration,
sdbusplus::asio::object_server& objectServer,
- std::vector<thresholds::Threshold>&& thresholds,
- uint8_t deviceAddress, uint8_t hostSMbusIndex,
- const float pollRate, std::string& sensorTypeName);
+ std::vector<thresholds::Threshold>&& thresholdData,
+ uint8_t deviceAddress, uint8_t hostSMbusIndex, float pollRate,
+ std::string& sensorTypeName);
~IpmbSensor() override;
void checkThresholds(void) override;
void read(void);
void init(void);
- std::string getSubTypeUnits(void);
+ std::string getSubTypeUnits(void) const;
void loadDefaults(void);
void runInitCmd(void);
bool processReading(const std::vector<uint8_t>& data, double& resp);
diff --git a/include/MCUTempSensor.hpp b/include/MCUTempSensor.hpp
index deb7102..e0474f1 100644
--- a/include/MCUTempSensor.hpp
+++ b/include/MCUTempSensor.hpp
@@ -15,7 +15,7 @@
boost::asio::io_service& io, const std::string& name,
const std::string& sensorConfiguration,
sdbusplus::asio::object_server& objectServer,
- std::vector<thresholds::Threshold>&& thresholds,
+ std::vector<thresholds::Threshold>&& thresholdData,
uint8_t busId, uint8_t mcuAddress, uint8_t tempReg);
~MCUTempSensor() override;
@@ -28,7 +28,7 @@
uint8_t tempReg;
private:
- int getMCURegsInfoWord(uint8_t regs, int16_t* pu16data);
+ int getMCURegsInfoWord(uint8_t regs, int16_t* pu16data) const;
sdbusplus::asio::object_server& objectServer;
boost::asio::deadline_timer waitTimer;
};
diff --git a/include/NVMeSensor.hpp b/include/NVMeSensor.hpp
index 5c70855..e58e3c7 100644
--- a/include/NVMeSensor.hpp
+++ b/include/NVMeSensor.hpp
@@ -14,7 +14,7 @@
std::shared_ptr<sdbusplus::asio::connection>& conn,
const std::string& sensorName,
std::vector<thresholds::Threshold>&& thresholds,
- const std::string& sensorConfiguration, const int busNumber);
+ const std::string& sensorConfiguration, int busNumber);
~NVMeSensor() override;
NVMeSensor& operator=(const NVMeSensor& other) = delete;
diff --git a/include/PSUEvent.hpp b/include/PSUEvent.hpp
index e7b5c0b..93c06c1 100644
--- a/include/PSUEvent.hpp
+++ b/include/PSUEvent.hpp
@@ -34,7 +34,7 @@
PSUSubEvent(std::shared_ptr<sdbusplus::asio::dbus_interface> eventInterface,
const std::string& path,
std::shared_ptr<sdbusplus::asio::connection>& conn,
- boost::asio::io_service& io, const PowerState& readState,
+ boost::asio::io_service& io, const PowerState& powerState,
const std::string& groupEventName, const std::string& eventName,
std::shared_ptr<std::set<std::string>> asserts,
std::shared_ptr<std::set<std::string>> combineEvent,
@@ -50,7 +50,7 @@
private:
int value = 0;
- int fd;
+ int fd{};
size_t errCount{0};
std::string path;
std::string eventName;
@@ -77,7 +77,7 @@
{
public:
PSUCombineEvent(
- sdbusplus::asio::object_server& objectSever,
+ sdbusplus::asio::object_server& objectServer,
std::shared_ptr<sdbusplus::asio::connection>& conn,
boost::asio::io_service& io, const std::string& psuName,
const PowerState& powerState,
diff --git a/include/PSUSensor.hpp b/include/PSUSensor.hpp
index 523d500..9e32138 100644
--- a/include/PSUSensor.hpp
+++ b/include/PSUSensor.hpp
@@ -38,7 +38,7 @@
void checkThresholds(void) override;
unsigned int sensorPollMs = defaultSensorPollMs;
- int fd;
+ int fd{};
static constexpr size_t warnAfterErrorCount = 10;
public:
diff --git a/include/TachSensor.hpp b/include/TachSensor.hpp
index 75dcd06..c2eaf36 100644
--- a/include/TachSensor.hpp
+++ b/include/TachSensor.hpp
@@ -17,13 +17,13 @@
class PresenceSensor
{
public:
- PresenceSensor(const std::string& pinName, bool inverted,
+ PresenceSensor(const std::string& gpioName, bool inverted,
boost::asio::io_service& io, const std::string& name);
~PresenceSensor();
void monitorPresence(void);
void read(void);
- bool getValue(void);
+ bool getValue(void) const;
private:
bool status = true;
@@ -93,26 +93,26 @@
inline void logFanInserted(const std::string& device)
{
- auto msg = "OpenBMC.0.1.FanInserted";
+ const auto* msg = "OpenBMC.0.1.FanInserted";
lg2::error("Fan Inserted", "REDFISH_MESSAGE_ID", msg,
"REDFISH_MESSAGE_ARGS", device);
}
inline void logFanRemoved(const std::string& device)
{
- auto msg = "OpenBMC.0.1.FanRemoved";
+ const auto* msg = "OpenBMC.0.1.FanRemoved";
lg2::error("Fan Removed", "REDFISH_MESSAGE_ID", msg, "REDFISH_MESSAGE_ARGS",
device);
}
inline void logFanRedundancyLost(void)
{
- auto msg = "OpenBMC.0.1.FanRedundancyLost";
+ const auto* msg = "OpenBMC.0.1.FanRedundancyLost";
lg2::error("Fan Inserted", "REDFISH_MESSAGE_ID", msg);
}
inline void logFanRedundancyRestored(void)
{
- auto msg = "OpenBMC.0.1.FanRedundancyRegained";
+ const auto* msg = "OpenBMC.0.1.FanRedundancyRegained";
lg2::error("Fan Removed", "REDFISH_MESSAGE_ID", msg);
}
diff --git a/include/Thresholds.hpp b/include/Thresholds.hpp
index 94480bb..ae1f528 100644
--- a/include/Thresholds.hpp
+++ b/include/Thresholds.hpp
@@ -67,7 +67,7 @@
struct ThresholdTimer
{
- ThresholdTimer(boost::asio::io_service& ioService) : io(ioService)
+ explicit ThresholdTimer(boost::asio::io_service& ioService) : io(ioService)
{}
bool hasActiveTimer(const Threshold& threshold, bool assert)
@@ -118,10 +118,10 @@
std::vector<thresholds::Threshold>& thresholdVector,
const std::string* matchLabel = nullptr, const int* sensorIndex = nullptr);
-bool parseThresholdsFromAttr(std::vector<thresholds::Threshold>& thresholds,
- const std::string& inputPath,
- const double& scaleFactor,
- const double& offset = 0);
+bool parseThresholdsFromAttr(
+ std::vector<thresholds::Threshold>& thresholdVector,
+ const std::string& inputPath, const double& scaleFactor,
+ const double& offset = 0);
struct ThresholdDefinition
{
@@ -137,9 +137,9 @@
{Level::SOFTSHUTDOWN, 3, "SoftShutdown"},
{Level::HARDSHUTDOWN, 4, "HardShutdown"}}};
-std::string getInterface(const Level level);
+std::string getInterface(Level level);
-void persistThreshold(const std::string& baseInterface, const std::string& path,
+void persistThreshold(const std::string& path, const std::string& baseInterface,
const thresholds::Threshold& threshold,
std::shared_ptr<sdbusplus::asio::connection>& conn,
size_t thresholdCount, const std::string& label);
diff --git a/include/Utils.hpp b/include/Utils.hpp
index 05a36a3..8fc5e80 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -221,7 +221,7 @@
{
std::cerr << "Error getting " << path << ": retries left"
<< retries - 1 << "\n";
- if (!retries)
+ if (retries == 0U)
{
return;
}
@@ -261,7 +261,7 @@
if (ec)
{
std::cerr << "Error calling mapper\n";
- if (!retries)
+ if (retries == 0U)
{
return;
}
diff --git a/include/sensor.hpp b/include/sensor.hpp
index 078fc45..abc6d82 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -132,7 +132,7 @@
return interface;
}
- void updateInstrumentation(double readValue)
+ void updateInstrumentation(double readValue) const
{
// Do nothing if this feature is not enabled
if constexpr (!enableInstrumentation)
@@ -244,7 +244,7 @@
{
oldValue = newValue;
}
- return true;
+ return 1;
}
void setInitialProperties(const std::string& unit,
@@ -379,7 +379,7 @@
}
}
- std::string propertyLevel(const Level lev, const Direction dir)
+ static std::string propertyLevel(const Level lev, const Direction dir)
{
for (const thresholds::ThresholdDefinition& prop :
thresholds::thresProp)
@@ -399,7 +399,7 @@
return "";
}
- std::string propertyAlarm(const Level lev, const Direction dir)
+ static std::string propertyAlarm(const Level lev, const Direction dir)
{
for (const thresholds::ThresholdDefinition& prop :
thresholds::thresProp)
@@ -419,7 +419,7 @@
return "";
}
- bool readingStateGood()
+ bool readingStateGood() const
{
if (readState == PowerState::on && !isPowerOn())
{
@@ -480,7 +480,7 @@
}
}
- bool inError()
+ bool inError() const
{
return errCount >= errorThreshold;
}
@@ -518,7 +518,8 @@
void updateProperty(
std::shared_ptr<sdbusplus::asio::dbus_interface>& interface,
- double& oldValue, const double& newValue, const char* dbusPropertyName)
+ double& oldValue, const double& newValue,
+ const char* dbusPropertyName) const
{
if (requiresUpdate(oldValue, newValue))
{
@@ -532,18 +533,14 @@
}
}
- bool requiresUpdate(const double& lVal, const double& rVal)
+ bool requiresUpdate(const double& lVal, const double& rVal) const
{
if (std::isnan(lVal) || std::isnan(rVal))
{
return true;
}
double diff = std::abs(lVal - rVal);
- if (diff > hysteresisPublish)
- {
- return true;
- }
- return false;
+ return diff > hysteresisPublish;
}
private:
diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp
index d9456cd..2a42999 100644
--- a/src/ADCSensor.cpp
+++ b/src/ADCSensor.cpp
@@ -53,8 +53,8 @@
"xyz.openbmc_project.Configuration.ADC", false, false,
maxVoltageReading / scaleFactor, minVoltageReading / scaleFactor,
conn, readState),
- std::enable_shared_from_this<ADCSensor>(), objServer(objectServer),
- inputDev(io), waitTimer(io), path(path), scaleFactor(scaleFactor),
+ objServer(objectServer), inputDev(io), waitTimer(io), path(path),
+ scaleFactor(scaleFactor),
sensorPollMs(static_cast<unsigned int>(pollRate * 1000)),
bridgeGpio(std::move(bridgeGpio)), thresholdTimer(io)
{
diff --git a/src/ADCSensorMain.cpp b/src/ADCSensorMain.cpp
index 8e973e7..ef9ef44 100644
--- a/src/ADCSensorMain.cpp
+++ b/src/ADCSensorMain.cpp
@@ -236,7 +236,7 @@
scaleFactor = std::visit(VariantToFloatVisitor(),
findScaleFactor->second);
// scaleFactor is used in division
- if (scaleFactor == 0.0f)
+ if (scaleFactor == 0.0F)
{
scaleFactor = 1.0;
}
@@ -248,7 +248,7 @@
{
pollRate =
std::visit(VariantToFloatVisitor(), findPollRate->second);
- if (pollRate <= 0.0f)
+ if (pollRate <= 0.0F)
{
pollRate = pollRateDefault; // polling time too short
}
diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp
index 87fa53f..f40c96f 100644
--- a/src/CPUSensor.cpp
+++ b/src/CPUSensor.cpp
@@ -25,6 +25,7 @@
#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/asio/object_server.hpp>
+#include <cstddef>
#include <iostream>
#include <istream>
#include <limits>
@@ -42,8 +43,7 @@
bool show, double dtsOffset) :
Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration,
objectType, false, false, 0, 0, conn, PowerState::on),
- std::enable_shared_from_this<CPUSensor>(), objServer(objectServer),
- inputDev(io), waitTimer(io),
+ objServer(objectServer), inputDev(io), waitTimer(io),
nameTcontrol("Tcontrol CPU" + std::to_string(cpuId)), path(path),
privTcontrol(std::numeric_limits<double>::quiet_NaN()),
dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs)
@@ -56,7 +56,7 @@
auto& [type, nr, item] = *fileParts;
std::string interfacePath;
const char* units = nullptr;
- if (type.compare("power") == 0)
+ if (type == "power")
{
interfacePath = "/xyz/openbmc_project/sensors/power/" + name;
units = sensor_paths::unitWatts;
@@ -189,7 +189,7 @@
{
for (const auto& vectorItem : mapIt->second)
{
- auto& [suffix, oldValue, dbusName] = vectorItem;
+ const auto& [suffix, oldValue, dbusName] = vectorItem;
auto attrPath = boost::replace_all_copy(path, fileItem, suffix);
if (auto newVal =
readFile(attrPath, CPUSensor::sensorScaleFactor))
@@ -231,7 +231,7 @@
std::cerr << name << " interface down!\n";
loggedInterfaceDown = true;
}
- pollTime = CPUSensor::sensorPollMs * 10u;
+ pollTime = static_cast<size_t>(CPUSensor::sensorPollMs) * 10U;
markFunctional(false);
}
return;
diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp
index 9d5bda4..681fb9f 100644
--- a/src/CPUSensorMain.cpp
+++ b/src/CPUSensorMain.cpp
@@ -107,7 +107,7 @@
const int& cpuId)
{
std::string sensorName = label;
- if (item.compare("input") != 0)
+ if (item != "input")
{
sensorName += " " + item;
}
@@ -116,7 +116,7 @@
bool isWordEnd = true;
std::transform(sensorName.begin(), sensorName.end(), sensorName.begin(),
[&isWordEnd](int c) {
- if (std::isspace(c))
+ if (std::isspace(c) != 0)
{
isWordEnd = true;
}
@@ -396,7 +396,7 @@
}
}
- if (createdSensors.size())
+ if (static_cast<unsigned int>(!createdSensors.empty()) != 0U)
{
std::cout << "Sensor" << (createdSensors.size() == 1 ? " is" : "s are")
<< " created\n";
@@ -478,7 +478,7 @@
msg.addr = config.addr;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
- if (!ioctl(file, PECI_IOC_PING, &msg))
+ if (ioctl(file, PECI_IOC_PING, &msg) == 0)
{
bool dimmReady = false;
for (unsigned int rank = 0; rank < rankNumMax; rank++)
@@ -491,10 +491,10 @@
msg.rx_len = 4;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
- if (!ioctl(file, PECI_IOC_RD_PKG_CFG, &msg))
+ if (ioctl(file, PECI_IOC_RD_PKG_CFG, &msg) == 0)
{
- if (msg.pkg_config[0] || msg.pkg_config[1] ||
- msg.pkg_config[2])
+ if ((msg.pkg_config[0] != 0U) ||
+ (msg.pkg_config[1] != 0U) || (msg.pkg_config[2] != 0U))
{
dimmReady = true;
break;
@@ -554,7 +554,7 @@
}
}
- if (rescanDelaySeconds)
+ if (rescanDelaySeconds != 0U)
{
creationTimer.expires_from_now(
boost::posix_time::seconds(rescanDelaySeconds));
@@ -698,7 +698,7 @@
}
}
- if (cpuConfigs.size())
+ if (static_cast<unsigned int>(!cpuConfigs.empty()) != 0U)
{
std::cout << "CPU config" << (cpuConfigs.size() == 1 ? " is" : "s are")
<< " parsed\n";
diff --git a/src/ChassisIntrusionSensor.cpp b/src/ChassisIntrusionSensor.cpp
index 7b2a0a3..6c40717 100644
--- a/src/ChassisIntrusionSensor.cpp
+++ b/src/ChassisIntrusionSensor.cpp
@@ -106,7 +106,7 @@
return -1;
}
- if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA))
+ if ((funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA) == 0U)
{
std::cerr << "not support I2C_FUNC_SMBUS_READ_BYTE_DATA \n";
close(fd);
@@ -154,7 +154,8 @@
if (!ec)
{
int statusValue = i2cReadFromPch(mBusId, mSlaveAddr);
- std::string newValue = statusValue ? "HardwareIntrusion" : "Normal";
+ std::string newValue =
+ statusValue != 0 ? "HardwareIntrusion" : "Normal";
if (newValue != "unknown" && mValue != newValue)
{
@@ -181,7 +182,7 @@
auto value = mGpioLine.get_value();
// set string defined in chassis redfish schema
- std::string newValue = value ? "HardwareIntrusion" : "Normal";
+ std::string newValue = value != 0 ? "HardwareIntrusion" : "Normal";
if (debug)
{
@@ -236,7 +237,7 @@
// set string defined in chassis redfish schema
auto value = mGpioLine.get_value();
- std::string newValue = value ? "HardwareIntrusion" : "Normal";
+ std::string newValue = value != 0 ? "HardwareIntrusion" : "Normal";
updateValue(newValue);
auto gpioLineFd = mGpioLine.event_get_fd();
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index 4d77ef4..67c690f 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -129,7 +129,7 @@
std::cerr << "Error getting pid class\n";
return;
}
- auto classStr = std::get_if<std::string>(&classType);
+ const auto* classStr = std::get_if<std::string>(&classType);
if (classStr == nullptr || *classStr != "fan")
{
return;
@@ -163,8 +163,7 @@
Sensor(escapeName(sensorName), std::move(thresholdData),
sensorConfiguration, "xyz.openbmc_project.Configuration.ExitAirTemp",
false, false, cfmMaxReading, cfmMinReading, conn, PowerState::on),
- std::enable_shared_from_this<CFMSensor>(), parent(parent),
- objServer(objectServer)
+ parent(parent), objServer(objectServer)
{
sensorInterface = objectServer.add_interface(
"/xyz/openbmc_project/sensors/airflow/" + name,
@@ -228,7 +227,7 @@
if (!ec)
{
- auto cfm = std::get_if<double>(&cfmVariant);
+ const auto* cfm = std::get_if<double>(&cfmVariant);
if (cfm != nullptr && *cfm >= minSystemCfm)
{
maxRpm = self->getMaxRpm(*cfm);
@@ -261,7 +260,7 @@
{
return;
}
- const auto reading = std::get_if<double>(&(findValue->second));
+ auto* const reading = std::get_if<double>(&(findValue->second));
if (reading == nullptr)
{
std::cerr << "Got CFM Limit of wrong type\n";
@@ -346,7 +345,7 @@
}
}
-uint64_t CFMSensor::getMaxRpm(uint64_t cfmMaxSetting)
+uint64_t CFMSensor::getMaxRpm(uint64_t cfmMaxSetting) const
{
uint64_t pwmPercent = 100;
double totalCFM = std::numeric_limits<double>::max();
@@ -505,7 +504,7 @@
sensorConfiguration, "xyz.openbmc_project.Configuration.ExitAirTemp",
false, false, exitAirMaxReading, exitAirMinReading, conn,
PowerState::on),
- std::enable_shared_from_this<ExitAirTempSensor>(), objServer(objectServer)
+ objServer(objectServer)
{
sensorInterface = objectServer.add_interface(
"/xyz/openbmc_project/sensors/temperature/" + name,
@@ -600,7 +599,7 @@
{
size_t lastSlash = item.first.rfind("/");
if (lastSlash == std::string::npos ||
- lastSlash == item.first.size() || !item.second.size())
+ lastSlash == item.first.size() || item.second.empty())
{
continue;
}
diff --git a/src/ExternalSensor.cpp b/src/ExternalSensor.cpp
index cc341f8..cc9e7c5 100644
--- a/src/ExternalSensor.cpp
+++ b/src/ExternalSensor.cpp
@@ -28,8 +28,7 @@
double minReading, double timeoutSecs, const PowerState& powerState) :
Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration,
objectType, true, true, maxReading, minReading, conn, powerState),
- std::enable_shared_from_this<ExternalSensor>(), objServer(objectServer),
- writeLast(std::chrono::steady_clock::now()),
+ objServer(objectServer), writeLast(std::chrono::steady_clock::now()),
writeTimeout(
std::chrono::duration_cast<std::chrono::steady_clock::duration>(
std::chrono::duration<double>(timeoutSecs))),
diff --git a/src/ExternalSensorMain.cpp b/src/ExternalSensorMain.cpp
index a096175..cbe2388 100644
--- a/src/ExternalSensorMain.cpp
+++ b/src/ExternalSensorMain.cpp
@@ -371,7 +371,7 @@
return;
}
- auto messagePath = message.get_path();
+ const auto* messagePath = message.get_path();
sensorsChanged->insert(messagePath);
if constexpr (debug)
{
diff --git a/src/FanMain.cpp b/src/FanMain.cpp
index 0f5e721..ff0ffaa 100644
--- a/src/FanMain.cpp
+++ b/src/FanMain.cpp
@@ -386,7 +386,7 @@
{
bool inverted =
std::get<std::string>(findPolarity->second) == "Low";
- if (auto pinName =
+ if (const auto* pinName =
std::get_if<std::string>(&findPinName->second))
{
presenceSensor = std::make_unique<PresenceSensor>(
@@ -409,8 +409,9 @@
auto findPower = baseConfiguration->second.find("PowerState");
if (findPower != baseConfiguration->second.end())
{
- auto ptrPower = std::get_if<std::string>(&(findPower->second));
- if (ptrPower)
+ const auto* ptrPower =
+ std::get_if<std::string>(&(findPower->second));
+ if (ptrPower != nullptr)
{
setReadState(*ptrPower, powerState);
}
@@ -466,9 +467,9 @@
auto findMutable = connector->second.find("Mutable");
if (findMutable != connector->second.end())
{
- auto ptrMutable =
+ const auto* ptrMutable =
std::get_if<bool>(&(findMutable->second));
- if (ptrMutable)
+ if (ptrMutable != nullptr)
{
isValueMutable = *ptrMutable;
}
@@ -483,7 +484,8 @@
auto findLED = connector->second.find("LED");
if (findLED != connector->second.end())
{
- auto ledName = std::get_if<std::string>(&(findLED->second));
+ const auto* ledName =
+ std::get_if<std::string>(&(findLED->second));
if (ledName == nullptr)
{
std::cerr << "Wrong format for LED of " << sensorName
@@ -504,7 +506,7 @@
led);
if (!pwmPath.empty() && fs::exists(pwmPath) &&
- !pwmSensors.count(pwmPath))
+ (pwmSensors.count(pwmPath) == 0U))
{
pwmSensors[pwmPath] = std::make_unique<PwmSensor>(
pwmName, pwmPath, dbusConnection, objectServer,
diff --git a/src/FileHandle.cpp b/src/FileHandle.cpp
index 6724698..c77fc3d 100644
--- a/src/FileHandle.cpp
+++ b/src/FileHandle.cpp
@@ -19,9 +19,9 @@
FileHandle::FileHandle(int fdIn) : fd(fdIn){};
-FileHandle::FileHandle(FileHandle&& in) noexcept
+FileHandle::FileHandle(FileHandle&& in) noexcept : fd(in.fd)
{
- fd = in.fd;
+
in.fd = -1;
}
@@ -34,7 +34,7 @@
FileHandle::~FileHandle()
{
- if (fd)
+ if (fd != 0)
{
int r = close(fd);
if (r < 0)
@@ -44,7 +44,7 @@
}
}
-int FileHandle::handle()
+int FileHandle::handle() const
{
return fd;
}
diff --git a/src/HwmonTempMain.cpp b/src/HwmonTempMain.cpp
index a9d4748..988e8b9 100644
--- a/src/HwmonTempMain.cpp
+++ b/src/HwmonTempMain.cpp
@@ -199,8 +199,8 @@
continue;
}
- if ((!std::get_if<uint64_t>(&busCfg->second)) ||
- (!std::get_if<uint64_t>(&addrCfg->second)))
+ if ((std::get_if<uint64_t>(&busCfg->second) == nullptr) ||
+ (std::get_if<uint64_t>(&addrCfg->second) == nullptr))
{
std::cerr << sensor.first.str << " Bus or Address invalid\n";
continue;
@@ -310,7 +310,7 @@
uint64_t bus = 0;
uint64_t addr = 0;
- std::from_chars_result res;
+ std::from_chars_result res{};
res = std::from_chars(busStr.data(), busStr.data() + busStr.size(),
bus);
if (res.ec != std::errc{})
@@ -394,7 +394,7 @@
{
pollRate =
std::visit(VariantToFloatVisitor(), findPollRate->second);
- if (pollRate <= 0.0f)
+ if (pollRate <= 0.0F)
{
pollRate = pollRateDefault; // polling time too short
}
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index 22824e0..7eb5e8f 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -51,8 +51,7 @@
std::move(thresholdsIn), sensorConfiguration, objectType, false,
false, thisSensorParameters.maxValue, thisSensorParameters.minValue,
conn, powerState),
- std::enable_shared_from_this<HwmonTempSensor>(), objServer(objectServer),
- inputDev(io), waitTimer(io), path(path),
+ objServer(objectServer), inputDev(io), waitTimer(io), path(path),
offsetValue(thisSensorParameters.offsetValue),
scaleValue(thisSensorParameters.scaleValue),
sensorPollMs(static_cast<unsigned int>(pollRate * 1000))
diff --git a/src/IntrusionSensorMain.cpp b/src/IntrusionSensorMain.cpp
index 2f737af..c4c4cd8 100644
--- a/src/IntrusionSensorMain.cpp
+++ b/src/IntrusionSensorMain.cpp
@@ -207,8 +207,9 @@
if (findEthIndex != baseConfiguration->second.end() &&
findName != baseConfiguration->second.end())
{
- auto* pEthIndex = std::get_if<uint64_t>(&findEthIndex->second);
- auto* pName = std::get_if<std::string>(&findName->second);
+ const auto* pEthIndex =
+ std::get_if<uint64_t>(&findEthIndex->second);
+ const auto* pName = std::get_if<std::string>(&findName->second);
if (pEthIndex != nullptr && pName != nullptr)
{
lanInfoMap[*pEthIndex] = *pName;
@@ -221,7 +222,7 @@
}
}
- if (lanInfoMap.size() == 0)
+ if (lanInfoMap.empty())
{
std::cerr << "can't find matched NIC name. \n";
}
@@ -281,8 +282,8 @@
bool oldLanConnected = findLanStatus->second;
// get lan info from map
- std::string lanInfo = "";
- if (lanInfoMap.size() > 0)
+ std::string lanInfo;
+ if (!lanInfoMap.empty())
{
auto findLanInfo = lanInfoMap.find(ethNum);
if (findLanInfo == lanInfoMap.end())
@@ -307,8 +308,8 @@
if (oldLanConnected != newLanConnected)
{
std::string strEthNum = "eth" + std::to_string(ethNum) + lanInfo;
- auto strState = newLanConnected ? "connected" : "lost";
- auto strMsgId =
+ const auto* strState = newLanConnected ? "connected" : "lost";
+ const auto* strMsgId =
newLanConnected ? "OpenBMC.0.1.LanRegained" : "OpenBMC.0.1.LanLost";
lg2::info("{ETHDEV} LAN leash {STATE}", "ETHDEV", strEthNum, "STATE",
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index a8cd25a..8d4dfaa 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -96,7 +96,7 @@
objectServer.remove_interface(association);
}
-std::string IpmbSensor::getSubTypeUnits(void)
+std::string IpmbSensor::getSubTypeUnits(void) const
{
switch (subType)
{
@@ -135,7 +135,7 @@
const IpmbMethodType& response) {
const int& status = std::get<0>(response);
- if (ec || status)
+ if (ec || (status != 0))
{
std::cerr << "Error setting init command for device: " << name
<< "\n";
@@ -270,7 +270,7 @@
{
if (data.size() < 4)
{
- if (!errCount)
+ if (errCount == 0U)
{
std::cerr << "Invalid data length returned for " << name
<< "\n";
@@ -284,7 +284,7 @@
{
if (data.size() < 5)
{
- if (!errCount)
+ if (errCount == 0U)
{
std::cerr << "Invalid data length returned for " << name
<< "\n";
@@ -300,7 +300,7 @@
{
if (data.size() < 5)
{
- if (!errCount)
+ if (errCount == 0U)
{
std::cerr << "Invalid data length returned for " << name
<< "\n";
@@ -315,7 +315,7 @@
{
if (data.size() < 5)
{
- if (!errCount)
+ if (errCount == 0U)
{
std::cerr << "Invalid data length returned for " << name
<< "\n";
@@ -353,7 +353,7 @@
[this](boost::system::error_code ec,
const IpmbMethodType& response) {
const int& status = std::get<0>(response);
- if (ec || status)
+ if (ec || (status != 0))
{
incrementError();
read();
@@ -391,6 +391,7 @@
uint64_t rawData = 0;
for (size_t i = 0; i < end; i++)
{
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(&rawData)[i] = data[i];
}
rawValue = static_cast<double>(rawData);
@@ -541,7 +542,7 @@
{
pollRate = std::visit(VariantToFloatVisitor(),
findPollRate->second);
- if (pollRate <= 0.0f)
+ if (pollRate <= 0.0F)
{
pollRate = pollRateDefault;
}
diff --git a/src/MCUTempSensor.cpp b/src/MCUTempSensor.cpp
index c8aef67..68b6df3 100644
--- a/src/MCUTempSensor.cpp
+++ b/src/MCUTempSensor.cpp
@@ -99,7 +99,7 @@
thresholds::checkThresholds(this);
}
-int MCUTempSensor::getMCURegsInfoWord(uint8_t regs, int16_t* pu16data)
+int MCUTempSensor::getMCURegsInfoWord(uint8_t regs, int16_t* pu16data) const
{
std::string i2cBus = "/dev/i2c-" + std::to_string(busId);
@@ -129,7 +129,7 @@
return -1;
}
- if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA))
+ if ((funcs & I2C_FUNC_SMBUS_READ_WORD_DATA) == 0U)
{
std::cerr << " not support I2C_FUNC_SMBUS_READ_WORD_DATA\n";
close(fd);
diff --git a/src/NVMeBasicContext.cpp b/src/NVMeBasicContext.cpp
index 760167e..88ddfe8 100644
--- a/src/NVMeBasicContext.cpp
+++ b/src/NVMeBasicContext.cpp
@@ -122,7 +122,7 @@
{
std::cerr << "Failed to read request from in descriptor "
<< strerror(errno) << "\n";
- if (rc)
+ if (rc != 0)
{
return -errno;
}
@@ -158,7 +158,7 @@
std::cerr << "Failed to write block (" << std::dec << len
<< ") length to out descriptor: "
<< strerror(static_cast<int>(-rc)) << "\n";
- if (rc)
+ if (rc != 0)
{
return -errno;
}
@@ -176,7 +176,7 @@
std::cerr << "Failed to write block data of length " << std::dec
<< lenRemaining << " to out pipe: " << strerror(errno)
<< "\n";
- if (rc)
+ if (rc != 0)
{
return -errno;
}
@@ -400,8 +400,8 @@
uint8_t* messageData = static_cast<uint8_t*>(msg);
uint8_t status = messageData[0];
- if ((status & NVME_MI_BASIC_SFLGS_DRIVE_NOT_READY) ||
- !(status & NVME_MI_BASIC_SFLGS_DRIVE_FUNCTIONAL))
+ if (((status & NVME_MI_BASIC_SFLGS_DRIVE_NOT_READY) != 0) ||
+ ((status & NVME_MI_BASIC_SFLGS_DRIVE_FUNCTIONAL) == 0))
{
sensor->markFunctional(false);
return;
diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp
index fc7bc48..a5257f5 100644
--- a/src/NVMeSensor.cpp
+++ b/src/NVMeSensor.cpp
@@ -22,7 +22,7 @@
static constexpr double minReading = 0;
NVMeSensor::NVMeSensor(sdbusplus::asio::object_server& objectServer,
- boost::asio::io_service&,
+ boost::asio::io_service& /*unused*/,
std::shared_ptr<sdbusplus::asio::connection>& conn,
const std::string& sensorName,
std::vector<thresholds::Threshold>&& thresholdsIn,
diff --git a/src/PSUEvent.cpp b/src/PSUEvent.cpp
index 23f26cc..d1cb40e 100644
--- a/src/PSUEvent.cpp
+++ b/src/PSUEvent.cpp
@@ -146,12 +146,11 @@
std::shared_ptr<std::set<std::string>> asserts,
std::shared_ptr<std::set<std::string>> combineEvent,
std::shared_ptr<bool> state, const std::string& psuName, double pollRate) :
- std::enable_shared_from_this<PSUSubEvent>(),
- eventInterface(std::move(eventInterface)), asserts(std::move(asserts)),
- combineEvent(std::move(combineEvent)), assertState(std::move(state)),
- path(path), eventName(eventName), readState(powerState), waitTimer(io),
- inputDev(io), psuName(psuName), groupEventName(groupEventName),
- systemBus(conn)
+ eventInterface(std::move(eventInterface)),
+ asserts(std::move(asserts)), combineEvent(std::move(combineEvent)),
+ assertState(std::move(state)), path(path), eventName(eventName),
+ readState(powerState), waitTimer(io), inputDev(io), psuName(psuName),
+ groupEventName(groupEventName), systemBus(conn)
{
if (pollRate > 0.0)
{
@@ -308,7 +307,7 @@
return;
}
- if (*assertState == true)
+ if (*assertState)
{
*assertState = false;
auto foundCombine = (*combineEvent).find(groupEventName);
@@ -345,7 +344,7 @@
{
std::cerr << "PSUSubEvent asserted by " << path << "\n";
- if ((*assertState == false) && ((*asserts).empty()))
+ if ((!*assertState) && ((*asserts).empty()))
{
*assertState = true;
if (!assertMessage.empty())
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index eedbfcc..bf75e61 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -47,9 +47,8 @@
const std::string& label, size_t tSize, double pollRate) :
Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration,
objectType, false, false, max, min, conn, powerState),
- std::enable_shared_from_this<PSUSensor>(), objServer(objectServer),
- inputDev(io), waitTimer(io), path(path), sensorFactor(factor),
- sensorOffset(offset), thresholdTimer(io)
+ objServer(objectServer), inputDev(io), waitTimer(io), path(path),
+ sensorFactor(factor), sensorOffset(offset), thresholdTimer(io)
{
std::string unitPath = sensor_paths::getPathForUnits(sensorUnits);
if constexpr (debug)
diff --git a/src/PSUSensorMain.cpp b/src/PSUSensorMain.cpp
index 16c601d..c710b4d 100644
--- a/src/PSUSensorMain.cpp
+++ b/src/PSUSensorMain.cpp
@@ -553,7 +553,7 @@
std::string labelHead;
std::string sensorPathStr = sensorPath.string();
std::string sensorNameStr = sensorPath.filename();
- std::string sensorNameSubStr{""};
+ std::string sensorNameSubStr;
if (std::regex_search(sensorNameStr, matches, sensorNameRegEx))
{
// hwmon *_input filename without number:
@@ -575,7 +575,7 @@
{
std::string sensorPathStrMax = sensorPathStr.substr(pos);
- if (sensorPathStrMax.compare("_max") == 0)
+ if (sensorPathStrMax == "_max")
{
labelPath =
boost::replace_all_copy(sensorPathStr, "max", "label");
@@ -941,8 +941,7 @@
{
std::cerr << "Created total of " << numCreated << " sensors\n";
}
- return;
-}
+ }
void createSensors(
boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
diff --git a/src/PwmSensor.cpp b/src/PwmSensor.cpp
index 2ed24a6..ae7b240 100644
--- a/src/PwmSensor.cpp
+++ b/src/PwmSensor.cpp
@@ -50,7 +50,7 @@
pwmMax = sysPwmMax;
}
- if (!pwmValue)
+ if (pwmValue == 0U)
{
// default pwm to non 0
pwmValue = static_cast<uint32_t>(pwmMax * (defaultPwm / 100.0));
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index f5d420d..9afe094 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -192,7 +192,7 @@
{
bool status = thresholds::checkThresholds(this);
- if (redundancy && *redundancy)
+ if ((redundancy != nullptr) && *redundancy)
{
(*redundancy)
->update("/xyz/openbmc_project/sensors/fan_tach/" + name, !status);
@@ -223,7 +223,7 @@
{
gpioLine.request({"FanSensor", gpiod::line_request::EVENT_BOTH_EDGES,
inverted ? gpiod::line_request::FLAG_ACTIVE_LOW : 0});
- status = gpioLine.get_value();
+ status = (gpioLine.get_value() != 0);
int gpioLineFd = gpioLine.event_get_fd();
if (gpioLineFd < 0)
@@ -274,7 +274,7 @@
void PresenceSensor::read(void)
{
gpioLine.event_read();
- status = gpioLine.get_value();
+ status = (gpioLine.get_value() != 0);
// Read is invoked when an edge event is detected by monitorPresence
if (status)
{
@@ -286,7 +286,7 @@
}
}
-bool PresenceSensor::getValue(void)
+bool PresenceSensor::getValue(void) const
{
return status;
}
@@ -332,7 +332,7 @@
newState = redundancy::failed;
break;
}
- if (failedCount)
+ if (failedCount != 0U)
{
newState = redundancy::degraded;
}
diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp
index 1690c25..ff452bc 100644
--- a/src/Thresholds.cpp
+++ b/src/Thresholds.cpp
@@ -210,7 +210,7 @@
}
std::string property =
- sensor->propertyLevel(threshold.level, threshold.direction);
+ Sensor::propertyLevel(threshold.level, threshold.direction);
if (property.empty())
{
continue;
@@ -446,7 +446,7 @@
return;
}
- std::string property = sensor->propertyAlarm(level, direction);
+ std::string property = Sensor::propertyAlarm(level, direction);
if (property.empty())
{
std::cout << "Alarm property is empty \n";
@@ -505,7 +505,7 @@
{
for (const auto& t : map.at(item))
{
- auto& [suffix, level, direction, offset] = t;
+ const auto& [suffix, level, direction, offset] = t;
auto attrPath =
boost::replace_all_copy(inputPath, item, suffix);
if (auto val = readFile(attrPath, scaleFactor))
diff --git a/src/Utils.cpp b/src/Utils.cpp
index ad43caa..954a5d3 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -337,7 +337,7 @@
const std::variant<std::string>& state) {
if (ec)
{
- if (retries)
+ if (retries != 0U)
{
auto timer = std::make_shared<boost::asio::steady_timer>(
conn->get_io_context());
@@ -370,7 +370,7 @@
const std::variant<std::string>& state) {
if (ec)
{
- if (retries)
+ if (retries != 0U)
{
auto timer = std::make_shared<boost::asio::steady_timer>(
conn->get_io_context());
@@ -386,7 +386,7 @@
std::cerr << "error getting post status " << ec.message() << "\n";
return;
}
- auto& value = std::get<std::string>(state);
+ const auto& value = std::get<std::string>(state);
biosHasPost = (value != "Inactive") &&
(value != "xyz.openbmc_project.State.OperatingSystem."
"Status.OSStatus.Inactive");
@@ -471,7 +471,7 @@
void findLimits(std::pair<double, double>& limits,
const SensorBaseConfiguration* data)
{
- if (!data)
+ if (data == nullptr)
{
return;
}
@@ -648,7 +648,7 @@
<< "\n";
return;
}
- auto manufacturingModeStatus = std::get_if<std::string>(&itr->second);
+ auto* manufacturingModeStatus = std::get_if<std::string>(&itr->second);
handleSpecialModeChange(*manufacturingModeStatus);
});
@@ -670,7 +670,7 @@
{
return;
}
- auto manufacturingModeStatus = std::get_if<std::string>(&itr->second);
+ auto* manufacturingModeStatus = std::get_if<std::string>(&itr->second);
handleSpecialModeChange(*manufacturingModeStatus);
});
@@ -683,7 +683,7 @@
<< "\n";
return;
}
- auto manufacturingModeStatus =
+ const auto* manufacturingModeStatus =
std::get_if<std::string>(&getManufactMode);
handleSpecialModeChange(*manufacturingModeStatus);
},
diff --git a/tests/test_Utils.cpp b/tests/test_Utils.cpp
index 7b6b947..e12bc16 100644
--- a/tests/test_Utils.cpp
+++ b/tests/test_Utils.cpp
@@ -93,7 +93,7 @@
auto ret = findFiles(hwmonDir, R"(in\d+_input)", foundPaths);
EXPECT_TRUE(ret);
- EXPECT_EQ(foundPaths.size(), 0u);
+ EXPECT_EQ(foundPaths.size(), 0U);
}
TEST_F(TestUtils, findFiles_in_hwmon_match)
@@ -102,7 +102,7 @@
auto ret = findFiles(hwmonDir, R"(temp\d+_input)", foundPaths);
EXPECT_TRUE(ret);
- EXPECT_EQ(foundPaths.size(), 2u);
+ EXPECT_EQ(foundPaths.size(), 2U);
}
TEST_F(TestUtils, findFiles_in_peci_no_match)
@@ -123,7 +123,7 @@
findFiles(peciDir, R"(peci-\d+/\d+-.+/peci-.+/hwmon/hwmon\d+/name$)",
foundPaths, 6);
EXPECT_TRUE(ret);
- EXPECT_EQ(foundPaths.size(), 1u);
+ EXPECT_EQ(foundPaths.size(), 1U);
foundPaths.clear();
@@ -131,7 +131,7 @@
R"(peci-\d+/\d+-.+/peci-.+/hwmon/hwmon\d+/temp\d+_input)",
foundPaths, 6);
EXPECT_TRUE(ret);
- EXPECT_EQ(foundPaths.size(), 3u);
+ EXPECT_EQ(foundPaths.size(), 3U);
}
TEST_F(TestUtils, findFiles_hwmonPath_end_with_slash)
@@ -141,7 +141,7 @@
auto ret = findFiles(p, R"(temp\d+_input)", foundPaths);
EXPECT_TRUE(ret);
- EXPECT_EQ(foundPaths.size(), 2u);
+ EXPECT_EQ(foundPaths.size(), 2U);
}
TEST_F(TestUtils, findFiles_peciPath_end_with_slash)
@@ -153,7 +153,7 @@
foundPaths, 6);
EXPECT_TRUE(ret);
- EXPECT_EQ(foundPaths.size(), 3u);
+ EXPECT_EQ(foundPaths.size(), 3U);
}
TEST_F(TestUtils, findFiles_in_sub_peci_match)
@@ -163,7 +163,7 @@
findFiles(peciDir / "peci-0", R"(\d+-.+/peci-.+/hwmon/hwmon\d+/name$)",
foundPaths, 5);
EXPECT_TRUE(ret);
- EXPECT_EQ(foundPaths.size(), 1u);
+ EXPECT_EQ(foundPaths.size(), 1U);
foundPaths.clear();
@@ -171,5 +171,5 @@
R"(\d+-.+/peci-.+/hwmon/hwmon\d+/temp\d+_input)",
foundPaths, 5);
EXPECT_TRUE(ret);
- EXPECT_EQ(foundPaths.size(), 3u);
+ EXPECT_EQ(foundPaths.size(), 3U);
}