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/CPUSensor.cpp b/src/CPUSensor.cpp
index ea56d03..c28b230 100644
--- a/src/CPUSensor.cpp
+++ b/src/CPUSensor.cpp
@@ -14,12 +14,10 @@
// limitations under the License.
*/
-#include "CPUSensor.hpp"
-
-#include "Utils.hpp"
-
#include <unistd.h>
+#include <CPUSensor.hpp>
+#include <Utils.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/asio/read_until.hpp>
@@ -39,12 +37,11 @@
sdbusplus::asio::object_server& objectServer,
std::shared_ptr<sdbusplus::asio::connection>& conn,
boost::asio::io_service& io, const std::string& sensorName,
- std::vector<thresholds::Threshold>&& _thresholds,
+ std::vector<thresholds::Threshold>&& thresholds,
const std::string& sensorConfiguration, int cpuId,
bool show, double dtsOffset) :
- Sensor(boost::replace_all_copy(sensorName, " ", "_"),
- std::move(_thresholds), sensorConfiguration, objectType, 0, 0, conn,
- PowerState::on),
+ Sensor(boost::replace_all_copy(sensorName, " ", "_"), std::move(thresholds),
+ sensorConfiguration, objectType, 0, 0, conn, PowerState::on),
objServer(objectServer), inputDev(io), waitTimer(io), path(path),
privTcontrol(std::numeric_limits<double>::quiet_NaN()),
dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs),
@@ -205,7 +202,7 @@
{
return; // we're being destroyed
}
- else if (err == boost::system::errc::operation_canceled)
+ if (err == boost::system::errc::operation_canceled)
{
if (readingStateGood())
{
@@ -214,7 +211,7 @@
std::cerr << name << " interface down!\n";
loggedInterfaceDown = true;
}
- pollTime = 10000 + rand() % 10000;
+ pollTime = CPUSensor::sensorPollMs * 10u;
markFunctional(false);
}
return;