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
- 78ee6b56Move remaining component styles into Style blocksmre
- 7f04de33log: HM49Bmre
- 00616cf3log: #49 batch merged, DP67 startedmre
- d7232e86Merge hm49-styles: tracker#49 first batch of component stylesmre
- 079f376dMove seven components' styles into Style blocksmre
- 17d66feelog: #58 mergedmre
- 69a6640bMerge hm58-map: tracker#58 project.hl only the mapmre
- a85f7900Move route logic out of the project mapmre
- 13dea5belog: #56 live, HM49 and HM58 startedmre
- a31c8f2fdocs: tracker#36 remaining listmre
- 975d06d1log: #36 live, DP66 startedmre
- d6d03fa3mission: T36Bmre
- e7512d00status: #36 rolled back, retry askedmre
- c98e2043log: T36A rollbackmre
- ae905f15Merge t36a: tracker#36 apply rechecks, reportmre
- 796bfaceT36A: report validated fixes, failed live SSH check and verified rollbackmre
- 55257852log: #53 live, #56 mergedmre
- 78b39f1bMerge hm56-rows: tracker#56 list builders insert oncemre
- 7aea52batmdb fix: protect owners without slugs and record passing gatesmre
- 9b3c2559tmdb fix: revalidate planned identities and reserve target idsmre