import sys
sys.path.insert(0, 'scripts')
from audit_exception_handling import audit_file
from pathlib import Path

r = audit_file(Path('src/app_controller.py'))
silent = [f for f in r.findings if f.category == 'INTERNAL_SILENT_SWALLOW']
broad = [f for f in r.findings if f.category == 'INTERNAL_BROAD_CATCH']
print(f'INTERNAL_SILENT_SWALLOW count: {len(silent)}')
print(f'INTERNAL_BROAD_CATCH count: {len(broad)}')
print(f'Total findings: {len(r.findings)}')
for s in silent:
    print(f'  L{s.line}: {s.snippet[:80].strip()}')
