readability-static-accessed-through-instance
We access std::string::npos through member variables in a couple places.
Fix it.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I587f89e1580661aa311dfe4e06591ab38806e241
diff --git a/.clang-tidy b/.clang-tidy
index 9958891..b4e75ee 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -285,6 +285,7 @@
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-redundant-string-init,
+readability-static-accessed-through-instance,
readability-identifier-naming'
WarningsAsErrors: '*'
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index b457935..cb5d727 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -2049,7 +2049,7 @@
std::string destProperty;
const char* attrSeperator = "/attr/";
size_t attrPosition = objectPath.find(attrSeperator);
- if (attrPosition != objectPath.npos)
+ if (attrPosition != std::string::npos)
{
destProperty = objectPath.substr(attrPosition + strlen(attrSeperator),
objectPath.length());
@@ -2060,7 +2060,7 @@
{
constexpr const char* actionSeperator = "/action/";
size_t actionPosition = objectPath.find(actionSeperator);
- if (actionPosition != objectPath.npos)
+ if (actionPosition != std::string::npos)
{
std::string postProperty =
objectPath.substr((actionPosition + strlen(actionSeperator)),
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index b2c5d4c..e72e81d 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -318,7 +318,7 @@
std::string_view tsStr(entryID);
auto underscorePos = tsStr.find('_');
- if (underscorePos != tsStr.npos)
+ if (underscorePos != std::string_view::npos)
{
// Timestamp has an index
tsStr.remove_suffix(tsStr.size() - underscorePos);