clang-tidy: Enable readability-static-accessed-through-instance check
Checks for member expressions that access static members through
instances, and replaces them with uses of the appropriate
qualified-id.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I24de8ac8897de839594c6c71319febd0209bbc2e
diff --git a/.clang-tidy b/.clang-tidy
index 43d168b..bbd7490 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -271,6 +271,7 @@
readability-redundant-smartptr-get,
readability-redundant-string-init,
readability-simplify-subscript-expr,
+readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-suspicious-call-argument,
diff --git a/manager/json-config.hpp b/manager/json-config.hpp
index b4a4efa..7d94f20 100644
--- a/manager/json-config.hpp
+++ b/manager/json-config.hpp
@@ -159,14 +159,14 @@
try
{
// Get all objects implementing the compatible interface
- auto objects =
- dBusHandler.getSubTreePaths("/", confCompatibleInterface);
+ auto objects = phosphor::led::utils::DBusHandler::getSubTreePaths(
+ "/", confCompatibleInterface);
for (const auto& path : objects)
{
try
{
// Retrieve json config compatible relative path locations
- auto value = dBusHandler.getProperty(
+ auto value = phosphor::led::utils::DBusHandler::getProperty(
path, confCompatibleInterface, confCompatibleProperty);
auto confCompatValues =
@@ -218,9 +218,6 @@
* interface to show up.
*/
std::unique_ptr<sdbusplus::bus::match_t> match;
-
- /** DBusHandler class handles the D-Bus operations */
- utils::DBusHandler dBusHandler;
};
/** Blocking call to find the JSON Config from DBus. */
diff --git a/manager/led-main.cpp b/manager/led-main.cpp
index 7791747..f671d5d 100644
--- a/manager/led-main.cpp
+++ b/manager/led-main.cpp
@@ -66,7 +66,7 @@
phosphor::led::LampTest lampTest(event, manager);
// Clear leds triggered by lamp test in previous boot
- lampTest.clearLamps();
+ phosphor::led::LampTest::clearLamps();
groups.emplace_back(std::make_unique<phosphor::led::Group>(
bus, LAMP_TEST_OBJECT, manager, serializePtr,
diff --git a/test/utest-group-priority.cpp b/test/utest-group-priority.cpp
index f47e5f2..9d31905 100644
--- a/test/utest-group-priority.cpp
+++ b/test/utest-group-priority.cpp
@@ -59,7 +59,7 @@
assertedGroups.insert(&mygroup);
std::map<LedName, Layout::LedAction> map =
- manager.getNewMap(assertedGroups);
+ phosphor::led::Manager::getNewMap(assertedGroups);
assertMap(map, {
{"led1", Layout::Action::On},
@@ -107,7 +107,7 @@
assertedGroups.insert(&groupC);
std::map<LedName, Layout::LedAction> map =
- manager.getNewMap(assertedGroups);
+ phosphor::led::Manager::getNewMap(assertedGroups);
assertMap(map, {
{"led1", Layout::Action::On},
@@ -190,7 +190,7 @@
// Off Service Action
assertedGroups.insert(&groups->at(groupOffServiceAction));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{pwr, Layout::Action::Off},
{fault, Layout::Action::Off},
@@ -198,7 +198,7 @@
// On Ok
assertedGroups.insert(&groups->at(groupSysOnOk));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{pwr, Layout::Action::On},
{fault, Layout::Action::Off},
@@ -206,7 +206,7 @@
// Off Fault
assertedGroups.insert(&groups->at(groupSysOffFault));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{pwr, Layout::Action::Off},
{fault, Layout::Action::On},
@@ -214,7 +214,7 @@
// Off Fault
assertedGroups.insert(&groups->at(groupSysOffFault));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{pwr, Layout::Action::Off},
{fault, Layout::Action::On},
@@ -222,7 +222,7 @@
// On Fault
assertedGroups.insert(&groups->at(groupSysOnFault));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{pwr, Layout::Action::On},
{fault, Layout::Action::On},
@@ -230,7 +230,7 @@
// Off Locate
assertedGroups.insert(&groups->at(groupSysOffLocate));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{pwr, Layout::Action::Off},
{fault, Layout::Action::Blink},
@@ -238,7 +238,7 @@
// On Locate
assertedGroups.insert(&groups->at(groupSysOnLocate));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{pwr, Layout::Action::On},
{fault, Layout::Action::Blink},
@@ -336,7 +336,7 @@
// Sleep
assertedGroups.insert(&groups->at(gBBUSleep));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{bbu_ok, Layout::Action::Off},
{bbu_fault, Layout::Action::Off},
@@ -346,7 +346,7 @@
// Fault
assertedGroups.insert(&groups->at(gBBUFault));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{bbu_ok, Layout::Action::Off},
{bbu_fault, Layout::Action::On},
@@ -356,7 +356,7 @@
// EOL
assertedGroups.insert(&groups->at(gBBUEOL));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{bbu_ok, Layout::Action::Off},
{bbu_fault, Layout::Action::On},
@@ -366,7 +366,7 @@
// On + Locate
assertedGroups.insert(&groups->at(gBBUOnLocate));
- assertMap(manager.getNewMap(assertedGroups),
+ assertMap(phosphor::led::Manager::getNewMap(assertedGroups),
{
{bbu_ok, Layout::Action::On},
{bbu_fault, Layout::Action::Blink},