Files
troupe-standup/wizard-work/spark/verify_loc_report.py
T

63 lines
2.0 KiB
Python

#!/usr/bin/env python3
# Q63 (2026-10-24): no committed gate invokes this file -- `git grep -F -n verify_loc_report.py HEAD
# -- '*.py' '*.sh' CHECK` matches nothing outside this file -- so it is a one-off
# artifact, run by hand against its subject, not a standing check.
"""Verify the profile LOC report is accurate."""
import json
import sys
# Read the JSON report
with open('/root/.hermes/wizard-outputs/spark/profile_loc_report.json', 'r') as f:
data = json.load(f)
# Check that the report has the expected structure
if 'summary' not in data:
print("FAIL: No summary in report")
sys.exit(1)
summary = data['summary']
# Verify key metrics
total_code = summary.get('totalCodeCount', 0)
total_files = summary.get('totalFileCount', 0)
# According to pygount, we should have ~973 files and ~24,272 lines of code
if total_files != 973:
print(f"FAIL: Expected 973 files, got {total_files}")
sys.exit(1)
if total_code != 24272:
print(f"FAIL: Expected 24272 lines of code, got {total_code}")
sys.exit(1)
# Verify languages section
if 'languages' not in data or len(data['languages']) == 0:
print("FAIL: No languages in report")
sys.exit(1)
# Check Python language is present
python_lang = None
for lang in data['languages']:
if lang.get('language') == 'Python':
python_lang = lang
break
if python_lang is None:
print("FAIL: No Python language in report")
sys.exit(1)
# Python should have ~50 files and ~7,894 lines of code
if python_lang.get('fileCount') != 50:
print(f"FAIL: Expected 50 Python files, got {python_lang.get('fileCount')}")
sys.exit(1)
if python_lang.get('codeCount') != 7894:
print(f"FAIL: Expected 7894 Python lines of code, got {python_lang.get('codeCount')}")
sys.exit(1)
print("PASS: All verification checks passed")
print(f"Total files: {total_files}")
print(f"Total code lines: {total_code}")
print(f"Python files: {python_lang.get('fileCount')}")
print(f"Python code lines: {python_lang.get('codeCount')}")
sys.exit(0)