EU-Utility/code_review_report.py

87 lines
2.2 KiB
Python

"""
EU-Utility - Code Review Report
Date: 2026-02-13
Status: FIXED
=== BUGS FIXED ===
1. SyntaxError: invalid decimal literal (eu_styles.py)
- Cause: Mismatched quotes in style entries
- Fix: Changed closing quotes to proper triple quotes
2. SyntaxError: unterminated string literal (tp_runner/plugin.py)
- Cause: Missing closing quote on Tides entry
- Fix: Added missing quote
3. NameError: name 'Path' is not defined (overlay_widgets.py)
- Cause: Missing import
- Fix: Added from pathlib import Path
4. Plugin crashes killing entire app
- Cause: No error isolation in plugin loading
- Fix: Added comprehensive try/except with traceback
=== IMPROVEMENTS MADE ===
1. Plugin API System
- New file: core/plugin_api.py
- Cross-plugin communication via register_api() / call_api()
- Shared services: OCR, Log reading, Data storage
- Event pub/sub system
2. BasePlugin API Integration
- Added API methods to base_plugin.py
- Plugins can expose APIs to other plugins
- Plugins can use shared services
3. Error Handling
- Plugin loading now catches ALL exceptions
- Detailed error messages with stack traces
- Failed plugins are skipped gracefully
=== TESTING ===
To test:
1. Pull latest: git pull origin main
2. Install deps: pip install -r requirements.txt
3. Run: python -m core.main
"""
import ast
import sys
from pathlib import Path
def validate_python_files(directory):
"""Validate all Python files for syntax errors."""
errors = []
for py_file in Path(directory).rglob("*.py"):
if "__pycache__" in str(py_file):
continue
try:
with open(py_file, 'r', encoding='utf-8') as f:
source = f.read()
ast.parse(source)
except SyntaxError as e:
errors.append(f"{py_file}: {e}")
except Exception as e:
errors.append(f"{py_file}: {e}")
return errors
if __name__ == "__main__":
print("Validating EU-Utility code...")
errors = validate_python_files(".")
if errors:
print("\nSYNTAX ERRORS FOUND:")
for error in errors:
print(f" {error}")
sys.exit(1)
else:
print("\nALL FILES VALID - NO SYNTAX ERRORS!")
sys.exit(0)