Change variable scopes

cppcheck correctly notes that a lot of our variables can be declared at
more specific scopes, and in every case, it seems to be correct.

Tested: Redfish service validator passes.  Unit test coverage on others.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia4414410d0e8f74a3bd40fdc0e0232450d1a6416
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index 2f0f156..7955fc0 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -67,7 +67,6 @@
 
         for (const auto& [path, interfaces] : statuses)
         {
-            bool isChild = false;
             bool isSelf = false;
             if (selfPath)
             {
@@ -86,6 +85,7 @@
                 // of this association is an inventory item, or one of the
                 // endpoints in this association is a child
 
+                bool isChild = false;
                 for (const std::string& child : inventory)
                 {
                     if (path.str.starts_with(child))