#!/bin/bash cd "$(dirname "$0")" python3 - <<'PY' import json, collections, re e716=collections.Counter(); e599=collections.Counter(); e425=collections.Counter() misc=collections.Counter(); sites716=[] for line in open('/tmp/m5.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 '?' txt=msg.get('message') or '' sp=msg.get('spans') or [] where=(sp[0]['file_name'].split('/')[-1]+':'+str(sp[0].get('line_start'))) if sp else '?' if code=='E0716': lbls=[s.get('label') or '' for s in sp if s.get('label')] e716[tuple(sorted(set(l[:40] for l in lbls)))[:2]]+=1 if len(sites716)<6: sites716.append(where) elif code=='E0599': mm=re.search(r'no method named `([^`]+)` found for (?:struct|reference) `([^`]+)`', txt) e599[(mm.group(1), mm.group(2)[:30]) if mm else (txt[:40],'')]+=1 elif code=='E0425': mm=re.match(r"cannot find (?:value|function) `([^`]+)` in module `([^`]+)`", txt) e425[(mm.group(1), mm.group(2)) if mm else (txt[:40],'')]+=1 elif code in ('E0658','E0061','E0515','E0603','E0609','E0252'): misc[(code, txt[:56], where)]+=1 print(" === E0716 temporary dropped while borrowed: the labels ===") for k,n in e716.most_common(5): print(f" {n:4} {k}") print(" sample sites:", ", ".join(sites716)) print("\n === E0599 missing methods ===") for (m_,t),n in e599.most_common(8): print(f" {n:4} .{m_}() on {t}") print("\n === E0425 missing, by module ===") for (n_,mod),c in e425.most_common(10): print(f" {c:4} {mod}::{n_}") print("\n === the 15 misc, individually ===") for (c,t,w),n in misc.most_common(15): print(f" {c} {w}: {t}") PY