Update clang-tidy
Fix a bunch of minor issues, ignore others. We use a lot of global
variables. Enabling a check will hopefully make sure we don't add more.
Change-Id: Ie76053d4afc95a5372b70b2fb768be464468cec0
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/src/fru_device.cpp b/src/fru_device.cpp
index 134d355..05f12bf 100644
--- a/src/fru_device.cpp
+++ b/src/fru_device.cpp
@@ -72,6 +72,8 @@
const static constexpr char* i2CDevLocation = "/dev";
+// TODO Refactor these to not be globals
+// NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables)
static boost::container::flat_map<size_t, std::optional<std::set<size_t>>>
busBlocklist;
struct FindDevicesWithCallback;
@@ -84,6 +86,7 @@
static boost::container::flat_map<size_t, std::set<size_t>> fruAddresses;
boost::asio::io_context io;
+// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables)
bool updateFRUProperty(
const std::string& updatePropertyReq, uint32_t bus, uint32_t address,
@@ -621,13 +624,13 @@
auto addresses =
addressData.get<std::set<std::string_view>>();
- busBlocklist[bus].emplace();
+ auto& block = busBlocklist[bus].emplace();
for (const auto& address : addresses)
{
size_t addressInt = 0;
std::from_chars(address.begin() + 2, address.end(),
addressInt, 16);
- busBlocklist[bus]->insert(addressInt);
+ block.insert(addressInt);
}
}
else
@@ -1416,6 +1419,7 @@
case IN_CREATE:
case IN_MOVED_TO:
case IN_DELETE:
+ {
std::string_view name(&iEvent->name[0], iEvent->len);
if (boost::starts_with(name, "i2c"))
{
@@ -1438,6 +1442,10 @@
unknownBusObjectCount, powerIsOn,
objServer, systemBus);
}
+ }
+ break;
+ default:
+ break;
}
index += sizeof(inotify_event) + iEvent->len;
}