clang-tidy: enable clang-tidy
Enable the first check: readability-identifier-naming
Also fixed all check failures.
Tested:
1. compiles, no clang-tidy failures
2. the two daemons work correctly on hardware regarding DBus APIs
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ic415e857726e8f521c1d61a3e7f0c85121c0d284
diff --git a/phosphor-ldap-config/ldap_config.cpp b/phosphor-ldap-config/ldap_config.cpp
index 97e23ca..b7bd4c6 100644
--- a/phosphor-ldap-config/ldap_config.cpp
+++ b/phosphor-ldap-config/ldap_config.cpp
@@ -25,8 +25,8 @@
{
constexpr auto nslcdService = "nslcd.service";
-constexpr auto LDAPscheme = "ldap";
-constexpr auto LDAPSscheme = "ldaps";
+constexpr auto ldapScheme = "ldap";
+constexpr auto ldapsScheme = "ldaps";
constexpr auto certObjPath = "/xyz/openbmc_project/certs/client/ldap/1";
constexpr auto certRootPath = "/xyz/openbmc_project/certs/client/ldap";
constexpr auto authObjPath = "/xyz/openbmc_project/certs/authority/ldap";
@@ -362,11 +362,11 @@
{
return value;
}
- if (isValidLDAPURI(value, LDAPSscheme))
+ if (isValidLDAPURI(value, ldapsScheme))
{
secureLDAP = true;
}
- else if (isValidLDAPURI(value, LDAPscheme))
+ else if (isValidLDAPURI(value, ldapScheme))
{
secureLDAP = false;
}
@@ -717,11 +717,11 @@
cereal::BinaryInputArchive iarchive(is);
iarchive(*this);
- if (isValidLDAPURI(ldapServerURI(), LDAPscheme))
+ if (isValidLDAPURI(ldapServerURI(), ldapScheme))
{
secureLDAP = false;
}
- else if (isValidLDAPURI(ldapServerURI(), LDAPSscheme))
+ else if (isValidLDAPURI(ldapServerURI(), ldapsScheme))
{
secureLDAP = true;
}
diff --git a/phosphor-ldap-config/ldap_config_mgr.cpp b/phosphor-ldap-config/ldap_config_mgr.cpp
index 87791b8..a359273 100644
--- a/phosphor-ldap-config/ldap_config_mgr.cpp
+++ b/phosphor-ldap-config/ldap_config_mgr.cpp
@@ -14,8 +14,8 @@
constexpr auto nslcdService = "nslcd.service";
constexpr auto nscdService = "nscd.service";
-constexpr auto LDAPscheme = "ldap";
-constexpr auto LDAPSscheme = "ldaps";
+constexpr auto ldapScheme = "ldap";
+constexpr auto ldapsScheme = "ldaps";
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
@@ -84,11 +84,11 @@
{
bool secureLDAP = false;
- if (isValidLDAPURI(ldapServerURI, LDAPSscheme))
+ if (isValidLDAPURI(ldapServerURI, ldapsScheme))
{
secureLDAP = true;
}
- else if (isValidLDAPURI(ldapServerURI, LDAPscheme))
+ else if (isValidLDAPURI(ldapServerURI, ldapScheme))
{
secureLDAP = false;
}
@@ -145,7 +145,7 @@
else
{
ADConfigPtr.reset(nullptr);
- objPath = ADDbusObjectPath;
+ objPath = adDbusObjectPath;
ADConfigPtr = std::make_unique<Config>(
bus, objPath.c_str(), configFilePath.c_str(), tlsCacertFile.c_str(),
tlsCertFile.c_str(), secureLDAP, ldapServerURI, ldapBindDN,
@@ -171,7 +171,7 @@
if (!ADConfigPtr)
{
ADConfigPtr = std::make_unique<Config>(
- bus, ADDbusObjectPath.c_str(), configFilePath.c_str(),
+ bus, adDbusObjectPath.c_str(), configFilePath.c_str(),
tlsCacertFile.c_str(), tlsCertFile.c_str(),
ConfigIface::Type::ActiveDirectory, *this);
ADConfigPtr->emit_object_added();
diff --git a/phosphor-ldap-config/ldap_config_mgr.hpp b/phosphor-ldap-config/ldap_config_mgr.hpp
index af3051c..850fc54 100644
--- a/phosphor-ldap-config/ldap_config_mgr.hpp
+++ b/phosphor-ldap-config/ldap_config_mgr.hpp
@@ -22,7 +22,7 @@
static constexpr auto nsSwitchFile = "nsswitch.conf";
static auto openLDAPDbusObjectPath =
std::string(LDAP_CONFIG_ROOT) + "/openldap";
-static auto ADDbusObjectPath =
+static auto adDbusObjectPath =
std::string(LDAP_CONFIG_ROOT) + "/active_directory";
using namespace phosphor::logging;
diff --git a/phosphor-ldap-config/utils.cpp b/phosphor-ldap-config/utils.cpp
index 66e1474..4ad69d9 100644
--- a/phosphor-ldap-config/utils.cpp
+++ b/phosphor-ldap-config/utils.cpp
@@ -14,7 +14,7 @@
namespace ldap
{
-bool isValidLDAPURI(const std::string& URI, const char* scheme)
+bool isValidLDAPURI(const std::string& uri, const char* scheme)
{
// Return false if the user tries to configure port 0
// This check is not done in line 42, because ldap_url_parse
@@ -22,14 +22,14 @@
// will always return true (thus allowing the user to
// configure port 0)
- if (boost::algorithm::ends_with(URI, ":0"))
+ if (boost::algorithm::ends_with(uri, ":0"))
{
return false;
}
LDAPURLDesc* ludpp = nullptr;
int res = LDAP_URL_ERR_BADURL;
- res = ldap_url_parse(URI.c_str(), &ludpp);
+ res = ldap_url_parse(uri.c_str(), &ludpp);
auto ludppCleanupFunc = [](LDAPURLDesc* ludpp) {
ldap_free_urldesc(ludpp);
diff --git a/phosphor-ldap-config/utils.hpp b/phosphor-ldap-config/utils.hpp
index 984aae6..b1450b7 100644
--- a/phosphor-ldap-config/utils.hpp
+++ b/phosphor-ldap-config/utils.hpp
@@ -14,7 +14,7 @@
* against LDAPS type URI, for LDAP type URI it is equals to "ldap".
* @returns true if it is valid otherwise false.
*/
-bool isValidLDAPURI(const std::string& URI, const char* scheme);
+bool isValidLDAPURI(const std::string& uri, const char* scheme);
} // namespace ldap
} // namespace phosphor