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/PSUEvent.cpp b/src/PSUEvent.cpp
index 4266918..375c24d 100644
--- a/src/PSUEvent.cpp
+++ b/src/PSUEvent.cpp
@@ -14,10 +14,9 @@
// limitations under the License.
*/
-#include "PSUEvent.hpp"
-
#include <systemd/sd-journal.h>
+#include <PSUEvent.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/asio/read_until.hpp>
#include <boost/container/flat_map.hpp>
@@ -145,10 +144,10 @@
std::shared_ptr<std::set<std::string>> combineEvent,
std::shared_ptr<bool> state, const std::string& psuName) :
std::enable_shared_from_this<PSUSubEvent>(),
- eventInterface(eventInterface), asserts(asserts),
- combineEvent(combineEvent), assertState(state), errCount(0), path(path),
- eventName(eventName), 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)),
+ errCount(0), path(path), eventName(eventName), waitTimer(io), inputDev(io),
+ psuName(psuName), groupEventName(groupEventName), systemBus(conn)
{
fd = open(path.c_str(), O_RDONLY);
if (fd < 0)
@@ -174,7 +173,7 @@
if (fanPos != std::string::npos)
{
fanName = path.substr(fanPos);
- auto fanNamePos = fanName.find("_");
+ auto fanNamePos = fanName.find('_');
if (fanNamePos != std::string::npos)
{
fanName = fanName.substr(0, fanNamePos);