import json, os, sys sys.stdout.reconfigure(encoding='utf-8') data = json.load(open('scratch/deep_scan_flaws.json', encoding='utf-8')) by_file = {} for d in data: f = os.path.basename(d['file']) by_file.setdefault(f, []).append(d) print(f"Total Flaws: {len(data)}") for f, items in sorted(by_file.items()): print(f"\n=== {f} ({len(items)} items) ===") for item in items: line_no = item.get('line', item.get('start_line', '?')) itype = item.get('type') detail = item.get('detail', '') print(f" Line {line_no}: [{itype}] {detail[:100]}")