diff --git a/include/fru_reader.hpp b/include/fru_reader.hpp
index b1d21d8..f54d900 100644
--- a/include/fru_reader.hpp
+++ b/include/fru_reader.hpp
@@ -39,7 +39,7 @@
 class FRUReader
 {
   public:
-    FRUReader(ReadBlockFunc readFunc) : readFunc(std::move(readFunc))
+    explicit FRUReader(ReadBlockFunc readFunc) : readFunc(std::move(readFunc))
     {}
     // The ::read() operation here is analogous to ReadBlockFunc (with the same
     // return value semantics), but is not subject to SMBus block size
diff --git a/include/fru_utils.hpp b/include/fru_utils.hpp
index ebb2b19..e50b580 100644
--- a/include/fru_utils.hpp
+++ b/include/fru_utils.hpp
@@ -17,6 +17,7 @@
 
 #pragma once
 #include "fru_reader.hpp"
+
 #include <boost/container/flat_map.hpp>
 
 #include <cstdint>
@@ -94,7 +95,7 @@
 char sixBitToChar(uint8_t val);
 
 /* 0xd - 0xf are reserved values, but not fatal; use a placeholder char. */
-const char bcdHighChars[] = {
+constexpr std::array<char, 6> bcdHighChars = {
     ' ', '-', '.', 'X', 'X', 'X',
 };
 
diff --git a/include/utils.hpp b/include/utils.hpp
index bc8ac1b..99e2f85 100644
--- a/include/utils.hpp
+++ b/include/utils.hpp
@@ -132,22 +132,20 @@
 }
 
 std::optional<std::string> templateCharReplace(
-    nlohmann::json::iterator& keyPair, const DBusObject& object,
-    const size_t index,
+    nlohmann::json::iterator& keyPair, const DBusObject& object, size_t index,
     const std::optional<std::string>& replaceStr = std::nullopt);
 
 std::optional<std::string> templateCharReplace(
     nlohmann::json::iterator& keyPair, const DBusInterface& interface,
-    const size_t index,
-    const std::optional<std::string>& replaceStr = std::nullopt);
+    size_t index, const std::optional<std::string>& replaceStr = std::nullopt);
 
 inline bool deviceHasLogging(const nlohmann::json& json)
 {
     auto logging = json.find("Logging");
     if (logging != json.end())
     {
-        auto ptr = logging->get_ptr<const std::string*>();
-        if (ptr)
+        const auto* ptr = logging->get_ptr<const std::string*>();
+        if (ptr != nullptr)
         {
             if (*ptr == "Off")
             {
diff --git a/src/entity_manager.cpp b/src/entity_manager.cpp
index 4a730b0..bfda895 100644
--- a/src/entity_manager.cpp
+++ b/src/entity_manager.cpp
@@ -200,7 +200,7 @@
 }
 
 template <typename PropertyType>
-void addProperty(const std::string& propertyName, const PropertyType& value,
+void addProperty(const std::string& name, const PropertyType& value,
                  sdbusplus::asio::dbus_interface* iface,
                  nlohmann::json& systemConfiguration,
                  const std::string& jsonPointerString,
@@ -208,11 +208,11 @@
 {
     if (permission == sdbusplus::asio::PropertyPermission::readOnly)
     {
-        iface->register_property(propertyName, value);
+        iface->register_property(name, value);
         return;
     }
     iface->register_property(
-        propertyName, value,
+        name, value,
         [&systemConfiguration,
          jsonPointerString{std::string(jsonPointerString)}](
             const PropertyType& newVal, PropertyType& val) {
@@ -282,7 +282,7 @@
         if (value.type() == nlohmann::json::value_t::array)
         {
             array = true;
-            if (!value.size())
+            if (value.empty())
             {
                 continue;
             }
@@ -461,8 +461,11 @@
             for (const auto& item : data)
             {
                 nlohmann::json& newJson = newData[item.first];
-                std::visit([&newJson](auto&& val) { newJson = std::move(val); },
-                           item.second);
+                std::visit(
+                    [&newJson](auto&& val) {
+                        newJson = std::forward<decltype(val)>(val);
+                    },
+                    item.second);
             }
 
             auto findName = newData.find("Name");
@@ -708,7 +711,7 @@
                 else if (config.type() == nlohmann::json::value_t::array)
                 {
                     size_t index = 0;
-                    if (!config.size())
+                    if (config.empty())
                     {
                         continue;
                     }
@@ -838,8 +841,8 @@
         return false;
     }
 
-    auto ptr = powerState->get_ptr<const std::string*>();
-    if (!ptr)
+    const auto* ptr = powerState->get_ptr<const std::string*>();
+    if (ptr == nullptr)
     {
         return false;
     }
diff --git a/src/fru_device.cpp b/src/fru_device.cpp
index b503d80..9d07e8e 100644
--- a/src/fru_device.cpp
+++ b/src/fru_device.cpp
@@ -32,6 +32,7 @@
 
 #include <array>
 #include <cerrno>
+#include <charconv>
 #include <chrono>
 #include <ctime>
 #include <filesystem>
@@ -81,10 +82,8 @@
 
 boost::asio::io_service io;
 
-uint8_t calculateChecksum(std::vector<uint8_t>::const_iterator iter,
-                          std::vector<uint8_t>::const_iterator end);
 bool updateFRUProperty(
-    const std::string& assetTag, uint32_t bus, uint32_t address,
+    const std::string& updatePropertyReq, uint32_t bus, uint32_t address,
     const std::string& propertyName,
     boost::container::flat_map<
         std::pair<size_t, size_t>,
@@ -128,14 +127,17 @@
     return read(fd, buf, len);
 }
 
-static int busStrToInt(const std::string& busName)
+static int busStrToInt(const std::string_view busName)
 {
     auto findBus = busName.rfind('-');
     if (findBus == std::string::npos)
     {
         return -1;
     }
-    return std::stoi(busName.substr(findBus + 1));
+    std::string_view num = busName.substr(findBus + 1);
+    int val = 0;
+    std::from_chars(num.data(), num.data() + num.size(), val);
+    return val;
 }
 
 static int getRootBus(size_t bus)
@@ -233,9 +235,10 @@
         return -1;
     }
 
-#define SMBUS_IOCTL_WRITE_THEN_READ_MSG_COUNT 2
-    struct i2c_msg msgs[SMBUS_IOCTL_WRITE_THEN_READ_MSG_COUNT];
-    struct i2c_rdwr_ioctl_data rdwr;
+    constexpr size_t smbusWriteThenReadMsgCount = 2;
+    std::array<struct i2c_msg, smbusWriteThenReadMsgCount> msgs{};
+    struct i2c_rdwr_ioctl_data rdwr
+    {};
 
     msgs[0].addr = address;
     msgs[0].flags = 0;
@@ -246,12 +249,12 @@
     msgs[1].len = fromSlaveBufLen;
     msgs[1].buf = fromSlaveBuf;
 
-    rdwr.msgs = msgs;
-    rdwr.nmsgs = SMBUS_IOCTL_WRITE_THEN_READ_MSG_COUNT;
+    rdwr.msgs = msgs.data();
+    rdwr.nmsgs = msgs.size();
 
     int ret = ioctl(file, I2C_RDWR, &rdwr);
 
-    return (ret == SMBUS_IOCTL_WRITE_THEN_READ_MSG_COUNT) ? msgs[1].len : -1;
+    return (ret == msgs.size()) ? msgs[1].len : -1;
 }
 
 static int64_t readBlockData(bool is16bit, int file, uint16_t address,
@@ -264,8 +267,9 @@
     }
 
     offset = htobe16(offset);
-    return i2cSmbusWriteThenRead(
-        file, address, reinterpret_cast<uint8_t*>(&offset), 2, buf, len);
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
+    uint8_t* u8Offset = reinterpret_cast<uint8_t*>(&offset);
+    return i2cSmbusWriteThenRead(file, address, u8Offset, 2, buf, len);
 }
 
 // TODO: This code is very similar to the non-eeprom version and can be merged
@@ -323,7 +327,7 @@
         std::ssub_match subMatch = m[1];
         std::string addressString = subMatch.str();
 
-        std::size_t ignored;
+        std::size_t ignored = 0;
         const int hexBase = 16;
         int address = std::stoi(addressString, &ignored, hexBase);
 
@@ -535,17 +539,15 @@
             std::exit(EXIT_FAILURE);
         }
     }
-
-    return;
 }
 
 static void findI2CDevices(const std::vector<fs::path>& i2cBuses,
                            BusMap& busmap, const bool& powerIsOn,
                            sdbusplus::asio::object_server& objServer)
 {
-    for (auto& i2cBus : i2cBuses)
+    for (const auto& i2cBus : i2cBuses)
     {
-        int bus = busStrToInt(i2cBus);
+        int bus = busStrToInt(i2cBus.string());
 
         if (bus < 0)
         {
@@ -580,8 +582,8 @@
             close(file);
             continue;
         }
-        if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE) ||
-            !(I2C_FUNC_SMBUS_READ_I2C_BLOCK))
+        if (((funcs & I2C_FUNC_SMBUS_READ_BYTE) == 0U) ||
+            ((I2C_FUNC_SMBUS_READ_I2C_BLOCK) == 0))
         {
             std::cerr << "Error: Can't use SMBus Receive Byte command bus "
                       << bus << "\n";
@@ -804,8 +806,9 @@
         size_t fileSize = static_cast<size_t>(baseboardFRUFile.tellg());
         baseboardFRU.resize(fileSize);
         baseboardFRUFile.seekg(0, std::ios_base::beg);
-        baseboardFRUFile.read(reinterpret_cast<char*>(baseboardFRU.data()),
-                              fileSize);
+        // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
+        char* charOffset = reinterpret_cast<char*>(baseboardFRU.data());
+        baseboardFRUFile.read(charOffset, fileSize);
     }
     else
     {
@@ -838,7 +841,9 @@
             throw DBusInternalError();
             return false;
         }
-        file.write(reinterpret_cast<const char*>(fru.data()), fru.size());
+        // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
+        const char* charOffset = reinterpret_cast<const char*>(fru.data());
+        file.write(charOffset, fru.size());
         return file.good();
     }
 
@@ -888,7 +893,7 @@
     size_t retries = retryMax;
     while (index < fru.size())
     {
-        if ((index && ((index % (maxEepromPageIndex + 1)) == 0)) &&
+        if (((index != 0U) && ((index % (maxEepromPageIndex + 1)) == 0)) &&
             (retries == retryMax))
         {
             // The 4K EEPROM only uses the A2 and A1 device address bits
@@ -905,7 +910,7 @@
         if (i2c_smbus_write_byte_data(file, static_cast<uint8_t>(index),
                                       fru[index]) < 0)
         {
-            if (!retries--)
+            if ((retries--) == 0U)
             {
                 std::cerr << "error writing fru: " << strerror(errno) << "\n";
                 close(file);
@@ -1103,7 +1108,7 @@
         return false;
     }
 
-    const std::vector<std::string>* fruAreaFieldNames;
+    const std::vector<std::string>* fruAreaFieldNames = nullptr;
 
     uint8_t fruAreaOffsetFieldValue = 0;
     size_t offset = 0;
@@ -1151,10 +1156,10 @@
     size_t fruAreaEnd = fruAreaStart + fruAreaSize;
     size_t fruDataIter = fruAreaStart + offset;
     size_t skipToFRUUpdateField = 0;
-    ssize_t fieldLength;
+    ssize_t fieldLength = 0;
 
     bool found = false;
-    for (auto& field : *fruAreaFieldNames)
+    for (const auto& field : *fruAreaFieldNames)
     {
         skipToFRUUpdateField++;
         if (propertyName == propertyNamePrefix + field)
@@ -1235,7 +1240,7 @@
         }
     }
     std::vector<uint8_t> restFRUAreasData;
-    if (nextFRUAreaLoc)
+    if (nextFRUAreaLoc != 0U)
     {
         std::copy_n(fruData.begin() + nextFRUAreaLoc,
                     fruData.size() - nextFRUAreaLoc,
@@ -1429,7 +1434,7 @@
 
     int fd = inotify_init();
     inotify_add_watch(fd, i2CDevLocation, IN_CREATE | IN_MOVED_TO | IN_DELETE);
-    std::array<char, 4096> readBuffer;
+    std::array<char, 4096> readBuffer{};
     // monitor for new i2c devices
     boost::asio::posix::stream_descriptor dirWatch(io, fd);
     std::function<void(const boost::system::error_code, std::size_t)>
@@ -1443,14 +1448,15 @@
             size_t index = 0;
             while ((index + sizeof(inotify_event)) <= bytesTransferred)
             {
-                const inotify_event* iEvent =
-                    reinterpret_cast<const inotify_event*>(&readBuffer[index]);
+                const char* p = &readBuffer[index];
+                // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
+                const auto* iEvent = reinterpret_cast<const inotify_event*>(p);
                 switch (iEvent->mask)
                 {
                     case IN_CREATE:
                     case IN_MOVED_TO:
                     case IN_DELETE:
-                        std::string name(iEvent->name);
+                        std::string_view name(&iEvent->name[0], iEvent->len);
                         if (boost::starts_with(name, "i2c"))
                         {
                             int bus = busStrToInt(name);
diff --git a/src/fru_reader.cpp b/src/fru_reader.cpp
index e381e7e..61d4020 100644
--- a/src/fru_reader.cpp
+++ b/src/fru_reader.cpp
@@ -30,8 +30,8 @@
             break;
         }
 
-        const uint8_t* blkData;
-        size_t available;
+        const uint8_t* blkData = nullptr;
+        size_t available = 0;
         size_t blk = cursor / cacheBlockSize;
         size_t blkOffset = cursor % cacheBlockSize;
         auto findBlk = cache.find(blk);
@@ -52,7 +52,7 @@
             {
                 // don't leave empty blocks in the cache
                 cache.erase(blk);
-                return done ? done : ret;
+                return done != 0U ? done : ret;
             }
 
             blkData = newData;
@@ -80,6 +80,7 @@
                             ? 0
                             : std::min(available - blkOffset, remaining);
 
+        // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
         memcpy(outbuf + done, blkData + blkOffset, toCopy);
         cursor += toCopy;
         done += toCopy;
diff --git a/src/fru_utils.cpp b/src/fru_utils.cpp
index 99f4aa9..bc59af8 100644
--- a/src/fru_utils.cpp
+++ b/src/fru_utils.cpp
@@ -18,6 +18,7 @@
 #include "fru_utils.hpp"
 
 #include <array>
+#include <cstddef>
 #include <cstdint>
 #include <filesystem>
 #include <iostream>
@@ -75,7 +76,7 @@
                   bool isLangEng)
 {
     std::string value;
-    unsigned int i;
+    unsigned int i = 0;
 
     /* we need at least one byte to decode the type/len header */
     if (iter == end)
@@ -171,7 +172,7 @@
 {
     // If Lang is not English then the encoding is defined as 2-byte UNICODE,
     // but we don't support that.
-    if (lang && lang != 25)
+    if ((lang != 0U) && lang != 25)
     {
         std::cerr << "Warning: languages other than English is not "
                      "supported\n";
@@ -269,7 +270,7 @@
     result["Common_Format_Version"] =
         std::to_string(static_cast<int>(*fruBytes.begin()));
 
-    const std::vector<std::string>* fruAreaFieldNames;
+    const std::vector<std::string>* fruAreaFieldNames = nullptr;
 
     // Don't parse Internal and Multirecord areas
     for (fruAreas area = fruAreas::fruAreaChassis;
@@ -353,12 +354,12 @@
                                        *(fruBytesIter + 2) << 16;
                 std::tm fruTime = intelEpoch();
                 std::time_t timeValue = std::mktime(&fruTime);
-                timeValue += minutes * 60;
+                timeValue += static_cast<long>(minutes) * 60;
                 fruTime = *std::gmtime(&timeValue);
 
                 // Tue Nov 20 23:08:00 2018
-                char timeString[32] = {0};
-                auto bytes = std::strftime(timeString, sizeof(timeString),
+                std::array<char, 32> timeString = {};
+                auto bytes = std::strftime(timeString.data(), timeString.size(),
                                            "%Y-%m-%d - %H:%M:%S", &fruTime);
                 if (bytes == 0)
                 {
@@ -366,7 +367,8 @@
                     return resCodes::resErr;
                 }
 
-                result["BOARD_MANUFACTURE_DATE"] = std::string(timeString);
+                result["BOARD_MANUFACTURE_DATE"] =
+                    std::string_view(timeString.data(), bytes);
                 fruBytesIter += 3;
                 fruAreaFieldNames = &boardFruAreas;
                 break;
@@ -389,7 +391,7 @@
             }
         }
         size_t fieldIndex = 0;
-        DecodeState state;
+        DecodeState state = DecodeState::ok;
         do
         {
             auto res =
@@ -447,7 +449,7 @@
         for (; fruBytesIter < fruBytesIterEndArea; fruBytesIter++)
         {
             uint8_t c = *fruBytesIter;
-            if (c)
+            if (c != 0U)
             {
                 std::cerr << "Non-zero byte after EndOfFields in FRU area "
                           << getFruAreaName(area) << "\n";
@@ -489,8 +491,8 @@
               fruData.begin() + fruAreaEndOffset, 0);
 
     size_t mod = traverseFRUAreaIndex % fruBlockSize;
-    size_t checksumLoc;
-    if (!mod)
+    size_t checksumLoc = 0;
+    if (mod == 0U)
     {
         traverseFRUAreaIndex += (fruBlockSize);
         checksumLoc = fruAreaEndOfFieldsOffset + (fruBlockSize - 1);
@@ -501,8 +503,9 @@
         checksumLoc = fruAreaEndOfFieldsOffset + (fruBlockSize - mod - 1);
     }
 
-    size_t newFRUAreaLen = (traverseFRUAreaIndex / fruBlockSize) +
-                           ((traverseFRUAreaIndex % fruBlockSize) != 0);
+    size_t newFRUAreaLen =
+        (traverseFRUAreaIndex / fruBlockSize) +
+        static_cast<unsigned long>((traverseFRUAreaIndex % fruBlockSize) != 0);
     size_t fruAreaLengthLoc = fruAreaStart + 1;
     fruData[fruAreaLengthLoc] = static_cast<uint8_t>(newFRUAreaLen);
 
@@ -634,7 +637,7 @@
 std::vector<uint8_t> readFRUContents(FRUReader& reader,
                                      const std::string& errorHelp)
 {
-    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
+    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData{};
     off_t baseOffset = 0x0;
 
     if (!findFRUHeader(reader, errorHelp, blockData, baseOffset))
@@ -725,7 +728,7 @@
             fruLength = (areaOffset > fruLength) ? areaOffset : fruLength;
 
             // If this is the end of the list bail.
-            if ((blockData[1] & multiRecordEndOfListMask))
+            if ((blockData[1] & multiRecordEndOfListMask) != 0)
             {
                 break;
             }
diff --git a/src/overlay.cpp b/src/overlay.cpp
index 966bfd1..9dfb6b1 100644
--- a/src/overlay.cpp
+++ b/src/overlay.cpp
@@ -17,8 +17,8 @@
 
 #include "overlay.hpp"
 
-#include "utils.hpp"
 #include "devices.hpp"
+#include "utils.hpp"
 
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/asio/io_context.hpp>
@@ -187,7 +187,7 @@
                        const std::string& destructor, const bool createsHWMon,
                        const size_t retries = 5)
 {
-    if (!retries)
+    if (retries == 0U)
     {
         return -1;
     }
@@ -282,7 +282,8 @@
     int err = buildDevice(busPath, parameters, bus, address, constructor,
                           destructor, createsHWMon);
 
-    if (!err && boost::ends_with(type, "Mux") && bus && address && channels)
+    if ((err == 0) && boost::ends_with(type, "Mux") && bus && address &&
+        (channels != nullptr))
     {
         linkMux(name, static_cast<size_t>(*bus), static_cast<size_t>(*address),
                 *channels);
@@ -302,7 +303,7 @@
             continue;
         }
 
-        for (auto& configuration : *findExposes)
+        for (const auto& configuration : *findExposes)
         {
             auto findStatus = configuration.find("Status");
             // status missing is assumed to be 'okay'
diff --git a/src/perform_probe.cpp b/src/perform_probe.cpp
index d5b7f3b..04ba87d 100644
--- a/src/perform_probe.cpp
+++ b/src/perform_probe.cpp
@@ -92,7 +92,7 @@
     probe_type_codes lastCommand = probe_type_codes::FALSE_T;
     bool first = true;
 
-    for (auto& probe : probeCommand)
+    for (const auto& probe : probeCommand)
     {
         FoundProbeTypeT probeType = findProbeType(probe);
         if (probeType)
@@ -198,7 +198,7 @@
     }
 
     // probe passed, but empty device
-    if (ret && foundDevs.size() == 0)
+    if (ret && foundDevs.empty())
     {
         // Use emplace back when clang implements
         // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0960r3.html
diff --git a/src/perform_scan.cpp b/src/perform_scan.cpp
index bf3c750..559b822 100644
--- a/src/perform_scan.cpp
+++ b/src/perform_scan.cpp
@@ -50,7 +50,7 @@
     const std::vector<std::shared_ptr<PerformProbe>>& probeVector,
     const std::shared_ptr<PerformScan>& scan, size_t retries = 5)
 {
-    if (!retries)
+    if (retries == 0U)
     {
         std::cerr << "retries exhausted on " << instance.busName << " "
                   << instance.path << " " << instance.interface << "\n";
@@ -83,7 +83,7 @@
 
     if constexpr (debug)
     {
-        std::cerr << __func__ << " " << __LINE__ << "\n";
+        std::cerr << __LINE__ << "\n";
     }
 }
 
@@ -172,7 +172,7 @@
                 }
                 std::cerr << "Error communicating to mapper.\n";
 
-                if (!retries)
+                if (retries == 0U)
                 {
                     // if we can't communicate to the mapper something is very
                     // wrong
@@ -202,7 +202,7 @@
 
     if constexpr (debug)
     {
-        std::cerr << __func__ << " " << __LINE__ << "\n";
+        std::cerr << __LINE__ << "\n";
     }
 }
 
@@ -216,7 +216,7 @@
 
     // use an array so alphabetical order from the flat_map is maintained
     auto device = nlohmann::json::array();
-    for (auto& devPair : probe)
+    for (const auto& devPair : probe)
     {
         device.push_back(devPair.first);
         std::visit([&device](auto&& v) { device.push_back(v); },
@@ -283,7 +283,9 @@
 
     int index = 0;
     auto str = nameIt->get<std::string>().substr(indexIdx);
-    auto [p, ec] = std::from_chars(str.data(), str.data() + str.size(), index);
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+    const char* endPtr = str.data() + str.size();
+    auto [p, ec] = std::from_chars(str.data(), endPtr, index);
     if (ec != std::errc())
     {
         return; // non-numeric replacement
@@ -638,7 +640,7 @@
                 std::cerr << "Probe statement wasn't a string, can't parse";
                 continue;
             }
-            if (findProbeType(probe->c_str()))
+            if (findProbeType(*probe))
             {
                 continue;
             }
@@ -657,7 +659,7 @@
                     std::move(dbusProbeInterfaces), shared_from_this());
     if constexpr (debug)
     {
-        std::cerr << __func__ << " " << __LINE__ << "\n";
+        std::cerr << __LINE__ << "\n";
     }
 }
 
@@ -674,7 +676,7 @@
 
         if constexpr (debug)
         {
-            std::cerr << __func__ << " " << __LINE__ << "\n";
+            std::cerr << __LINE__ << "\n";
         }
     }
     else
@@ -683,7 +685,7 @@
 
         if constexpr (debug)
         {
-            std::cerr << __func__ << " " << __LINE__ << "\n";
+            std::cerr << __LINE__ << "\n";
         }
     }
 }
diff --git a/src/utils.cpp b/src/utils.cpp
index ecd108a..2b77755 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -136,11 +136,7 @@
     parser.populateSchema(schemaAdapter, schema);
     valijson::Validator validator;
     valijson::adapters::NlohmannJsonAdapter targetAdapter(input);
-    if (!validator.validate(schema, targetAdapter, nullptr))
-    {
-        return false;
-    }
-    return true;
+    return validator.validate(schema, targetAdapter, nullptr);
 }
 
 bool isPowerOn(void)
@@ -239,7 +235,7 @@
         boost::replace_all(*strPtr, *replaceStr, std::to_string(index));
     }
 
-    for (auto& [propName, propValue] : interface)
+    for (const auto& [propName, propValue] : interface)
     {
         std::string templateName = templateChar + propName;
         boost::iterator_range<std::string::const_iterator> find =
@@ -252,7 +248,7 @@
         size_t start = find.begin() - strPtr->begin();
 
         // check for additional operations
-        if (!start && find.end() == strPtr->end())
+        if ((start == 0U) && find.end() == strPtr->end())
         {
             std::visit([&](auto&& val) { keyPair.value() = val; }, propValue);
             return ret;
diff --git a/test/test_fru-utils.cpp b/test/test_fru-utils.cpp
index 02abc34..9470e4c 100644
--- a/test/test_fru-utils.cpp
+++ b/test/test_fru-utils.cpp
@@ -155,9 +155,9 @@
         return 0;
     }
 
-    uint16_t idx;
-    for (idx = offset; idx < data.size() && idx < offset + length;
-         ++idx, ++outBuf)
+    uint16_t idx = offset;
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+    for (; idx < std::min(data.size(), offset + length); ++idx, ++outBuf)
     {
         *outBuf = data[idx];
     }
@@ -172,7 +172,7 @@
     {
         data.push_back(i);
     }
-    std::array<uint8_t, blockSize * 2> rdbuf;
+    std::array<uint8_t, blockSize * 2> rdbuf{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -206,7 +206,7 @@
 {
     std::vector<uint8_t> data = {};
     data.resize(blockSize / 2);
-    std::array<uint8_t, blockSize> blockData;
+    std::array<uint8_t, blockSize> blockData{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -238,7 +238,8 @@
 TEST(FRUReaderTest, CacheHit)
 {
     std::vector<uint8_t> data = {'X'};
-    std::array<uint8_t, blockSize> read1, read2;
+    std::array<uint8_t, blockSize> read1{};
+    std::array<uint8_t, blockSize> read2{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -255,7 +256,7 @@
 TEST(FRUReaderTest, ReadPastKnownEnd)
 {
     const std::vector<uint8_t> data = {'X', 'Y'};
-    std::array<uint8_t, blockSize> rdbuf;
+    std::array<uint8_t, blockSize> rdbuf{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -275,7 +276,7 @@
     std::vector<uint8_t> data = {};
     data.resize(blockSize, 'X');
     data.resize(2 * blockSize, 'Y');
-    std::array<uint8_t, 2 * blockSize> rdbuf;
+    std::array<uint8_t, 2 * blockSize> rdbuf{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -290,7 +291,7 @@
 {
     std::vector<uint8_t> data = {};
     data.resize(3 * blockSize, 'X');
-    std::array<uint8_t, blockSize> rdbuf;
+    std::array<uint8_t, blockSize> rdbuf{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -305,7 +306,7 @@
 {
     const std::vector<uint8_t> data = {255, 16};
     off_t offset = 0;
-    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
+    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -318,7 +319,7 @@
 {
     const std::vector<uint8_t> data = {};
     off_t offset = 0;
-    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
+    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -332,7 +333,7 @@
     const std::vector<uint8_t> data = {0x01, 0x00, 0x01, 0x02,
                                        0x03, 0x04, 0x00, 0xf5};
     off_t offset = 0;
-    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
+    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -347,7 +348,7 @@
     std::vector<uint8_t> data = {'$', 'T', 'Y', 'A', 'N', '$', 0, 0};
     data.resize(0x6000 + I2C_SMBUS_BLOCK_MAX);
     off_t offset = 0;
-    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
+    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -360,7 +361,7 @@
 {
     const std::vector<uint8_t> data = {'$', 'T', 'Y', 'A', 'N', '$', 0, 0};
     off_t offset = 0;
-    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
+    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
@@ -378,7 +379,7 @@
     copy(fruHeader.begin(), fruHeader.end(), back_inserter(data));
 
     off_t offset = 0;
-    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData;
+    std::array<uint8_t, I2C_SMBUS_BLOCK_MAX> blockData{};
     auto getData = [&data](auto o, auto l, auto* b) {
         return getDataTempl(data, o, l, b);
     };
