]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
shellcheck_job.py: Handle lists of commands shellcheck-lists 2480/head
authorZack Cerza <zack@cerza.org>
Mon, 27 Oct 2025 18:47:49 +0000 (11:47 -0700)
committerZack Cerza <zack@cerza.org>
Tue, 4 Nov 2025 01:55:59 +0000 (18:55 -0700)
Signed-off-by: Zack Cerza <zack@cerza.org>
scripts/shellcheck_job.py

index 81255567769d00d20819b0a7b63041b9fdc8254b..c7b6433e11a0a935eb31561d9cb01d8ce6708e25 100755 (executable)
@@ -73,6 +73,14 @@ def find(obj: dict, key: str, result=None, path="") -> list[tuple]:
             maybe_result = find(v, key, result, subpath)
             if maybe_result is not result:
                 result.append((subpath, maybe_result[-1]))
+        elif isinstance(v, list):
+            for index, item in enumerate(v):
+                if not isinstance(item, dict):
+                    continue
+                subpath = f"{path}.{index}"
+                maybe_result = find(item, key, result, subpath)
+                if maybe_result is not result:
+                    result.append((subpath, maybe_result[-1]))
     return result