Write the clang-tidy file OpenBMC needs
Now that CI can handle clang-tidy, and a lot of the individual fixes
have landed for the various static analysis checks, lets see how close
we are.
This includes bringing a bunch of the code up to par with the checks
that require. Most of them fall into the category of extraneous else
statements, const correctness problems, or extra copies.
Tested:
CI only. Unit tests pass.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I9fbd346560a75fdd3901fa40c57932486275e912
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 897c5c4..266843e 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -83,15 +83,15 @@
{
return "Administrator";
}
- else if (role == "priv-user")
+ if (role == "priv-user")
{
return "ReadOnly";
}
- else if (role == "priv-operator")
+ if (role == "priv-operator")
{
return "Operator";
}
- else if ((role == "") || (role == "priv-noaccess"))
+ if ((role == "") || (role == "priv-noaccess"))
{
return "NoAccess";
}
@@ -103,15 +103,15 @@
{
return "priv-admin";
}
- else if (role == "ReadOnly")
+ if (role == "ReadOnly")
{
return "priv-user";
}
- else if (role == "Operator")
+ if (role == "Operator")
{
return "priv-operator";
}
- else if ((role == "NoAccess") || (role == ""))
+ if ((role == "NoAccess") || (role == ""))
{
return "priv-noaccess";
}
@@ -185,7 +185,7 @@
{"GroupsAttribute", confData.groupAttribute}}}}},
};
- json_response[ldapType].update(std::move(ldap));
+ json_response[ldapType].update(ldap);
nlohmann::json& roleMapArray = json_response[ldapType]["RemoteRoleMapping"];
roleMapArray = nlohmann::json::array();
@@ -365,7 +365,7 @@
{"RemoteGroup", *remoteGroup}});
},
ldapDbusService, dbusObjectPath, ldapPrivMapperInterface,
- "Create", std::move(*remoteGroup),
+ "Create", *remoteGroup,
getPrivilegeFromRoleId(std::move(*localRole)));
}
}
@@ -1731,28 +1731,25 @@
locked);
return;
}
- else
- {
- crow::connections::systemBus->async_method_call(
- [this, asyncResp, username, password(std::move(password)),
- roleId(std::move(roleId)), enabled(std::move(enabled)),
- newUser{std::string(*newUserName)},
- locked(std::move(locked))](const boost::system::error_code ec,
- sdbusplus::message::message& m) {
- if (ec)
- {
- userErrorMessageHandler(m.get_error(), asyncResp,
- newUser, username);
- return;
- }
+ crow::connections::systemBus->async_method_call(
+ [this, asyncResp, username, password(std::move(password)),
+ roleId(std::move(roleId)), enabled(std::move(enabled)),
+ newUser{std::string(*newUserName)},
+ locked(std::move(locked))](const boost::system::error_code ec,
+ sdbusplus::message::message& m) {
+ if (ec)
+ {
+ userErrorMessageHandler(m.get_error(), asyncResp, newUser,
+ username);
+ return;
+ }
- updateUserProperties(asyncResp, newUser, password, enabled,
- roleId, locked);
- },
- "xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user",
- "xyz.openbmc_project.User.Manager", "RenameUser", username,
- *newUserName);
- }
+ updateUserProperties(asyncResp, newUser, password, enabled,
+ roleId, locked);
+ },
+ "xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user",
+ "xyz.openbmc_project.User.Manager", "RenameUser", username,
+ *newUserName);
}
void updateUserProperties(std::shared_ptr<AsyncResp> asyncResp,