Add clang-tidy to phosphor-led-manager
This commit enables clang-tidy and adds few tidy checks.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I3a7b41545fef4c726b56aeab3e4b4000dfcac32f
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..e1143dd
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,61 @@
+Checks: ' -*,
+bugprone-argument-comment,
+bugprone-assert-side-effect,
+bugprone-bad-signal-to-kill-thread,
+bugprone-bool-pointer-implicit-conversion,
+bugprone-branch-clone,
+bugprone-copy-constructor-init,
+bugprone-dangling-handle,
+bugprone-dynamic-static-initializers,
+bugprone-fold-init-type,
+bugprone-forward-declaration-namespace,
+bugprone-forwarding-reference-overload,
+bugprone-implicit-widening-of-multiplication-result,
+bugprone-inaccurate-erase,
+bugprone-incorrect-roundings,
+bugprone-infinite-loop,
+bugprone-integer-division,
+bugprone-lambda-function-name,
+bugprone-macro-parentheses,
+bugprone-macro-repeated-side-effects,
+bugprone-misplaced-operator-in-strlen-in-alloc,
+bugprone-misplaced-pointer-arithmetic-in-alloc,
+bugprone-misplaced-widening-cast,
+bugprone-move-forwarding-reference,
+bugprone-multiple-statement-macro,
+bugprone-narrowing-conversions,
+bugprone-no-escape,
+bugprone-not-null-terminated-result,
+bugprone-parent-virtual-call,
+bugprone-posix-return,
+bugprone-redundant-branch-condition,
+bugprone-reserved-identifier,
+bugprone-signal-handler,
+bugprone-signed-char-misuse,
+bugprone-sizeof-container,
+bugprone-sizeof-expression,
+bugprone-spuriously-wake-up-functions,
+bugprone-string-constructor,
+bugprone-string-integer-assignment,
+bugprone-string-literal-with-embedded-nul,
+bugprone-suspicious-enum-usage,
+bugprone-suspicious-include,
+bugprone-suspicious-memset-usage,
+bugprone-suspicious-missing-comma,
+bugprone-suspicious-semicolon,
+bugprone-suspicious-string-compare,
+bugprone-swapped-arguments,
+bugprone-terminating-continue,
+bugprone-throw-keyword-missing,
+bugprone-too-small-loop-variable,
+bugprone-undefined-memory-manipulation,
+bugprone-undelegated-constructor,
+bugprone-unhandled-exception-at-new,
+bugprone-unhandled-self-assignment,
+bugprone-unused-raii,
+bugprone-unused-return-value,
+bugprone-use-after-move,
+bugprone-virtual-near-miss'
+
+WarningsAsErrors: '*'
+HeaderFilterRegex: '.*.hpp'
diff --git a/manager/group.hpp b/manager/group.hpp
index 2febfbb..b6a5251 100644
--- a/manager/group.hpp
+++ b/manager/group.hpp
@@ -30,8 +30,8 @@
~Group() = default;
Group(const Group&) = delete;
Group& operator=(const Group&) = delete;
- Group(Group&&) = default;
- Group& operator=(Group&&) = default;
+ Group(Group&&) = delete;
+ Group& operator=(Group&&) = delete;
/** @brief Constructs LED Group
*
diff --git a/manager/lamptest/lamptest.cpp b/manager/lamptest/lamptest.cpp
index b306e51..8b98fbc 100644
--- a/manager/lamptest/lamptest.cpp
+++ b/manager/lamptest/lamptest.cpp
@@ -219,7 +219,7 @@
fs::create_directories(ledDirectory);
}
- std::ofstream(lampTestIndicator.c_str());
+ std::ofstream ofs(lampTestIndicator.c_str());
// Set all the Physical action to On for lamp test
for (const auto& path : physicalLEDPaths)
diff --git a/manager/lamptest/lamptest.hpp b/manager/lamptest/lamptest.hpp
index 21fd3b5..1d9dd86 100644
--- a/manager/lamptest/lamptest.hpp
+++ b/manager/lamptest/lamptest.hpp
@@ -26,8 +26,8 @@
~LampTest() = default;
LampTest(const LampTest&) = delete;
LampTest& operator=(const LampTest&) = delete;
- LampTest(LampTest&&) = default;
- LampTest& operator=(LampTest&&) = default;
+ LampTest(LampTest&&) = delete;
+ LampTest& operator=(LampTest&&) = delete;
/** @brief Constructs LED LampTest
*