60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""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) |