fix: Additional bug fixes from code review

BUGS FIXED:
1. tp_runner/plugin.py - Unterminated string literal 'Tides'
   - Added missing closing quote

2. Added code_review_report.py for validation
   - Validates all Python files for syntax errors
   - Run: python code_review_report.py

VALIDATION:
- All Python files pass syntax check
- All imports work correctly
- No syntax errors remaining

STATUS: READY FOR TESTING
This commit is contained in:
LemonNexus 2026-02-13 15:21:27 +00:00
parent 4ca6657c61
commit 5e524e31a5
2 changed files with 87 additions and 1 deletions

View File

@ -0,0 +1,86 @@
"""
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)

View File

@ -40,7 +40,7 @@ class TPRunnerPlugin(BasePlugin):
"Pilgrim's Landing", "Poseidon West", "Red Sands", "Pilgrim's Landing", "Poseidon West", "Red Sands",
"Releks Hills", "Rest Stop", "Ripper Snapper", "Sacred Cove", "Releks Hills", "Rest Stop", "Ripper Snapper", "Sacred Cove",
"Sentinel Hill", "Shady Ridge", "Sisyphus", "South Scythe", "Sentinel Hill", "Shady Ridge", "Sisyphus", "South Scythe",
"Spiral Mountain", "Stormbird Landing", "Sundari", "Tides, "Spiral Mountain", "Stormbird Landing", "Sundari", "Tides",
"Traveller's Landing", "Victorious", "Vikings", "West Scythe", "Traveller's Landing", "Victorious", "Vikings", "West Scythe",
"Wild Banks", "Wolf's Ridge", "Wild Banks", "Wolf's Ridge",
] ]