#!/bin/bash cd "$(dirname "$0")" python3 - <<'PY' import json, collections, re pairs=collections.Counter(); labels=collections.Counter(); names=collections.Counter() for line in open('/tmp/m2.json'): try: m=json.loads(line) except Exception: continue if m.get('reason')!='compiler-message': continue msg=m.get('message') or {} if msg.get('level')!='error': continue code=(msg.get('code') or {}).get('code') or '?' for sp in (msg.get('spans') or []): lbl=sp.get('label') or '' if code=='E0308' and lbl: mm=re.search(r'expected `?([^`,]+)`?,?\s*found `?([^`]+)`?', lbl) if mm: pairs[(mm.group(1).strip()[:30], mm.group(2).strip()[:30])]+=1 else: labels[lbl[:60]]+=1 if code=='E0425': mm=re.match(r"cannot find (?:value|function) `([^`]+)`", msg.get('message','')) if mm: names[mm.group(1)]+=1 print(" === E0308 expected -> found (from span labels) ===") for (e,f),n in pairs.most_common(14): print(f" {n:4} expected {e:30} found {f}") if labels: print(" --- E0308 labels that did not parse ---") for l,n in labels.most_common(6): print(f" {n:4} {l}") print("\n === E0425 missing names ===") for n_,c in names.most_common(14): print(f" {c:4} {n_}") PY