tracker
All repositories: gitoria
1.8 KB
# tools/lambda-audit.py <app dir> (mission 070, hybriel#48): every lambda that CHANGES a parameter without & (field/list# writes, or a local alias `x = p` / `let x = p` — mission 028: a plain declaration copies like `let`) — since 8efba065 it changes a COPY; check that each caller uses the returned value.import re,sys,glob,osos.chdir(sys.argv[1])files=[f for f in glob.glob('*.hl')+glob.glob('lib/*.hl')+glob.glob('components/*.hl')+glob.glob('tools/*.hl')+glob.glob('tests/*.hl')+glob.glob('shared/*.hl')]lam=re.compile(r'(?:^|[\s,(=])(?:static\s+)?([A-Za-z_]\w*)?\s*=?\s*\(([^()]*)\)\s*=>\s*\{')tot=0for f in sorted(files):src=open(f,encoding='utf-8').read()for m in re.finditer(r'\(([^()]*)\)\s*=>\s*\{',src):params=[p.strip() for p in m.group(1).split(',') if p.strip()]i=m.end(); depth=1while depth and i<len(src):c=src[i]if c=='{':depth+=1elif c=='}':depth-=1i+=1body=src[m.end():i-1]line=src.count('\n',0,m.start())+1tot+=1for p in params:if p.startswith('&'): continuep=p.split('=')[0].strip()if not re.match(r'^\w+$',p): continuehits=[]for pat,kind in [(r'\b%s(?:\.\w+|\[[^\]]*\])+\s*=(?!=)'%p,'field-assign'),(r'\b%s(?:\.\w+|\[[^\]]*\])*\.(push|pop|shift|unshift|splice|sort|reverse)\('%p,'list-mutate'),(r'^\s*(?:let\s+)?(\w+)\s*=\s*%s\s*$'%p,'alias')]:for h in re.finditer(pat,body,re.M):hits.append(kind+': '+body[max(0,h.start()-0):h.end()+20].split('\n')[0].strip())if hits:name=src[max(0,m.start()-60):m.start()].split('\n')[-1].strip()print(f'{f}:{line} [{name} ({",".join(params)})] param {p}:', ' | '.join(hits[:4]))print('lambdas scanned:',tot, file=sys.stderr)
Branches
Latest commits
- d049b8b8Log: HM50 live, #52 donemre
- 6d05fa37Log: HM50 Part A mergedmre
- 1c7dab74HM50: the shell reads the framework's online state, netProbe removed (tracker#55)mre
- e8b91697HM50: search address follows the text via navigate(path, replace = true) (tracker#52)mre
- 6fe1896cHM50: re-vendor Hybriel set day50 (source 0ae38232, bin d3ef9d16)mre
- 2f391aa9Log: HM50 startedmre
- 4b59c03dHM50 mission: doc pathmre
- ed526d67HM50 missionmre
- 2f986ca3Log: RT50 passmre
- 1c4715a4RT50 mission: day50 repro retestmre
- 57d1c0dcLog: day50 retest requestmre
- 60b1f419Log: Anton #336 result, wake checkmre
- 919a18aalog: scratchmre
- 6b504440status tidymre
- 9332bd10log: DP70 livemre
- be11daa0DP70 brief fixmre
- 886a7028DP70 brief, HM67 mergedmre
- b41cdd6dMerge hm67-searchids: packed search IDsmre
- 385904eaReport HM67 matched heap measurements and gate proofmre
- e5c9b659Pack retained search IDs into UTF-8 bytesmre