mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-10 17:16:36 +00:00
chore(scripts): delete unreferenced helper scripts
None of these is referenced by an installer, systemd unit, CI workflow, test, the web UI or src/: - utils/cleanup_venv.sh removes venv_web_v2, which nothing creates - utils/clear_python_cache.sh hardcodes ~/LEDMatrix and a .webassets-cache nothing uses - install/migrate_config.sh only copies the template, which the installer and ConfigManager already do - install/debug_install.sh, debug/debug_web_manual.py - diagnose_web_ui.sh and verify_web_ui.sh overlap diagnose_web_interface.sh, which the docs point to - fix_internet_connectivity.sh is iptables-only (stale on nftables) - diagnose_plugin_permissions.sh, dev/validate_python.py - download_nba_logos.py + README_NBA_LOGOS.md: logo_downloader fetches logos on demand - setup_plugin_repos.py linked into the production plugin-repos/ dir; the dev workflow is scripts/dev/dev_plugin_setup.sh, and MULTI_ROOT_WORKSPACE_SETUP.md now uses it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,6 @@ This directory contains scripts and utilities for development and testing.
|
||||
|
||||
- **`dev_plugin_setup.sh`** - Sets up plugin development environment by linking plugin repositories
|
||||
- **`run_emulator.sh`** - Runs the LED Matrix display in emulator mode (for development without hardware)
|
||||
- **`validate_python.py`** - Validates Python files for common formatting and syntax errors
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -30,8 +29,3 @@ links. To use a fork or another clone location, copy
|
||||
./scripts/dev/run_emulator.sh
|
||||
```
|
||||
|
||||
### Validating Python Files
|
||||
```bash
|
||||
python3 scripts/dev/validate_python.py <file.py>
|
||||
```
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Python file validation script to prevent common formatting errors.
|
||||
|
||||
This script checks for:
|
||||
1. Proper indentation (4 spaces, no mixed tabs/spaces)
|
||||
2. Missing imports
|
||||
3. Syntax errors
|
||||
4. Line length issues
|
||||
5. Proper try/except structure
|
||||
|
||||
Usage: python tools/validate_python.py <python_file>
|
||||
"""
|
||||
|
||||
import ast
|
||||
import sys
|
||||
import os
|
||||
|
||||
def validate_file(filepath: str) -> bool:
|
||||
"""Validate a Python file for common issues."""
|
||||
try:
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
issues_found = []
|
||||
|
||||
# Check for tabs (should use spaces)
|
||||
if '\t' in content:
|
||||
issues_found.append("❌ Contains tabs - use 4 spaces instead")
|
||||
|
||||
# Check for trailing whitespace
|
||||
lines = content.split('\n')
|
||||
for i, line in enumerate(lines, 1):
|
||||
if line.rstrip() != line:
|
||||
issues_found.append(f"❌ Line {i}: Trailing whitespace")
|
||||
|
||||
# Check for very long lines
|
||||
for i, line in enumerate(lines, 1):
|
||||
if len(line) > 120:
|
||||
issues_found.append(f"⚠️ Line {i}: Very long line ({len(line)} chars)")
|
||||
|
||||
# Check for proper try/except structure
|
||||
try:
|
||||
ast.parse(content)
|
||||
except SyntaxError as e:
|
||||
issues_found.append(f"❌ Syntax error: {e}")
|
||||
|
||||
# Check for mixed quotes (inconsistency)
|
||||
single_quotes = content.count("'")
|
||||
double_quotes = content.count('"')
|
||||
if single_quotes > 0 and double_quotes > 0:
|
||||
issues_found.append("⚠️ Mixed quote usage - consider using double quotes consistently")
|
||||
|
||||
# Report results
|
||||
if issues_found:
|
||||
print(f"\n🔍 Validation Results for: {filepath}")
|
||||
print("=" * 50)
|
||||
for issue in issues_found:
|
||||
print(issue)
|
||||
return False
|
||||
else:
|
||||
print(f"✅ {filepath} - All checks passed!")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error reading file {filepath}: {e}")
|
||||
return False
|
||||
|
||||
def validate_directory(directory: str) -> bool:
|
||||
"""Validate all Python files in a directory."""
|
||||
all_passed = True
|
||||
|
||||
for root, dirs, files in os.walk(directory):
|
||||
for file in files:
|
||||
if file.endswith('.py'):
|
||||
filepath = os.path.join(root, file)
|
||||
if not validate_file(filepath):
|
||||
all_passed = False
|
||||
|
||||
return all_passed
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python tools/validate_python.py <file_or_directory>")
|
||||
sys.exit(1)
|
||||
|
||||
target = sys.argv[1]
|
||||
|
||||
if os.path.isfile(target):
|
||||
validate_file(target)
|
||||
elif os.path.isdir(target):
|
||||
validate_directory(target)
|
||||
else:
|
||||
print(f"❌ Path not found: {target}")
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user