Skip to content

Commit 0d83a1f

Browse files
committed
shellcheck_job.py: Handle lists of commands
Signed-off-by: Zack Cerza <[email protected]>
1 parent 6a10989 commit 0d83a1f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

scripts/shellcheck_job.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
import argparse
3+
import json
34
import pathlib
45
import subprocess
56
import sys
@@ -73,6 +74,14 @@ def find(obj: dict, key: str, result=None, path="") -> list[tuple]:
7374
maybe_result = find(v, key, result, subpath)
7475
if maybe_result is not result:
7576
result.append((subpath, maybe_result[-1]))
77+
elif isinstance(v, list):
78+
for index, item in enumerate(v):
79+
if not isinstance(item, dict):
80+
continue
81+
subpath = f"{path}.{index}"
82+
maybe_result = find(item, key, result, subpath)
83+
if maybe_result is not result:
84+
result.append((subpath, maybe_result[-1]))
7685
return result
7786

7887

0 commit comments

Comments
 (0)