Implement clang-tidy fixes
clang-tidy allows the CI robot to check many things via static analysis.
All changes here were made by the clang-tidy robot, and include a number
of modernization fixes. updating the tidy file will be done at a later
date.
Signed-off-by: Ed Tanous <etanous@nvidia.com>
Change-Id: I98cc4d600a3c589675507958f6d2350b2141216b
diff --git a/test/controller_mock.hpp b/test/controller_mock.hpp
index 9a8e7a6..533b6db 100644
--- a/test/controller_mock.hpp
+++ b/test/controller_mock.hpp
@@ -12,7 +12,7 @@
class ControllerMock : public PIDController
{
public:
- virtual ~ControllerMock() = default;
+ ~ControllerMock() override = default;
ControllerMock(const std::string& id, ZoneInterface* owner) :
PIDController(id, owner)
diff --git a/test/dbus_passive_unittest.cpp b/test/dbus_passive_unittest.cpp
index bee64c7..9989e0d 100644
--- a/test/dbus_passive_unittest.cpp
+++ b/test/dbus_passive_unittest.cpp
@@ -20,8 +20,6 @@
namespace
{
-using ::testing::_;
-using ::testing::InSequence;
using ::testing::Invoke;
using ::testing::IsNull;
using ::testing::NotNull;
diff --git a/test/dbushelper_mock.hpp b/test/dbushelper_mock.hpp
index cdbc59d..b11eff3 100644
--- a/test/dbushelper_mock.hpp
+++ b/test/dbushelper_mock.hpp
@@ -12,7 +12,7 @@
class DbusHelperMock : public DbusHelperInterface
{
public:
- virtual ~DbusHelperMock() = default;
+ ~DbusHelperMock() override = default;
MOCK_METHOD2(getService,
std::string(const std::string&, const std::string&));
diff --git a/test/pid_fancontroller_unittest.cpp b/test/pid_fancontroller_unittest.cpp
index 97dda0a..3fc6433 100644
--- a/test/pid_fancontroller_unittest.cpp
+++ b/test/pid_fancontroller_unittest.cpp
@@ -21,8 +21,6 @@
{
using ::testing::_;
-using ::testing::DoubleEq;
-using ::testing::Invoke;
using ::testing::Return;
using ::testing::StrEq;
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index e4e7a26..37fb0fa 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -92,7 +92,7 @@
{
protected:
PidZoneTest() :
- property_index(), properties(), sdbus_mock_passive(), sdbus_mock_host(),
+ properties(), sdbus_mock_passive(), sdbus_mock_host(),
sdbus_mock_mode(), sdbus_mock_enable()
{
EXPECT_CALL(sdbus_mock_host,
@@ -122,7 +122,7 @@
}
// unused
- double property_index;
+ double property_index{};
std::vector<std::string> properties;
double propertyenable_index;
std::vector<std::string> propertiesenable;
@@ -322,7 +322,7 @@
std::map<std::string, std::pair<std::string, double>> failSensorList =
zone->getFailSafeSensors();
- EXPECT_EQ(1, failSensorList.size());
+ EXPECT_EQ(1U, failSensorList.size());
EXPECT_EQ("Sensor threshold asserted", failSensorList["temp1"].first);
EXPECT_EQ(failSafePercent, failSensorList["temp1"].second);
}
@@ -349,7 +349,7 @@
std::map<std::string, std::pair<std::string, double>> failSensorList =
zone->getFailSafeSensors();
- EXPECT_EQ(3, failSensorList.size());
+ EXPECT_EQ(3U, failSensorList.size());
EXPECT_EQ("Sensor threshold asserted", failSensorList["temp1"].first);
EXPECT_EQ(60, failSensorList["temp1"].second);
EXPECT_EQ("Sensor reading bad", failSensorList["temp2"].first);
diff --git a/test/readinterface_mock.hpp b/test/readinterface_mock.hpp
index 0b77c8a..3634518 100644
--- a/test/readinterface_mock.hpp
+++ b/test/readinterface_mock.hpp
@@ -10,7 +10,7 @@
class ReadInterfaceMock : public ReadInterface
{
public:
- virtual ~ReadInterfaceMock() = default;
+ ~ReadInterfaceMock() override = default;
MOCK_METHOD0(read, ReadReturn());
};
diff --git a/test/sensor_mock.hpp b/test/sensor_mock.hpp
index 1de68b6..ae4cf13 100644
--- a/test/sensor_mock.hpp
+++ b/test/sensor_mock.hpp
@@ -11,7 +11,7 @@
class SensorMock : public Sensor
{
public:
- virtual ~SensorMock() = default;
+ ~SensorMock() override = default;
SensorMock(const std::string& name, int64_t timeout) : Sensor(name, timeout)
{}
diff --git a/test/writeinterface_mock.hpp b/test/writeinterface_mock.hpp
index 669c1d9..409178c 100644
--- a/test/writeinterface_mock.hpp
+++ b/test/writeinterface_mock.hpp
@@ -10,7 +10,7 @@
class WriteInterfaceMock : public WriteInterface
{
public:
- virtual ~WriteInterfaceMock() = default;
+ ~WriteInterfaceMock() override = default;
WriteInterfaceMock(int64_t min, int64_t max) : WriteInterface(min, max) {}
diff --git a/test/zone_mock.hpp b/test/zone_mock.hpp
index 7d08f63..dcf6b2a 100644
--- a/test/zone_mock.hpp
+++ b/test/zone_mock.hpp
@@ -13,7 +13,7 @@
class ZoneMock : public ZoneInterface
{
public:
- virtual ~ZoneMock() = default;
+ ~ZoneMock() override = default;
MOCK_METHOD0(updateFanTelemetry, void());
MOCK_METHOD0(updateSensors, void());
@@ -21,7 +21,7 @@
MOCK_METHOD1(getCachedValue, double(const std::string&));
// Compatibility interface for getCachedValues
- ValueCacheEntry getCachedValues(const std::string& s)
+ ValueCacheEntry getCachedValues(const std::string& s) override
{
auto v = getCachedValue(s);
return {v, v};